Skip to content

Commit 50ea1e8

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.
1 parent 1d0f076 commit 50ea1e8

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
@@ -470,7 +470,12 @@ func (t *Translator) translateEnvoyExtensionPolicyForRoute(
470470
prefix := irRoutePrefix(route)
471471
parentRefs := GetParentReferences(route)
472472
for _, p := range parentRefs {
473-
parentRefCtx := GetRouteParentContext(route, p, t.GatewayControllerName)
473+
// Skip if this parentRef was not processed by this translator
474+
// (e.g., references a Gateway with a different GatewayClass)
475+
parentRefCtx := route.GetRouteParentContext(p)
476+
if parentRefCtx == nil {
477+
continue
478+
}
474479
gtwCtx := parentRefCtx.GetGateway()
475480
if gtwCtx == nil {
476481
continue

internal/gatewayapi/securitypolicy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,12 @@ func (t *Translator) translateSecurityPolicyForRoute(
591591
prefix := irRoutePrefix(route)
592592
parentRefs := GetParentReferences(route)
593593
for _, p := range parentRefs {
594-
parentRefCtx := GetRouteParentContext(route, p, t.GatewayControllerName)
594+
// Skip if this parentRef was not processed by this translator
595+
// (e.g., references a Gateway with a different GatewayClass)
596+
parentRefCtx := route.GetRouteParentContext(p)
597+
if parentRefCtx == nil {
598+
continue
599+
}
595600
gtwCtx := parentRefCtx.GetGateway()
596601
if gtwCtx == nil {
597602
continue

0 commit comments

Comments
 (0)