Helm Chart: Support StatefulSet PVC retention#3102
Helm Chart: Support StatefulSet PVC retention#3102alemuro wants to merge 1 commit intohashicorp:mainfrom
Conversation
Add new variable on the Helm chart to define the PVC retention policy for the StatefulSet
231ab4e to
a210b2b
Compare
|
@alemuro Thanks for the contribution! What would be the default behavior when a |
|
Hello @david-yu !
On this implementation, the Currently, Kubernetes uses There is more information about this change on KEP-1847.
No, because the PVC is managed by the StatefulSet, and StatefulSets do not remove the PVC/PV they create (there is more information on the ADR above). There are some cases (for example for test environments) where it is not required to maintain those PVCs. We are currently removing these PVCs manually, but we would like to take benefit from this new feature (was released on 1.23) to avoid executing manual cleanup actions on the cluster.
We are currently using the latest stable version of the chart (v1.2.2) and default Consul version provided by that chart (v1.16.2). Thanks! |
|
Thanks for the contribution, @alemuro ! I've opened #3180 with your change (just updated changelog filename) to run the full CI suite and hopefully get this merged soon. I also went ahead and hand-tested the change against Helm 3.6 (our min. supported version) just to verify [nix-shell:~/workspace/consul-k8s/charts/consul]$ helm version
version.BuildInfo{Version:"v3.6.1", GitCommit:"", GitTreeState:"", GoVersion:"go1.16.5"}
[nix-shell:~/workspace/consul-k8s/charts/consul]$ helm template -s templates/server-statefulset.yaml --kube-version "1.23" --set 'server.persistentVolumeClaimRetentionPolicy.whenDeleted=Delete' . | yq -r '.spec.persistentVolumeClaimRetentionPolicy.whenDeleted'
Delete
[nix-shell:~/workspace/consul-k8s/charts/consul]$ helm template -s templates/server-statefulset.yaml --kube-version "1.23-beta" --set 'server.persistentVolumeClaimRetentionPolicy.whenDeleted=Delete' . | yq -r '.spec.persistentVolumeClaimRetentionPolicy.whenDeleted'
Delete
[nix-shell:~/workspace/consul-k8s/charts/consul]$ helm template -s templates/server-statefulset.yaml --kube-version "1.22" --set 'server.persistentVolumeClaimRetentionPolicy.whenDeleted=Delete' . | yq -r '.spec.persistentVolumeClaimRetentionPolicy.whenDeleted'
null@david-yu given this could be useful to earlier |
|
Up to 1.1.x makes sense to me. Thanks @zalimeni |
|
Thanks guys! Then I think it's worth to close this PR and follow this conversation on #3180 |
|
Thanks @alemuro you should be mentioned as a contributor on the PR we put up. I'll go ahead and close, we still need to figure out how to get acceptance tests to run on PRs from contributors but wanted to thank you for your contribution! |
Add new variable on the Helm chart to define the PVC retention policy for the StatefulSet, as requested in #3101
Changes proposed in this PR:
persistentVolumeClaimRetentionPolicyto control the PVC retention policy when the statefulset is deleted or the number of replicas is decreased.How I've tested this PR:
How I expect reviewers to test this PR:
Checklist:
closes #3101