feat: run Artifact Registry's IAM auth flow without edit mode
What
Runs Artifact Registry's real auth flow — a GitLab-issued JWT, IAM's relationship store, GLAZ's policy decision — with every service deployed. It previously required running GitLab in edit mode.
Three pieces make that work:
- TLS in front of IAM. Deployed Rails refuses a plaintext IAM channel, so
charts/iam-data-access-tls-proxyterminates TLS in front ofiamand both callers dial that. The leaf is a cert-managerCertificatefrom the existingcaproni-caissuer. - Feature flags in the right database. A post-install hook Job
(
charts/artifact-registry-iam-bootstrap) coversgitlabhq_production; the existing edit-mode hook still coversgitlabhq_development. - AR's IAM service token on first boot.
charts/artifact-registry-iam-tokenmirrors the GitLab-owned secret into AR's namespace, soscripts/configure-artifact-registry-iam-token.shis no longer needed.
The helpers that drive this flow are not Artifact Registry's: minting a JWT,
granting a role and creating a test user now live in scripts/lib/gitlab-rig.sh
and scripts/lib/iam-auth.sh, so the next service to join IAM names its own
audience and deployer instead of forking them. scripts/smoke-iam-auth.sh proves
the flow end to end — anonymous refused, JWT accepted, ungranted caller denied,
then granted and round-tripping an artifact — and CI runs it on a real rig as
integration artifact-registry-with-iam.
Fixes
- AR and
iamboth fetched/oauth/discovery/keys, which never holds the token'skid, so every token was rejected with a401. Now/-/cloud_connector/keys. global.appConfig.iamDataAccessServicemoved out ofvalues/gitlab.yaml, which applied it to rigs with noiamdeployed.secretEnvFrommoved to the top level, where Fairway reads it.- A namespace's
entity_idis the organization's own UUID, read from Rails. This supersedes the slug hash that landed indf67f2a: both satisfy AR's UUIDv7 check, but only the real UUID matches the organization the namespace belongs to. Anchors are immutable, so a rig seeded under the hash needsAR_ORG_ID=or a fresh namespace; the seeder now says so instead of failing with a bare409. smoke-rig.shran the bootstrap-token round-trip even on atoken_exchangerig, where it cannot authenticate. It now picks the round-trip that matches the mode.collect-rig-logs.shselectedapp.kubernetes.io/name=iam, which matches no pod, so IAM logs were never collected. It now also captures the TLS bridge and the feature-flag hook.
Scripts
| Script | Scope |
|---|---|
scripts/lib/gitlab-rig.sh |
any rig: toolbox exec, name and UUID validation |
scripts/lib/iam-auth.sh |
any IAM consumer: auth mode, JWT minting, role grants |
scripts/lib/ar-auth.sh |
AR only: its namespace anchor, namespaces API, bootstrap token |
scripts/mint-jwt.sh |
prints a token_exchange JWT; no PAT, no feature flag |
scripts/bootstrap-test-user.sh |
a plain organization member to test authorization as |
scripts/grant-ar-role.sh |
resolves an AR slug to a resource id, then grants |
scripts/seed-ar-namespace.sh |
mode-aware seeding |
Each resolves its own credential from the composed config; none needs a personal
access token. The parameters a second consumer overrides are listed in
docs/artifact-registry.md.
Design
design/iam-auth.md— the platform: diagrams, the TLS bridge, the JWKS, the shared service token, certificate constraints, invariants.design/artifact-registry-iam-auth.md— Artifact Registry as the first consumer.
docs/artifact-registry.md's "GitLab must be in edit mode" section is rewritten.
Testing
scripts/smoke-iam-auth.sh is the automated check, wired into smoke-rig.sh and
run by the new integration artifact-registry-with-iam job, which triggers only
when AR or the IAM stack changes. Locally it was run against a token_exchange
rig repeatedly, including with a never-granted user so the denial is proved rather
than assumed; it refuses to run at all if the target repository is public, since
a public repository skips the GLAZ check and would pass while proving nothing.
Also verified: scripts/check-config.sh, shellcheck and glab ci lint pass, the
charts render, and the TLS bridge was checked end to end in a scratch namespace —
cert issued by caproni-ca, Verify return code: 0 (ok) with ALPN h2, and a
gRPC client reaching Envoy.
Known issue
iam v1.40.x intermittently segfaults in cel-go's parser while serving
Read/WriteRelationships. It is a race and succeeds on retry, surfacing as
"The Artifact Registry service is unavailable."