Skip to content

controller: notify gateways after GatewayConfig deletion - #2877

Open
spicysharkco wants to merge 1 commit into
theagentrouter:mainfrom
spicysharkco:fix/gateway-config-deletion
Open

spicysharkco wants to merge 1 commit into
theagentrouter:mainfrom
spicysharkco:fix/gateway-config-deletion

Conversation

@spicysharkco

Copy link
Copy Markdown

Description

Create a GatewayConfig named example with spec.extProc.kubernetes.env setting OTEL_EXPORTER_OTLP_ENDPOINT. Create a Gateway in the same namespace with aigateway.envoyproxy.io/gateway-config: example. Once the setting applies, delete the config without changing the Gateway or its routes. The injected extproc environment keeps the removed setting until another event reconciles the Gateway. Envoy metadata-forwarding and forward-proxy settings can also remain stale.

The delete reconcile receives the config's name and namespace, but the NotFound branch returns without notifying referencing Gateways (internal/controller/gateway_config.go:56). Reuse syncGatewayConfig with that request identity. The existing index reads the Gateway annotation, so it still finds references after deletion. Gateway reconciliation already falls back to defaults when the config is missing (internal/controller/gateway.go:1585). List errors are returned for retry; the missing config's status is not updated.

The deletion test now deletes the object before reconciling its key. Setting only a deletion timestamp left the object readable and missed this path. The missing-config expectation and list-error assertion cover the changed NotFound behavior. A never-created config also notifies current references because the request cannot distinguish it from a deletion.

Related Issues/PRs (if applicable)

Follow-up to #1623, #2427, and #2540. Open and closed PR/issue searches found no competing deletion fix. Open #2710 modernizes syntax in the same test and conflicts with its setup changes.

The same early return exists on release/v0.5, release/v0.6, release/v0.7, release/v1.0, and release/v1.1; this targets main.

Special notes for reviewers (if applicable)

Run locally:

go test -json -count=1 ./internal/controller -run 'TestGatewayConfigController_(DeletionDoesNotBlock|GatewayReferencesNonExistingConfig|ListErrorSetsNotAcceptedStatus)$'

With only the production fix reverted: 3 failed, 0 passed. Fixed: 3 passed, 0 failed.

go test -json -count=1 ./internal/controller/...: 3 packages, 273 top-level tests and 540 subtests passed; none failed or skipped.

go test -race -json -count=1 ./internal/controller: 232 top-level tests and 469 subtests passed; none failed or skipped. go vet ./internal/controller passed.

make precommit passed: 0 lint issues; 2 charts linted, 0 failures.

The cache resync is filtered by the generation predicate, so it does not bound recovery. Config recreation notifies Gateways through the existing path. Annotation-only reference edits have a separate existing generation-filtering limitation.

No live-cluster, end-to-end, or release-branch validation. The repository-wide suite was not rerun for this review.

Notify referencing Gateways when the config is no longer present so they
can reconcile with defaults. Preserve list errors for retry.

Signed-off-by: Leo King <321699413+spicysharkco@users.noreply.github.com>
@spicysharkco
spicysharkco requested a review from a team as a code owner October 17, 2026 05:21
@netlify

netlify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for theagentrouter canceled.

Name Link
🔨 Latest commit 5c951bd
🔍 Latest deploy log https://app.netlify.com/projects/theagentrouter/deploys/6ad305db916de1bea3ce93a2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant