hashicorp / vault-helm

Helm chart to install Vault and other associated components.
Mozilla Public License 2.0
1.05k stars 868 forks source link

Support StatefulSet PVC retention feature #964

Closed alemuro closed 7 months ago

alemuro commented 8 months ago

Feature Description

Kubernetes released a feature for automatically purging PVCs when the StatefulSet controller removes one of the pods.

This issue is for asking to expose this configuration in the Helm chart so we can parametrise it and set the proper value depending on the environment.

https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention

According to the documentation what we need is to add the following lines to the StatefulSet, and to parametrise it with Helm chart variables:

apiVersion: apps/v1
kind: StatefulSet
...
spec:
  persistentVolumeClaimRetentionPolicy:
    whenDeleted: Retain
    whenScaled: Retain
...

Use Case(s)

This is useful when testing the chart, as in those cases we want to create it/remove it, but the PVCs are not removed. This feature would allow us to remove PVCs on test environments but to retain them on production.

alemuro commented 8 months ago

I will try to implement it!