Skip to content

Fix VDS bug where 2 leases are being generated on initial deployment #1054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

Zlaticanin
Copy link
Collaborator

@Zlaticanin Zlaticanin commented Apr 22, 2025

When a VaultDynamicSecret is first created, the controller currently performs a sync even though no lease exists yet. This ends up triggering two calls to the Vault API, resulting in two different leases being issued for the same secret. This PR fixes that behavior.

We now short-circuit the initial sync if:

  • .status.lastGeneration doesn't match the current object generation (indicating the object hasn't been fully reconciled yet)
  • .status.secretLease.id is empty (no lease has been created yet)

In this case, we skip the sync logic entirely, just update the status, and wait for the next reconcile loop. This ensures only one lease is created and avoids duplicate users being provisioned by Vault

@Zlaticanin Zlaticanin requested a review from a team as a code owner April 22, 2025 20:46
@Zlaticanin Zlaticanin marked this pull request as draft April 22, 2025 21:37
@Zlaticanin Zlaticanin marked this pull request as ready for review April 23, 2025 23:51
@Zlaticanin Zlaticanin requested a review from benashz April 24, 2025 17:12
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