Skip to content

Add transport URL secret rotation with consumer finalizer - #663

Open
lmiccini wants to merge 1 commit into
openstack-k8s-operators:mainfrom
lmiccini:finalize-secret-rotation
Open

Add transport URL secret rotation with consumer finalizer#663
lmiccini wants to merge 1 commit into
openstack-k8s-operators:mainfrom
lmiccini:finalize-secret-rotation

Conversation

@lmiccini

@lmiccini lmiccini commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What this does

When infra-operator rotates a RabbitMQ transport URL (creating a new secret and user), consumer operators must hold a consumer finalizer on the old secret until all their pods have rolled out with the new credentials. Without this, infra-operator cleans up the old RabbitMQ user while pods are still connected with the old credentials, causing message-bus outages.

Approach (updated)

Note: this PR was reworked from the original grace-period design to an event-driven "applied input hash" design. The old approach released the finalizer after a fixed grace period based on the parent Ready condition, which was racy against the informer cache and could revoke credentials prematurely. The new approach releases the finalizer only once every child has provably rolled out.

  1. Add a consumer finalizer to the current transport URL secret early in reconcile. Status.TransportURLSecret is set for first-time setup only (empty or unchanged); during rotation the status is updated solely by FinalizeSecretRotation at the end of reconcile.

  2. Pass transportURL.Status.SecretName directly to sub-CR creation and config generation as a parameter — never read Status.TransportURLSecret for sub-CR specs.

  3. Each child controller records an AppliedInputSecretHash in its status, set only after statefulset.IsReadyForInput / deployment.IsReadyForInput confirms — via an uncached API read — that the workload is fully rolled out with the expected CONFIG_HASH.

  4. The parent mirrors a child's Ready condition only when its Generation == ObservedGeneration and AppliedInputSecretHash matches the current input hash; otherwise it sets the condition to Unknown.

  5. Guard: FinalizeSecretRotation removes the consumer finalizer from the old secret only when every child reports the expected hash and is ready. The guard is computed from Conditions.AllSubConditionIsTrue() (not IsReady()), because Conditions.Init() resets the Ready condition to Unknown on every reconcile.

The same pattern applies to notification transport URL secrets and application-credential secrets where applicable.

Dependency

Depends on the lib-common IsReadyForInput / FinalizeSecretRotation helpers (currently pinned via a replace to the fork commit while the lib-common PR is in review).

@openshift-ci
openshift-ci Bot requested review from abays and stuggi June 23, 2026 10:53
@openshift-ci

openshift-ci Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lmiccini
Once this PR has been reviewed and has the lgtm label, please assign abays for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from 5897bda to 4f0979f Compare June 24, 2026 12:09
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/59a2745820f04da09ce53e84225a8c6b

openstack-k8s-operators-content-provider FAILURE in 7m 40s
⚠️ cinder-operator-kuttl SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cinder-operator-tempest SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch 2 times, most recently from 2f9c5d8 to fd6bdd2 Compare June 24, 2026 13:31
@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from fd6bdd2 to c6b858e Compare July 31, 2026 06:05
@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from c6b858e to 609339d Compare August 10, 2026 14:18
@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from 609339d to 6e1a86c Compare August 13, 2026 09:39
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/4de66b3aefa24ab79570c65fe13f4160

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 30m 15s
✔️ cinder-operator-kuttl SUCCESS in 45m 46s
cinder-operator-tempest FAILURE in 1h 52m 07s

@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from 6e1a86c to 0fbe4de Compare August 17, 2026 08:41
@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch 2 times, most recently from 33a7c91 to 8447add Compare August 18, 2026 10:25
@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from 8447add to 0d32b0f Compare August 20, 2026 11:02
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c1c63a8-05a5-47db-857d-f191e7115084


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/4469e6b516c04670b4eabc34f30b6639

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 18m 20s
✔️ cinder-operator-kuttl SUCCESS in 54m 15s
cinder-operator-tempest FAILURE in 1h 53m 08s

@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from 0d32b0f to 5dbd8e1 Compare August 24, 2026 16:48
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/8b8c7da75390482787882f74dbf5c595

openstack-k8s-operators-content-provider FAILURE in 6m 49s
⚠️ cinder-operator-kuttl SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cinder-operator-tempest SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from 5dbd8e1 to b87fbeb Compare August 24, 2026 18:16
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/29334d3723674afc90c5cf74cc4d91c2

openstack-k8s-operators-content-provider FAILURE in 14m 35s
⚠️ cinder-operator-kuttl SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider
⚠️ cinder-operator-tempest SKIPPED Skipped due to failed job openstack-k8s-operators-content-provider

@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from b87fbeb to d5dd959 Compare August 25, 2026 06:23
@lmiccini
lmiccini force-pushed the finalize-secret-rotation branch from d5dd959 to ab9e859 Compare August 25, 2026 06:30
When infra-operator rotates a RabbitMQ transport URL (creating a new
secret and user), consumer operators must hold a consumer finalizer on
the old secret until all their pods have rolled out with the new
credentials. Without this, infra-operator cleans up the old RabbitMQ
user while pods are still connected with old credentials, causing
message bus outages.

Design:

1. Add a consumer finalizer to the current transport URL secret early
   in reconcile. Set instance.Status.TransportURLSecret for first-time
   setup only (empty or unchanged); during rotation the status is
   updated solely by FinalizeSecretRotation at the end of reconcile.

2. Pass transportURL.Status.SecretName directly to sub-CR creation
   functions and config generation as a parameter — never read from
   instance.Status.TransportURLSecret for sub-CR specs.

3. Each child (sub-CR) controller records an AppliedInputSecretHash in
   its status, set only after statefulset.IsReadyForInput /
   deployment.IsReadyForInput confirms — via an uncached API read —
   that the workload is fully rolled out with the expected CONFIG_HASH.

4. The parent mirrors a child's Ready condition only when its
   Generation == ObservedGeneration and AppliedInputSecretHash matches
   the current input hash; otherwise it sets the condition to Unknown.

5. Guard: FinalizeSecretRotation removes the consumer finalizer from
   the old secret only when every child reports the expected hash and
   is ready.

The same pattern applies to notification transport URL secrets and
application credential secrets where applicable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@centosinfra-prod-github-app

Copy link
Copy Markdown

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://gateway-cloud-softwarefactory.apps.ocp.cloud.ci.centos.org/zuul/t/rdoproject.org/buildset/edfa04cc03f244a081d28288468b9872

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 13m 38s
✔️ cinder-operator-kuttl SUCCESS in 43m 38s
cinder-operator-tempest FAILURE in 1h 42m 27s

@openshift-ci

openshift-ci Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant