Skip to content

fix: delete and re-copy secrets when reservation overrides secretSourceNamespace#571

Merged
bsquizz merged 1 commit intomainfrom
fix/overwrite-secrets-on-reservation-source-override
Apr 22, 2026
Merged

fix: delete and re-copy secrets when reservation overrides secretSourceNamespace#571
bsquizz merged 1 commit intomainfrom
fix/overwrite-secrets-on-reservation-source-override

Conversation

@bsquizz
Copy link
Copy Markdown
Contributor

@bsquizz bsquizz commented Apr 22, 2026

Summary

  • When a pool provisions a namespace, secrets are copied from the pool's defaultSecretSourceNamespace into it
  • If a NamespaceReservation then specifies the same secretSourceNamespace, CopySecretsFrom called cl.Create on each secret and failed with already exists, blocking namespace assignment indefinitely via exponential backoff
  • Confirmed on live cluster: bonfire-reservation-1b23c25a spent ~10 minutes retrying before finally assigning due to an unrelated code path, then immediately expired

Fix

Added an overwrite bool parameter to CopySecretsFrom:

  • overwrite=false (pool provisioning): if a secret already exists in the target namespace, treat it as a no-op success — the pre-provisioned copy is fine
  • overwrite=true (reservation with explicit secretSourceNamespace): delete the existing copy and re-create from the specified source — the reservation's intent overrides whatever was pre-populated

Test plan

  • make fmt vet — clean
  • make test — 93/93 tests pass (53 helper + 40 controller)
  • Root cause confirmed in operator logs on live cluster
  • JIRA: ENGPROD-9889

🤖 Generated with Claude Code

…ceNamespace

When a pool provisions a namespace it copies secrets from the pool's
defaultSecretSourceNamespace. If a NamespaceReservation then specifies
the same secretSourceNamespace, CopySecretsFrom would try to cl.Create
each secret and fail with 'already exists', blocking assignment
indefinitely.

Add an 'overwrite bool' parameter to CopySecretsFrom. When true (used
when the reservation explicitly provides a secretSourceNamespace), any
secret that already exists in the target namespace is deleted and
re-copied from the source so the reservation's intent is honoured.
When false (pool provisioning), an already-existing secret is treated
as a no-op success.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bsquizz bsquizz merged commit 4ce2525 into main Apr 22, 2026
5 of 6 checks passed
@bsquizz bsquizz deleted the fix/overwrite-secrets-on-reservation-source-override branch April 22, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant