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

Enable StatefulSetAutoDeletePVC feature for alertmanager, compactor, ingester & store-gateway StatefulSets #6106

Conversation

ivanfavi
Copy link
Contributor

@ivanfavi ivanfavi commented Sep 22, 2023

What this PR does

I followed a similar implementation for loki-distributed https://github.com/grafana/helm-charts/pull/2649/files to enable PersistentVolumeClaim retention policy.

Which issue(s) this PR fixes or relates to

What is missing?
An ability to choose whether k8s deletes or retains PVCs in tandem with the lifecycle of a StatefulSet, due to the new beta field spec.persistentVolumeClaimRetentionPolicy in the latest version of Kubernetes. There is no way to configure the StatefulSet of Prometheus in kube-prometheus.

Why do we need it?
Because the new field defaults to Retain, PVCs remain bound to their PVs during cluster deletion while StatefulSets are being removed. This provides surface for a CSI Driver to see a stale, but intact PVC from a pod who no longer is requesting resources during cluster deletion. The CSI Driver then lacks the ability to manage(delete) unbound, available Volumes that otherwise would have been destroyed, resulting in orphaned resources.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@ivanfavi ivanfavi requested a review from a team as a code owner September 22, 2023 14:02
@CLAassistant
Copy link

CLAassistant commented Sep 22, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! You might have to run make build-helm-tests and commit and push the changes you get locally to get the CI passing.

There are three other statefulSets in the chart with persistent volumes - store-gateway, compactor, and alertmanager. It would be greatly appreciated if you have the time to carry out the changes in those too. If not, that's ok too, I can do it in a follow-up PR as well. Thanks again!

@ivanfavi ivanfavi force-pushed the enable-enableStatefulSetAutoDeletePVC-ingester-mimir-distributed branch from 9874e69 to 58f33d9 Compare November 8, 2023 10:49
@ivanfavi ivanfavi force-pushed the enable-enableStatefulSetAutoDeletePVC-ingester-mimir-distributed branch from 58f33d9 to a8e685e Compare November 8, 2023 10:56
Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, i have one more question

@ivanfavi ivanfavi changed the title Enable StatefulSetAutoDeletePVC feature for ingester Enable StatefulSetAutoDeletePVC feature for alertmanager, compactor, ingester & store-gateway Nov 15, 2023
@ivanfavi ivanfavi changed the title Enable StatefulSetAutoDeletePVC feature for alertmanager, compactor, ingester & store-gateway Enable StatefulSetAutoDeletePVC feature for alertmanager, compactor, ingester & store-gateway StatefulSets Nov 15, 2023
@ivanfavi ivanfavi force-pushed the enable-enableStatefulSetAutoDeletePVC-ingester-mimir-distributed branch from bb5c5cd to ede4667 Compare November 15, 2023 17:20
@ivanfavi ivanfavi force-pushed the enable-enableStatefulSetAutoDeletePVC-ingester-mimir-distributed branch from ede4667 to 55b49d8 Compare November 15, 2023 17:22
@ivanfavi ivanfavi force-pushed the enable-enableStatefulSetAutoDeletePVC-ingester-mimir-distributed branch from 55b49d8 to d004fff Compare November 15, 2023 17:22
@ivanfavi
Copy link
Contributor Author

@dimitarvdimitrov could you add a review when you have time, please? 😀

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left some suggestions wrt how this flag is called. I think enableStatefulSetAutoDeletePVC may be slightly confusing. Let me know what you think. Also can you add a line to the helm CHANGELOG.md to mention this new feature.

ivanfavi and others added 6 commits November 21, 2023 09:43
…ay/store-gateway-statefulset.yaml

Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
…ompactor-statefulset.yaml

Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
ivanfavi and others added 5 commits November 21, 2023 09:45
…gester-statefulset.yaml

Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
…ay/store-gateway-statefulset.yaml

Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
…r/alertmanager-statefulset.yaml

Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
@ivanfavi
Copy link
Contributor Author

@dimitarvdimitrov I'm glad with the revisions that are being made. I've updated the Changelog too. Let me know if there is anything else to update.

@ivanfavi
Copy link
Contributor Author

Let me know if I missed anything to pass the required checks 🤖

Copy link
Contributor

@dimitarvdimitrov dimitarvdimitrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the contribution!!

@dimitarvdimitrov dimitarvdimitrov merged commit 5a876ee into grafana:main Nov 28, 2023
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants