fix: gate Grafana ingress forward-auth annotation on site opt-in#320
Draft
amdove wants to merge 1 commit into
Draft
fix: gate Grafana ingress forward-auth annotation on site opt-in#320amdove wants to merge 1 commit into
amdove wants to merge 1 commit into
Conversation
The Grafana Helm ingress unconditionally stamped the kube-system-traefik-forward-auth-main / -add-forwarded-headers middleware annotation. Those middlewares are only created by the clusters step when a site sets use_traefik_forward_auth: true, so on workloads that don't enable forward-auth the ingress referenced a non-existent middleware and Traefik invalidated the router (HTTP 404). Only add the annotation when the main site opts into forward-auth; otherwise Grafana routes straight through to its local-account login. Regression from the eks/cluster Python->Go migration (ae26379), which folded the previously-unconditional global traefik-forward-auth middleware into per-site, flag-gated logic. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Grafana's in-cluster ingress returned HTTP 404 on workloads that don't enable traefik-forward-auth. The Grafana Helm ingress always stamped a
traefik.ingress.kubernetes.io/router.middlewaresannotation referencing thekube-system-traefik-forward-auth-mainandkube-system-traefik-forward-auth-add-forwarded-headersmiddlewares. Those middlewares are only created by theclustersstep when a site setsuse_traefik_forward_auth: true, so on workloads without forward-auth the ingress referenced a non-existent middleware and Traefik invalidated the router.The annotation is now gated on the
mainsite's opt-in. When forward-auth is not enabled, Grafana routes straight through to its local-account login.Root cause
Regression from the eks/cluster Python→Go migration (commit
ae26379), which folded the previously-unconditional globaltraefik-forward-authmiddleware into per-site, flag-gated logic — but the Grafana ingress kept stamping the annotation unconditionally. It surfaced onacademy01-production(the only workload reaching Grafana via the publicgrafana.*ingress; others port-forward) after its cluster-version bump re-ran the Go steps.Code Flow
The ingress-map construction in
awsHelmGrafana(lib/steps/helm_aws.go) is extracted into a pure helpergrafanaIngressValues(domain, sites). It builds the base ingress (enabled,hosts,path) and only adds theannotationskey with the two-middleware string whensites["main"]is present andSpec.UseTraefikForwardAuthis true. Production behavior is byte-for-byte identical to the prior unconditional path when the flag is set.Test plan
TestGrafanaIngressValuesinlib/steps/helm_aws_test.gocovers: flag on → annotation present and equals the exact two-middleware string; flag off → no annotation; nomainsite → no annotation; nil sites → no annotation; and basichosts/path/enabledvalues.go test ./steps/...passes.Category of change
Checklist
🤖 Generated with Claude Code