Authservice chain clobbering
Bug
Description
With monitoring.sso.enabled (or addons.thanos.sso.enabled) on, the umbrella always injects its own prometheus, alertmanager, and thanos chains into the authservice values, even if the user already defined a chain by that name under addons.authservice.chains. Both land in the same chains: map in chart/templates/authservice/values.yaml: the user's chain first, the auto-inject right after, no collision check. When values-secret runs fromYaml on it, the duplicate keys collapse last-write-wins. The auto-inject is last, so it wins. No warning, no error. The user's chain is silently gone.
I noticed this while pointing a monitoring chain at Okta rather than Keycloak. For these three reserved names there is no supported way to do it: the auto-inject overwrites what you set, and it is pinned to the global sso.oidc.*. monitoring.sso.* only exposes client_id and client_secret, not the IdP endpoints.
Disabling the auto-inject is not a usable opt-out. monitoring.sso.enabled: false does stop it, but it also removes the authservice-waypoint ingress allowance, the use-waypoint service annotations, and the protect: keycloak pod label that drives the NetworkPolicies and AuthorizationPolicies, so the SSO enforcement for those pods goes away with it. There is no per-chain opt-out.
Where it happens
chart/templates/authservice/values.yaml. In 3.26.0 and 3.27.0:
chains:map opens at line 213; user-defined chains render at 214-216.- thanos auto-inject at 218-237, guarded only on
addons.thanos.enabledandaddons.thanos.sso.enabled. - prometheus and alertmanager auto-inject at 239-276, guarded only on
monitoring.enabledandmonitoring.sso.enabled.
Steps to reproduce
- Set
monitoring.enabled: trueandmonitoring.sso.enabled: true. - Define a chain under
addons.authservice.chainsthat reuses a reserved name with a non-default config:
addons:
authservice:
chains:
prometheus:
match:
header: ":authority"
prefix: prometheus.example.com
callback_uri: https://prometheus.example.com/login/generic_oauth
authorization_uri: https://my-idp.example.com/oauth2/v1/authorize
token_uri: https://my-idp.example.com/oauth2/v1/token
jwks_uri: https://my-idp.example.com/oauth2/v1/keys
client_id: my-prometheus
client_secret: my-secret- Render the umbrella and inspect the generated
Secret/bigbang-authservice-values(orhelm template bigbang chart -f values.yaml --show-only templates/authservice/values.yaml). - The rendered prometheus chain is the auto-inject, sourced from
monitoring.sso.prometheus.*and the globalsso.oidc.*, not the values fromaddons.authservice.chains:
prometheus:
authorization_uri: https://login.dso.mil/auth/realms/baby-yoda/protocol/openid-connect/auth # global sso.oidc.*
client_id: null # monitoring.sso.prometheus.client_id, unsetThe my-idp.example.com / my-prometheus values are gone. The two colliding prometheus: keys exist only in the raw bigbang.defaults.authservice template output, before the values-secret helper runs fromYaml; in the final Secret only the auto-inject survives, so grepping the rendered Secret for a duplicate key shows nothing.
Same behavior for alertmanager (driven by monitoring.sso.alertmanager.*) and thanos (driven by addons.thanos.sso.*).
Expected vs actual
- Expected: a user-supplied
addons.authservice.chains.<name>takes precedence, consistent with how Helm values are expected to override chart defaults. - Actual: the auto-injected chain silently overrides it. The authoritative source for those three chain names is whatever the umbrella always emits, which is invisible from the values reference and undocumented.
Proposed fix
Guard each auto-inject block with a hasKey check so an explicit user-defined chain wins:
{{- if and .Values.monitoring.enabled .Values.monitoring.sso.enabled (not (hasKey (.Values.addons.authservice.chains | default dict) "prometheus")) }}
prometheus:
...
{{- end }}Same shape for alertmanager and thanos. prometheus and alertmanager currently share a single guard, so that block needs to be split or given an inner hasKey check. Because the guard keys off the chain definition rather than sso.enabled, a user keeps monitoring.sso.enabled: true and the waypoint and protect plumbing stays intact. Users happy with the auto-inject default see no change, and there is no values schema change.
BigBang Version
3.26.0 also present on 3.27.0