-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[TEP-0135] Purge finalizer and delete PVC #6940
[TEP-0135] Purge finalizer and delete PVC #6940
Conversation
/kind feature |
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
My understanding is that the finalizer prevents PVCs from being deleted when the underlying PVs still exist (not when they are still bound to a pod). If we remove the finalizer and delete the PVC, won't there still be a PV taking up storage space? Can we delete the PV as well? |
@lbernick Kubernetes puts the finalizer on PVCs when there is a pod referencing it (including finished pods) to prevent deletion. Previous to this feature you could delete PVCs that were currently in use by a pod! A number of projects that manage pods themselves remove this finalizer, as they "know" the PVC is no longer needed. Deleting a PVC with the finalizer removed will cause the underlying PV to be deleted as normal. The finalizer is also used on a PV to prevent them from being deleted if there is an associated PVC using it, but this PR isn't touching that. https://kubernetes.io/docs/concepts/storage/persistent-volumes/#storage-object-in-use-protection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the explanation @jimmyjones2! Quan, can you double check that PVs are deleted with this PR when the PVCs are deleted?
Thanks for the explanation @jimmyjones2! @lbernick , yes I doubled checked that the PV and PVCs are deleted when the PR is completed: k get pr -w
NAME SUCCEEDED REASON STARTTIME COMPLETIONTIME
demo-pipeline-run-template-only-kqntk Unknown Running 38s
demo-pipeline-run-template-only-kqntk True Succeeded 54s 0s
k get pvc
No resources found in default namespace.
k get pv
No resources found |
56ebb88
to
100d575
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lbernick 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 |
Part of [tektoncd#6740][tektoncd#6740], developed based on Priti's [prototype][prototype] and partially completes the PVC deletion behavior [discussion][discussion]. Prior to this commit, the `PVCs` created from `PipelineRun's` `VolumeClaimTemplate` are not auto deleted when the owning `PipelineRun` is completed. This commit updates the `cleanupAffinityAssistantsAndPVCs` function to remove the `kubernetes.io/pvc-protection` finalizer protection (so that the pvc is allowed to be deleted while the pod consuming it is not deleted). The function then explicitly delete such `PVC` when cleaning up the `Affinity Assistants` at pr completion time. This change is NOT applied to `coschedule: workspaces` mode as there is backward compatability concern. See more details in this [discussion][discussion] [tektoncd#6740]: tektoncd#6740 [prototype]: tektoncd#6635 [discussion]: tektoncd#6741 (comment)
100d575
to
deb51df
Compare
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-alpha-integration-tests due to timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Changes
Part of #6740 and partially completes the PVC deletion behavior discussion.
Prior to this commit, the
PVCs
created fromPipelineRun's
VolumeClaimTemplate
are not auto deleted when the owningPipelineRun
is completed.This commit updates the
cleanupAffinityAssistantsAndPVCs
function to remove thekubernetes.io/pvc-protection
finalizer protection (so that the pvc is allowed to be deleted while the pod consuming it is not deleted). The function then explicitly delete suchPVCs
when cleaning up theAffinity Assistants
at thePipelineRun
completion time.This change is NOT applied to
coschedule: workspaces
mode as there is backward compatability concern. See more details in this discussionSubmitter Checklist
As the author of this PR, please check off the items in this checklist:
/kind <type>
. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tepRelease Notes