Skip to content

Commit 255539c

Browse files
committed
fix: prevent skeleton route status entries for unmanaged GatewayClasses
When processing policies (EnvoyExtensionPolicy, SecurityPolicy), the translator was calling GetRouteParentContext for ALL parentRefs in a route, even those referencing gateways with different GatewayClasses not managed by this translator. GetRouteParentContext creates a skeleton RouteParentStatus entry with just the controllerName when called on a parentRef that hasn't been processed yet. Since all GatewayClass instances share the same controller name, these skeleton entries persisted in status without conditions. The fix checks if a parentRef context already exists before attempting to apply policy configuration to it. If the context doesn't exist, it means this parentRef wasn't processed by this translator and should be skipped. Signed-off-by: Raj Singh <[email protected]>
1 parent c853061 commit 255539c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

internal/gatewayapi/envoyextensionpolicy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,12 @@ func (t *Translator) translateEnvoyExtensionPolicyForRoute(
475475
parentRefs := GetParentReferences(route)
476476
routesWithDirectResponse := sets.New[string]()
477477
for _, p := range parentRefs {
478-
parentRefCtx := GetRouteParentContext(route, p, t.GatewayControllerName)
478+
// Skip if this parentRef was not processed by this translator
479+
// (e.g., references a Gateway with a different GatewayClass)
480+
parentRefCtx := route.GetRouteParentContext(p)
481+
if parentRefCtx == nil {
482+
continue
483+
}
479484
gtwCtx := parentRefCtx.GetGateway()
480485
if gtwCtx == nil {
481486
continue

internal/gatewayapi/securitypolicy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,12 @@ func (t *Translator) translateSecurityPolicyForRoute(
647647
parentRefs := GetParentReferences(route)
648648
routesWithDirectResponse := sets.New[string]()
649649
for _, p := range parentRefs {
650-
parentRefCtx := GetRouteParentContext(route, p, t.GatewayControllerName)
650+
// Skip if this parentRef was not processed by this translator
651+
// (e.g., references a Gateway with a different GatewayClass)
652+
parentRefCtx := route.GetRouteParentContext(p)
653+
if parentRefCtx == nil {
654+
continue
655+
}
651656
gtwCtx := parentRefCtx.GetGateway()
652657
if gtwCtx == nil {
653658
continue

0 commit comments

Comments
 (0)