Fix GitLab Authentik SSO: restore providers list, populate real provider key

GITLAB_OMNIBUS_CONFIG (gitlab_rails['omniauth_providers'] = [...]) is
an omnibus-Docker-image-only convention. This chart's CNG webservice
image never processes it - confirmed via gitlab/charts/gitlab/
templates/_omniauth.tpl, which only reads
global.appConfig.omniauth.providers (a list of {secret,key} refs, each
pointing at a Secret key holding a whole YAML-encoded provider block
loaded via Ruby's YAML.load_file). So GITLAB_OMNIBUS_CONFIG was always
a silent no-op on both home and VPS - neither ever actually had SSO
configured despite gitlab-oidc-secret existing and looking correct.

Yesterday's fix for 'FailedMount: references non-existent secret key:
provider' removed the providers: list entirely instead of populating
that key - stopped the crash, but also silently deleted the only real
OIDC config path on both sites (no error, login page just lost its SSO
button). This restores providers: on both, and gitlab-oidc-secret's
ExternalSecret template now actually renders a provider key containing
a real YAML provider block (with the templated client_id/secret
substituted in), matching what _omniauth.tpl expects.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Scooby Husky
2026-08-20 23:14:25 -05:00
co-authored by Claude Sonnet 5
parent 59bff07a53
commit 1ab292e185
4 changed files with 90 additions and 27 deletions
@@ -2,6 +2,24 @@
# git-tracked, never rotatable, no record of what it was) - found and # git-tracked, never rotatable, no record of what it was) - found and
# fixed 2026-08-20 alongside infrastructure/authentik/gitlab-blueprint.yaml # fixed 2026-08-20 alongside infrastructure/authentik/gitlab-blueprint.yaml
# (same value, same Vault path - see that file for the full story). # (same value, same Vault path - see that file for the full story).
#
# `provider` key added 2026-08-21: found live that GITLAB_OMNIBUS_CONFIG's
# `gitlab_rails['omniauth_providers'] = [...]` (still set in this app's
# values.yaml's extraEnv, for reference/documentation only at this point)
# is an omnibus-image-only convention - the CNG webservice image this
# chart actually runs never processes it, so it was always a no-op and
# GitLab never had SSO configured despite it looking configured. The
# REAL mechanism (gitlab/charts/gitlab/templates/_omniauth.tpl in the
# chart) is global.appConfig.omniauth.providers: a list of
# {secret, key} refs, each pointing at a Secret key whose value is a
# whole YAML-encoded provider block (loaded via Ruby's YAML.load_file
# at container start, baked into gitlab.yml) - not raw client_id/secret
# strings. This is also why the `providers:` list got removed entirely
# a day earlier chasing a "FailedMount: references non-existent secret
# key: provider" error: the fix should have been to populate that key
# correctly (this), not remove the reference to it - doing so silently
# killed SSO on both home and VPS GitLab (no error, the login page just
# had no SSO button).
apiVersion: external-secrets.io/v1 apiVersion: external-secrets.io/v1
kind: ExternalSecret kind: ExternalSecret
metadata: metadata:
@@ -20,6 +38,26 @@ spec:
data: data:
GITLAB_OIDC_CLIENT_ID: "{{ .clientId }}" GITLAB_OIDC_CLIENT_ID: "{{ .clientId }}"
GITLAB_OIDC_CLIENT_SECRET: "{{ .clientSecret }}" GITLAB_OIDC_CLIENT_SECRET: "{{ .clientSecret }}"
provider: |
name: openid_connect
label: Authentik
args:
name: openid_connect
scope:
- openid
- profile
- email
response_type: code
issuer: 'https://auth.kube.huskypup.net/application/o/gitlab/'
discovery: true
client_auth_method: query
uid_field: sub
send_scope_to_token_endpoint: true
pkce: true
client_options:
identifier: '{{ .clientId }}'
secret: '{{ .clientSecret }}'
redirect_uri: 'https://gitlab.kube.huskypup.net/users/auth/openid_connect/callback'
data: data:
- secretKey: clientId - secretKey: clientId
remoteRef: remoteRef:
+15 -18
View File
@@ -90,24 +90,18 @@ global:
appConfig: appConfig:
# OmniAuth SSO Configuration # OmniAuth SSO Configuration
# #
# NOTE: no `providers:` list here (was `- secret: gitlab-oidc-secret, # CORRECTED 2026-08-21 (second time - see git history for the wrong
# key: provider`) - found live 2026-08-21 (diagnosing the VPS GitLab # 2026-08-20 fix that removed this list entirely). This IS the real,
# deployment, which shares this same values shape) that the chart # actually-processed OIDC config mechanism for the CNG webservice
# requires that secret to actually HAVE a `provider` key (a full # image (chart's gitlab.appConfig.omniauth.configuration template,
# omniauth provider config block, YAML-encoded) when this list is # infra/_omniauth.tpl) - GITLAB_OMNIBUS_CONFIG below is an
# set, and gitlab-oidc-secret never had one - it only has # omnibus-image-only convention this image never processes, so it
# GITLAB_OIDC_CLIENT_ID/SECRET, consumed via extraEnvFrom below and # was always a documentation-only no-op despite looking functional.
# gitlab.webservice.extraEnv's GITLAB_OMNIBUS_CONFIG instead, which # gitlab-oidc-secret's `provider` key now holds a full YAML-encoded
# is the ACTUAL mechanism configuring the OIDC provider (this # provider block (apps/gitlab/manifests/external-secret-oidc.yaml),
# global.appConfig.omniauth.providers list was always redundant/ # loaded via Ruby's YAML.load_file at container start - not raw
# unused for our setup). Silently didn't matter here at home because # client_id/secret strings, which is why plain GITLAB_OIDC_CLIENT_ID/
# this Deployment hasn't restarted since gitlab-oidc-secret was last # SECRET keys alone (yesterday's assumption) were never enough.
# in whatever shape included that key (if it ever did) - Kubernetes
# doesn't re-validate already-mounted volumes when a Secret's shape
# changes, only NEW pod creation does, which is exactly why the VPS
# deployment (fresh pods, same values shape) hit it immediately
# ("FailedMount: references non-existent secret key: provider") while
# this one didn't - until its next restart.
omniauth: omniauth:
enabled: true enabled: true
allowSingleSignOn: ['openid_connect'] allowSingleSignOn: ['openid_connect']
@@ -115,6 +109,9 @@ global:
autoLinkUser: ['openid_connect'] autoLinkUser: ['openid_connect']
syncProfileFromProvider: ['openid_connect'] syncProfileFromProvider: ['openid_connect']
syncProfileAttributes: ['email', 'name'] syncProfileAttributes: ['email', 'name']
providers:
- secret: gitlab-oidc-secret
key: provider
# Settings for Let's Encrypt ACME Issuer - disabled, using cluster-wide cert-manager # Settings for Let's Encrypt ACME Issuer - disabled, using cluster-wide cert-manager
certmanager-issuer: certmanager-issuer:
@@ -5,6 +5,13 @@
# (infrastructure/vps-eso/manifests/clustersecretstore.yaml's policy, # (infrastructure/vps-eso/manifests/clustersecretstore.yaml's policy,
# applied live via vault CLI, not git-tracked - matches how every other # applied live via vault CLI, not git-tracked - matches how every other
# Vault policy/auth-method in this repo is set up). # Vault policy/auth-method in this repo is set up).
#
# `provider` key added 2026-08-21: found live that GITLAB_OMNIBUS_CONFIG
# (this app's values.yaml extraEnv) is an omnibus-image-only convention
# the CNG webservice image never processes - see the matching comment
# in apps/gitlab/manifests/external-secret-oidc.yaml (home) for the
# full story. The real mechanism needs this key to hold a whole
# YAML-encoded provider block, not raw client_id/secret strings.
apiVersion: external-secrets.io/v1 apiVersion: external-secrets.io/v1
kind: ExternalSecret kind: ExternalSecret
metadata: metadata:
@@ -23,6 +30,26 @@ spec:
data: data:
GITLAB_OIDC_CLIENT_ID: "{{ .clientId }}" GITLAB_OIDC_CLIENT_ID: "{{ .clientId }}"
GITLAB_OIDC_CLIENT_SECRET: "{{ .clientSecret }}" GITLAB_OIDC_CLIENT_SECRET: "{{ .clientSecret }}"
provider: |
name: openid_connect
label: Authentik
args:
name: openid_connect
scope:
- openid
- profile
- email
response_type: code
issuer: 'https://auth.kube.huskypup.net/application/o/gitlab/'
discovery: true
client_auth_method: query
uid_field: sub
send_scope_to_token_endpoint: true
pkce: true
client_options:
identifier: '{{ .clientId }}'
secret: '{{ .clientSecret }}'
redirect_uri: 'https://gitlab.vps.huskypup.net/users/auth/openid_connect/callback'
data: data:
- secretKey: clientId - secretKey: clientId
remoteRef: remoteRef:
+10 -9
View File
@@ -64,15 +64,13 @@ global:
key: password key: password
appConfig: appConfig:
# NOTE: no `providers:` list here - found live 2026-08-21: the chart # CORRECTED 2026-08-21 (see apps/gitlab/values.yaml (home) for the
# requires gitlab-oidc-secret to have a `provider` key (full YAML # full story) - `providers:` list restored, now pointing at
# provider config) when this is set, and it never does - only # gitlab-oidc-secret's `provider` key which holds a real
# GITLAB_OIDC_CLIENT_ID/SECRET, consumed via extraEnvFrom + # YAML-encoded provider block (manifests/oidc-secret.yaml), the
# GITLAB_OMNIBUS_CONFIG below instead (the actual mechanism # actual mechanism the CNG webservice image processes.
# configuring OIDC). Caused "FailedMount: references non-existent # GITLAB_OMNIBUS_CONFIG below is an omnibus-image-only convention
# secret key: provider" blocking webservice/sidekiq/toolbox from ever # this image never reads - always a no-op here.
# starting - see the matching fix + full explanation in
# apps/gitlab/values.yaml (home).
omniauth: omniauth:
enabled: true enabled: true
allowSingleSignOn: ['openid_connect'] allowSingleSignOn: ['openid_connect']
@@ -80,6 +78,9 @@ global:
autoLinkUser: ['openid_connect'] autoLinkUser: ['openid_connect']
syncProfileFromProvider: ['openid_connect'] syncProfileFromProvider: ['openid_connect']
syncProfileAttributes: ['email', 'name'] syncProfileAttributes: ['email', 'name']
providers:
- secret: gitlab-oidc-secret
key: provider
# GitLab's pre-upgrade hook checks the deployed version against a # GitLab's pre-upgrade hook checks the deployed version against a
# previous-release ConfigMap to enforce supported upgrade paths - found # previous-release ConfigMap to enforce supported upgrade paths - found