diff --git a/internal/gatewayapi/contexts.go b/internal/gatewayapi/contexts.go index 0dd197cceea..8ee05a241de 100644 --- a/internal/gatewayapi/contexts.go +++ b/internal/gatewayapi/contexts.go @@ -44,8 +44,6 @@ func (g *GatewayContext) ResetListeners(resources *resource.Resources, epMap map listenerStatusIdx: i, } } - - g.attachEnvoyProxy(resources, epMap) } func (g *GatewayContext) attachEnvoyProxy(resources *resource.Resources, epMap map[types.NamespacedName]*egv1a1.EnvoyProxy) { diff --git a/internal/gatewayapi/testdata/envoyproxy-gateway-accesslog-with-bad-sinks.out.yaml b/internal/gatewayapi/testdata/envoyproxy-gateway-accesslog-with-bad-sinks.out.yaml index a6bb55e49a8..5da07c49ab5 100644 --- a/internal/gatewayapi/testdata/envoyproxy-gateway-accesslog-with-bad-sinks.out.yaml +++ b/internal/gatewayapi/testdata/envoyproxy-gateway-accesslog-with-bad-sinks.out.yaml @@ -27,10 +27,5 @@ gateways: reason: InvalidParameters status: "False" type: Accepted - listeners: - - attachedRoutes: 0 - conditions: null - name: http - supportedKinds: null infraIR: {} xdsIR: {} diff --git a/internal/gatewayapi/translator.go b/internal/gatewayapi/translator.go index 1a38a6ff242..e6bb75d35c2 100644 --- a/internal/gatewayapi/translator.go +++ b/internal/gatewayapi/translator.go @@ -386,6 +386,7 @@ func (t *Translator) GetRelevantGateways(resources *resource.Resources) ( gCtx := &GatewayContext{ Gateway: gateway, } + gCtx.attachEnvoyProxy(resources, envoyproxyMap) // Gateways that are not accepted by the controller because they reference an invalid EnvoyProxy. if status.GatewayNotAccepted(gCtx.Gateway) { @@ -394,7 +395,6 @@ func (t *Translator) GetRelevantGateways(resources *resource.Resources) ( continue } - gCtx.ResetListeners(resources, envoyproxyMap) if ep := gCtx.envoyProxy; ep != nil { key := utils.NamespacedName(ep) if err, exits := envoyproxyValidationErrorMap[key]; exits { @@ -406,6 +406,8 @@ func (t *Translator) GetRelevantGateways(resources *resource.Resources) ( } } + // we cannot do this early, otherwise there's an error when updating status. + gCtx.ResetListeners(resources, envoyproxyMap) acceptedGateways = append(acceptedGateways, gCtx) } return diff --git a/internal/infrastructure/runner/runner.go b/internal/infrastructure/runner/runner.go index 1c5d1f1e682..07a9de81503 100644 --- a/internal/infrastructure/runner/runner.go +++ b/internal/infrastructure/runner/runner.go @@ -106,7 +106,7 @@ func (r *Runner) updateProxyInfraFromSubscription(ctx context.Context, sub <-cha // Subscribe to resources message.HandleSubscription(message.Metadata{Runner: r.Name(), Message: message.InfraIRMessageName}, sub, func(update message.Update[string, *ir.Infra], errChan chan error) { - r.Logger.Info("received an update") + r.Logger.Info("received an update", "key", update.Key, "delete", update.Delete) val := update.Value if update.Delete {