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

Clean up temporary resources when the original PVC gets deleted #190

Merged

Conversation

dannawang0221
Copy link
Contributor

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
With the current implementation, volume populator doesn't support PVC deletion during volume population. The finalizer will block deleting. If users want to force delete their PVCs, they need to remove the finalizer and manually clean up the temporary resource created by volume populators. This is hard to maintain and might end up with resource leak if users forget to delete them.

Which issue(s) this PR fixes:

Fixes #178

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Allow users to delete their PVC during volume population and clean up temporary resources create by volume populators

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Jan 21, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 21, 2025
@dannawang0221
Copy link
Contributor Author

/assign @msau42

@dannawang0221
Copy link
Contributor Author

/assign @pwschuurman

@dannawang0221
Copy link
Contributor Author

/assign @sunnylovestiramisu

@dannawang0221
Copy link
Contributor Author

/retest

populator-machinery/controller.go Show resolved Hide resolved
populator-machinery/controller_test.go Outdated Show resolved Hide resolved
populator-machinery/controller_test.go Outdated Show resolved Hide resolved
onlyComparePVCFinalizers bool
pvcPrime *corev1.PersistentVolumeClaim
// When set to true, only compare mutate feilds
onlyComparePVCPrimeMutateFields bool

Choose a reason for hiding this comment

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

It seems like these fields are trying to exclude some comparison. I would prefer to exclude something and still use reflect.DeepEqual, rather than (I think this is something we'd need to do using cmp, rather than reflect). This would make the test more resilient.

Can you at least comment on the specific test cases what you want to ignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure,I'll add comments to explain why these flags are used. I have reflect.DeepEqual for most tests. Only for the test which the object gets updated by the volume populator I have this flag set to true because for some reason reflect.DeepEqual return false even if all the fields print out look exactly the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@sunnylovestiramisu
Copy link
Contributor

I noticed that the controller code itself historically does not have too many logs, do we think adding some logs to indicate the process can help debugging?

@dannawang0221
Copy link
Contributor Author

I noticed that the controller code itself historically does not have too many logs, do we think adding some logs to indicate the process can help debugging?

I have thought about this, but not sure what would be the best practice, is there any concern of having too many logs?

@sunnylovestiramisu
Copy link
Contributor

I noticed that the controller code itself historically does not have too many logs, do we think adding some logs to indicate the process can help debugging?

I have thought about this, but not sure what would be the best practice, is there any concern of having too many logs?

We can define a different log level for these logs. For example 4=Debug level verbosity(just an example).

@dannawang0221
Copy link
Contributor Author

I noticed that the controller code itself historically does not have too many logs, do we think adding some logs to indicate the process can help debugging?

I have thought about this, but not sure what would be the best practice, is there any concern of having too many logs?

We can define a different log level for these logs. For example 4=Debug level verbosity(just an example).

I agree we should add more logs. The current log coverage is too low, which makes it very hard to debug

@sunnylovestiramisu
Copy link
Contributor

Overall LGTM

Copy link
Contributor

@msau42 msau42 left a comment

Choose a reason for hiding this comment

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

Danna and I discussed offline. It looks like existing logic for removing the finalizer doesn't wait for the Pod and PVC' resources to be fully deleted. This may be something we still want to block PVC deletion on.

@dannawang0221
Copy link
Contributor Author

Danna and I discussed offline. It looks like existing logic for removing the finalizer doesn't wait for the Pod and PVC' resources to be fully deleted. This may be something we still want to block PVC deletion on.

Open an issue to track this #198

@msau42
Copy link
Contributor

msau42 commented Jan 23, 2025

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 23, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dannawang0221, msau42

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 23, 2025
@k8s-ci-robot k8s-ci-robot merged commit 36d36a8 into kubernetes-csi:master Jan 23, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GA Blocker] Clean up resources if the original PVC gets deleted
5 participants