Open JackCheng01 opened 2 months ago
We are seeing a similar behaviour with the following VaultStaticSecret when the referenced secret in vault has no keys (empty value {}
).
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
creationTimestamp: '2024-09-20T11:48:27Z'
finalizers:
- vaultstaticsecret.secrets.hashicorp.com/finalizer
generation: 1
spec:
destination:
create: true
name: api.secrets
overwrite: false
transformation:
excludeRaw: true
hmacSecretData: true
mount: development
path: my-secret
rolloutRestartTargets:
- kind: Deployment
name: api
type: kv-v2
vaultAuthRef: api
Events:
LAST SEEN TYPE REASON OBJECT MESSAGE
37m (x966 over 14h) Normal RolloutRestartTriggered VaultStaticSecret/api.secrets Rollout restart triggered for {Deployment api}
29m (x6 over 33m) Normal RolloutRestartTriggered VaultStaticSecret/api.secrets Rollout restart triggered for {Deployment api}
29m (x6 over 33m) Normal SecretRotated VaultStaticSecret/api.secrets Secret synced
A rollout restart is being triggered every 1 min or so, you can see in the first event it was triggered 966 times during a 14h period.
Deleting the secret my-secret
or setting a dummy key (e.g. FOO=bar
) does prevent the restarts.
Kubernetes version: v1.28.12-eks-a18cd3a VSO version (helm chart): we have seen this issue in v0.7.1 and v0.8.1
Describe the bug VSO constantly rotates secret when VaultStaticSecret template text is empty string , and triggers rollout restart for target resource.
To Reproduce Steps to reproduce the behavior:
create VaultStaticSecret having empty text in templates e.g.
Monitor events for created VaultStaticSecret
Expected behavior
VSO should not rotate secret for VaultStaticSecret when there's no solid change.
Environment