-
Notifications
You must be signed in to change notification settings - Fork 317
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
Added controller for PVC deletion #422
Added controller for PVC deletion #422
Conversation
Welcome @Danil-Grigorev! |
Hi @Danil-Grigorev. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
4b1dbb9
to
9dda579
Compare
564c967
to
5b36954
Compare
pkg/controller/clone_controller.go
Outdated
"sigs.k8s.io/sig-storage-lib-external-provisioner/controller" | ||
) | ||
|
||
// CloningProtectionController struct |
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.
Please add a comment what the controller does - it prevents a PVC from being deleted while it's cloned.
run := func(context.Context) { | ||
stopCh := context.Background().Done() |
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.
Why did you remove stopCh
?
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.
Accidentally left this change after seeing issues with a similar approach in tests, will undo this.
pvcPhase( | ||
pvcDataSourceClone( | ||
pvcNamed(baseClaim(), dstName), | ||
srcName, | ||
), | ||
v1.ClaimPending)}, |
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.
It would be more readable if you put claim
as the last argument - function name + its arguments would be on the same line:
pvcPhase(v1.ClaimPending,
pvcDataSourceClone(srcName,
pvcNamed(dstName, baseClaim())
pkg/controller/controller.go
Outdated
@@ -134,6 +134,8 @@ const ( | |||
annStorageProvisioner = "volume.beta.kubernetes.io/storage-provisioner" | |||
|
|||
snapshotNotBound = "snapshot %s not bound" | |||
|
|||
pvcCloneFinalizer = "external-provisioner.clone.kubernetes.io/finalizer" |
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.
provisioner.storage.kubernetes.io/cloning-protection
- Finalizer rename: 'external-provisioner.clone.kubernetes.io/finalizer' -> 'provisioner.storage.kubernetes.io/cloning-protection'
Good work and thanks a lot! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Danil-Grigorev, jsafrane 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 |
} | ||
p.claimInformer.AddEventHandlerWithResyncPeriod(claimHandler, controller.DefaultResyncPeriod) | ||
|
||
for i := 0; i < threadiness; i++ { |
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.
This is going to double the number of goroutines, and default value of worker-threads is 100 (so 200) total. Do we really need that many threads to process this finalizer? @jsafrane
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.
hm, maybe not...
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.
I'll address this in a follow up PR. Sorry for the issue. Could 5 be sufficient @msau42?
…go_modules/github.com/golang/protobuf-1.5.3 Bump github.com/golang/protobuf from 1.5.2 to 1.5.3
/kind feature
What this PR does / why we need it:
This PR addresses an attempt to split PVC handling between
external-provisioner
andsig-storage-lib-external-provisioner
, also introducing a way to handle finalizers, related to in-progress PVC cloning.PVC referenced in a data source is now updated with finalizer
provisioner.storage.kubernetes.io/cloning-protectionr
at the moment when aProvisionExt
method is called, used to dynamically provision a PV to which the content will be cloned at.When cloning is finished - all PVC referencing the one as
a data source goes from
Pending
toBound
state, which allows the finalizer to be removed before deletion.Which issue(s) this PR fixes:
Fixes #414
Special notes for your reviewer:
Does this PR introduce a user-facing change?: