Skip to content

add cluster field for PVCs #2785

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

Merged
merged 7 commits into from
Oct 31, 2024
Merged

add cluster field for PVCs #2785

merged 7 commits into from
Oct 31, 2024

Conversation

FxKu
Copy link
Member

@FxKu FxKu commented Oct 18, 2024

PVCs are the only resource which is not covered by OwnerReferences. We have observed that on cluster deletion operator can report that all PVCs have already been deleted, although they still exist. We believe that there might be a race condition with cluster fields such as Name and Namespace getting unset after cascaded deletion via OwnerReferences resulting in an empty list when fetching PVCs to delete (labelSet function using c.Name for filtering). PVC management by StatefulSet is set to Retain in our case.

This PR present an idea which we use for other resources as well: Storing resource information in a cluster field and loop over this map on deletion. However, unlike resources like Secrets and Services, PVCs are created by K8s via StatefulSet template. So we rely on a syncVolumeClaims call to have the PVCs info stored in the cluster struct. If this sync does not happen for some reason, the PVCs will not get deleted. I don't think an extra call of listPersisntentVolumeClaims is needed as c.Name would mostly likely be empty as well in this scenario.

I found that syncVolumes is not called in Create() event. Adding it there would greatly reduce the chance that PVCs are not synced before a potential deletion.

@FxKu FxKu added the minor label Oct 18, 2024
@FxKu FxKu added this to the 1.14.0 milestone Oct 18, 2024
@hughcapet
Copy link
Member

👍

1 similar comment
@FxKu
Copy link
Member Author

FxKu commented Oct 31, 2024

👍

@FxKu FxKu merged commit 8231797 into master Oct 31, 2024
10 checks passed
@FxKu FxKu deleted the pvc-sync branch October 31, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants