Skip to content
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

When deleting the latest version of a kv2 secret, VSO should retrieve the previous (non-deleted) version #756

Open
ChristianCiach opened this issue May 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ChristianCiach
Copy link

ChristianCiach commented May 17, 2024

Describe the bug

I use a VaultStaticSecret to retrieve the latest version of a secret stored in Vault by omitting the version attrbute:

apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
  name: grafana-credentials
spec:
  type: kv-v2
  mount: secrets-external-services
  path: oncall/grafana-credentials
  destination:
    name: grafana-credentials
    create: true
  rolloutRestartTargets:
    - kind: Deployment
      name: grafana

If I create a new version of this secret in Vault, VSO correctly updates to the new version and restarts the grafana deployment. Great!

But when I delete the new version of the secret in Vault, VSO does not revert to the previous version. Instead, it wipes the existing data from the Kubernetes Secret and restarts the Grafana deployment, making it fail because of the now missing data.

The updated Secret after deleting the version in Vault contains only this data:

_raw: '{"data":null,"metadata":{"created_time":"2024-05-17T19:01:44.897386006Z","custom_metadata":null,"deletion_time":"2024-05-17T19:02:34.210821304Z","destroyed":false,"version":2}}'

Expected behavior

I would expect VSO to revert to the latest non-deleted version of the vault secret.

Environment

  • Kubernetes version:
    • Distribution or cloud vendor (OpenShift, EKS, GKE, AKS, etc.): K3s v1.29.3+k3s1
  • vault-secrets-operator version: v0.6.0

Additional context

It is debatable if this is even a bug. This seems to be the default behavior of the Vault API when omitting the version parameter. See https://discuss.hashicorp.com/t/kv-v2-destroyed-secret-version-still-marked-as-current/9780

But I still think VSO should handle this better.

@ChristianCiach ChristianCiach added the bug Something isn't working label May 17, 2024
@benashz benashz added enhancement New feature or request and removed enhancement New feature or request labels Jul 12, 2024
@nevo11
Copy link

nevo11 commented Jul 30, 2024

Hi what happened with that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants