-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Support collection deletion in apiserver. #18290
Conversation
@smarterclayton @derekwaynecarr - can you please take a first look? If you're fine with the approach, I will extend test, etc. |
Labelling this PR as size/L |
GCE e2e test build/test passed for commit 2cb31c4a80b0ef08ac4ba19f3b6172fc69df9404. |
if admit != nil && admit.Handles(admission.Delete) { | ||
userInfo, _ := api.UserFrom(ctx) | ||
|
||
err = admit.Admit(admission.NewAttributesRecord(nil, scope.Kind.Kind, namespace, "", scope.Resource.Resource, scope.Subresource, admission.Delete, userInfo)) |
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 am wondering if admission control should make it clearer when you are doing a delete over an entire collection rather than just DELETE + kind + (optional namespace). It's probably fine as is, but will mull on it some.
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'm far from being an expert in admission. I did something that was the easiest to do, but if you think we should do something different, I'm happy to change it.
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 would require (for instance) admission controllers that track resource cluster usage to also track bulk deletion and implement the same logic that the list call does. Generally we want admission controllers to operate on concrete objects. At a minimum the list Options have to be passed in.
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.
@smarterclayton - not sure if I understood. Why do you want to pass ListOptions? Do you want to have it based on selectors?
Does it have to be part of this PR (I have almost zero knowledge about admission control).
I am fine with the approach. |
@derekwaynecarr - thanks! I will cleanup this PR, add some tests, etc. and will let you know (probably tomorrow). |
@@ -125,6 +125,13 @@ func (w GracefulDeleteAdapter) Delete(ctx api.Context, name string, options *api | |||
return w.Deleter.Delete(ctx, name) | |||
} | |||
|
|||
// CollectionDeleter is an object that can delete a collection | |||
// of RESTful resources. | |||
type CollectionDeleter interface { |
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.
could we mark as TODO for future cleanup.
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.
Sorry - I don't understand this comment. What you would like to cleanup with it?
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.
Aren't we planning on changing this post etcd3?
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 don't think so. I think the interface should remain as it is here.
What we would like to cleanup is the implementation of DeleteCollection in pkg/registry - but there is already a TODO there.
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.
sgtm
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.
Will review first thing tomorrow morning.
On Tuesday, December 8, 2015, Timothy St. Clair notifications@github.com
wrote:
In pkg/api/rest/rest.go
#18290 (comment)
:@@ -125,6 +125,13 @@ func (w GracefulDeleteAdapter) Delete(ctx api.Context, name string, options *api
return w.Deleter.Delete(ctx, name)
}+// CollectionDeleter is an object that can delete a collection
+// of RESTful resources.
+type CollectionDeleter interface {sgtm
—
Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/18290/files#r46977051.
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.
@derekwaynecarr - great thanks!
e643cb3
to
ab75098
Compare
GCE e2e build/test failed for commit e643cb3452a884b70e676257dea136e0889e1d1d. |
GCE e2e build/test failed for commit ab750984381e741fe5d09771fa12552b19f16c04. |
ab75098
to
576c579
Compare
Labelling this PR as size/XXL |
GCE e2e build/test failed for commit 576c57997b0638e522b1011308becc44e4675911. |
@derekwaynecarr @smarterclayton - I cleaned up this PR and it is ready for review PTAL |
576c579
to
831c887
Compare
@wojtek-t - so you are only looking to make the namespace controller use this for Events in this PR? want to make sure I get the initial scope, or if you plan to extend this for other resource types? |
@deads2k - just a heads up, but this PR would allow for |
831c887
to
f28bb68
Compare
@derekwaynecarr - thanks a lot for looking into this PR
Yes - in this PR I'm targeting to change only Events client. This is because @caesarxuchao is working on auto-generating the whole client code, so we will get all other resources for free. (I think other resources are not that urgent - if you think they are, I'm happy to add them, but i would prefer doing it in a separate PR). I applied all comments - PTAL |
GCE e2e test build/test passed for commit f28bb68. |
It's fine for policy, but will it affect things that are watching for deletion event? I seem to recall that etcd didn't send deletion events for individual items removed. Sorry to be lazy; I'd dig through the pull, but its a little large. |
@deads2k This problem is solved - watches work fine with it. |
@derekwaynecarr - PTAL |
@derekwaynecarr - thanks a lot for review! |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit f28bb68. |
@k8s-bot unit test this please |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit f28bb68. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test failed for commit f28bb68. |
@k8s-bot e2e test this please |
GCE e2e test build/test passed for commit f28bb68. |
Support collection deletion in apiserver.
Ref #10217 |
Automatic merge from submit-queue (batch tested with PRs 18390, 18389, 18290, 18377, 18385). UPSTREAM: 56288: Add list of pods that use a volume to multiattach events Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1511097 /assign @gnufied @rootfs Origin-commit: 84cbae163e58ec7dcef6569e89898c6ad8a207e6
What does it give us:
@derekwaynecarr @smarterclayton @lavalamp @gmarek
Ref #7372