fix(iam): make a rotation attempt survive a failure
key-rotation-controller / image (push) Failing after 19s

Three defects, each seen in a live rotation of grafana:

  scope        the access token needs urn:zitadel:iam:org:project:id:zitadel:aud,
               otherwise the management API answers 401 Token.Invalid even though the
               assertion was accepted.
  app id       the objects carry the client id, and the secret endpoint takes the app
               resource id. They differ, so every call answered 404 Application
               doesn't exist. The correct ids are recorded per object.
  attempt time record ActiveCredentialID and LastRotation right after Prepare. Without
               it a later failure leaves LastRotation empty, the due check says rotate
               now, and each reconcile mints a new secret and restarts the consumer:
               grafana was rolled continuously and never became ready.

Also raise the consumer-ready budget to 8 minutes, because grafana needs about four,
and retry a failed attempt after 2 minutes instead of waiting a whole interval.
This commit is contained in:
2026-10-27 18:39:59 -07:00
parent 3630721366
commit e800e2cf1c
3 changed files with 31 additions and 11 deletions
@@ -21,10 +21,10 @@ spec:
provider: zitadel-oidc-client
strategy: atomic
intervalHours: 2160
suspend: true
suspend: false
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "396757801965191169"
zitadelAppID: "396757801948413953" # app resource id, not the client id 396757801965191169
secretName: grafana-oidc
secretNamespace: logging
secretKeys:
@@ -49,7 +49,7 @@ spec:
suspend: true
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "396757801210282367"
zitadelAppID: "396757801210216831" # app resource id, not the client id 396757801210282367
secretName: argocd-oidc
secretNamespace: argocd
secretKeys:
@@ -74,7 +74,7 @@ spec:
suspend: true
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "397015744010781070"
zitadelAppID: "397015743994003854" # app resource id, not the client id 397015744010781070
secretName: comfyui-oauth2-proxy
secretNamespace: comfyui
secretKeys:
@@ -99,7 +99,7 @@ spec:
suspend: true
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "396757803257036801"
zitadelAppID: "396757803240259585" # app resource id, not the client id 396757803257036801
secretName: minio-oidc
secretNamespace: minio
secretKeys:
@@ -124,7 +124,7 @@ spec:
suspend: true
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "396757803559027071"
zitadelAppID: "396757803542249855" # app resource id, not the client id 396757803559027071
secretName: paperless-oidc
secretNamespace: paperless
secretKeys:
@@ -149,7 +149,7 @@ spec:
suspend: true
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "396757802602791295"
zitadelAppID: "396757802602725759" # app resource id, not the client id 396757802602791295
secretName: immich-oidc
secretNamespace: immich
secretKeys:
@@ -174,7 +174,7 @@ spec:
suspend: true
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "396757801579315583"
zitadelAppID: "396757801562538367" # app resource id, not the client id 396757801579315583
secretName: forgejo-oidc
secretNamespace: forgejo
secretKeys:
@@ -199,7 +199,7 @@ spec:
suspend: true
target:
zitadelProjectID: "396757796898471937"
zitadelAppID: "396757800874672511"
zitadelAppID: "396757800857895295" # app resource id, not the client id 396757800874672511
secretName: api-gw-oidc
secretNamespace: api-gw
secretKeys: