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 specifying PVC retention policy for auto deletion #2343

Merged
merged 8 commits into from
Sep 8, 2023

Conversation

idanovinda
Copy link
Member

Problem

Users can specify the number of instances in the manifest, both scaling up and scaling down. It creates the PVCs when there is a scaling up event. However, where there is a scaling down event, the control plane doesn't automatically delete the PVCs created for StatefulSets that are no longer needed. It requires manual checking and deletion to clean up the unused PVCs. As a result, unused PVCs continue to occupy storage resources, leading to potential inefficiencies and unnecessary costs.

Solution

In Kubernetes v1.23, a new feature has been introduced to address the issue of unused PVCs (see docs). The operator should set the retention policy in the Statefulsets of every clusters.

To specify the auto-deletion policy in the configmap, we can set:

persistent_volume_claim_retention_policy: "when_deleted:delete,when_scaled:delete"

while in the CRD configuration:

persistent_volume_claim_retention_policy: 
  when_deleted: "delete"
  when_scaled: "delete"

The default values are "retain" for "when_deleted" and "when_scaled".

@FxKu
Copy link
Member

FxKu commented Jun 22, 2023

As we've already discussed in person, you could try to extend the scaling e2e test with checks if PVCs get removed or not

@SanjeevChoubey
Copy link

@idanovinda @FxKu this feature needed for us too , when we can expect this to be merged?

@SanjeevChoubey
Copy link

SanjeevChoubey commented Jul 17, 2023

@idanovinda @FxKu this feature needed for us too , when we can expect this to be merged?

Can I pitch in and get this done, as we need this feature ASAP.

@FxKu FxKu added this to the 2.0 milestone Aug 1, 2023
e2e/tests/test_e2e.py Outdated Show resolved Hide resolved
e2e/tests/test_e2e.py Outdated Show resolved Hide resolved
@FxKu
Copy link
Member

FxKu commented Sep 8, 2023

👍

1 similar comment
@idanovinda
Copy link
Member Author

👍

@FxKu FxKu merged commit 36389b2 into master Sep 8, 2023
4 of 7 checks passed
@FxKu FxKu deleted the pvc-retention-policy branch September 8, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants