Describe the bug
After a power outage and network disruption, the Kubernetes cluster was restarted. Subsequently, the multi-replica Vault Server Operator (VSO) failed to elect a new leader. The leader pod runtimePodUID remained unchanged, and the lease was still within the renewal window. However, the VaultDynamicSecret unexpectedly updated the secret upon restart. For single-replica VSOs, the expiration of the renewal window is unavoidable after a restart.
To Reproduce
Steps to reproduce the behavior:
Configure Vault Secrets engine and Approle authorization,
Additional context
VSO VaultDynamicSecret Events :
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SecretLeaseRenewal 5m27s VaultDynamicSecret Not in renewal window after transitioning to a new leader/pod, lease_id=db/creds/create-user-role/btDm36YIHUIHICvJvOpgkyaq, horizon=1m26.710550449s
Normal SecretLeaseRenewal 4m3s VaultDynamicSecret Not in renewal window after transitioning to a new leader/pod, lease_id=db/creds/create-user-role/btDm36YIHUIHICvJvOpgkyaq, horizon=3.208340562s
Normal SecretLeaseRenewal 4m VaultDynamicSecret Lease renewal duration was truncated from 1200s to 241s, requesting new credentials
Normal SecretRotated 3m59s VaultDynamicSecret Secret synced, lease_id="db/creds/create-user-role/0bsSMbGAKxpOOrZyF991D2nG", horizon=17m50.950484501s, sync_reason="SecretLeaseRenewalError"
Normal SecretLeaseRenewal 2m53s VaultDynamicSecret Not in renewal window after transitioning to a new leader/pod, lease_id=db/creds/create-user-role/0bsSMbGAKxpOOrZyF991D2nG, horizon=14m41.625011324s
Normal SecretLeaseRenewal 2m8s VaultDynamicSecret Not in renewal window after transitioning to a new leader/pod, lease_id=db/creds/create-user-role/0bsSMbGAKxpOOrZyF991D2nG, horizon=14m5.399806701s
Normal SecretLeaseRenewal 56s VaultDynamicSecret Lease renewal duration was truncated from 1200s to 1017s, requesting new credentials
Normal SecretRotated 55s VaultDynamicSecret Secret synced, lease_id="db/creds/create-user-role/ev4vMeOS42o67fZVqPqumwrz", horizon=17m7.45101962s, sync_reason="SecretLeaseRenewalError"
Describe the bug After a power outage and network disruption, the Kubernetes cluster was restarted. Subsequently, the multi-replica Vault Server Operator (VSO) failed to elect a new leader. The leader pod runtimePodUID remained unchanged, and the lease was still within the renewal window. However, the VaultDynamicSecret unexpectedly updated the secret upon restart. For single-replica VSOs, the expiration of the renewal window is unavoidable after a restart.
To Reproduce Steps to reproduce the behavior:
3.Create VaultAuth in my-app Application namespace
Expected behavior VSO controller restart should not trigger a rollout restart of all applications that use VaultDynamicSecret
Environment
Additional context VSO VaultDynamicSecret Events :
The restrictions in the code are as follows https://github.com/hashicorp/vault-secrets-operator/blob/7d4dda4a2634f9194cf592c8e097b5f6a3242196/controllers/vaultdynamicsecret_controller.go#L180-L213