-
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
WIP Modify REST framework to support deleting all resources in a namespace #7372
WIP Modify REST framework to support deleting all resources in a namespace #7372
Conversation
@@ -107,6 +107,13 @@ func (w GracefulDeleteAdapter) Delete(ctx api.Context, name string, options *api | |||
return w.Deleter.Delete(ctx, name) | |||
} | |||
|
|||
// An object that can delete a collection of RESTful resources in a namespace |
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.
Just say "An object can that can delete a collection of RESTful resources"
I could see this being implemented for non-namespaced resources, for example, to delete all nodes.
There was nothing immediately wrong with this, but when I went to test it on a vagrant setup, the kube-apiserver is failing to launch with the following output to log:
This does not appear related to your PR, so I need to investigate that separately before I can test why you were not getting output to Swagger as you expected. |
e685d1e
to
15e6e21
Compare
@derekwaynecarr Understood. Thanks for taking the time. |
2d2e5d6
to
7e49ed4
Compare
@derekwaynecarr I added a bit more code towards items 3 and 4. Specifically, I added a "slice" of code that implements the other steps but only for pods. Hopefully this shows the basic outline of the approach (and asks a couple of questions too). |
@kbeecher - I will dedicate time today to trying this out and giving feedback. Thanks for your willingness to push the feature forward. |
Tried this out, things look to be moving on the right path, swagger looked good, will review and comment further. |
@@ -107,6 +107,13 @@ func (w GracefulDeleteAdapter) Delete(ctx api.Context, name string, options *api | |||
return w.Deleter.Delete(ctx, name) | |||
} | |||
|
|||
// An object that can delete a collection of RESTful resources. | |||
type CollectionDeleter interface { | |||
// Deletes all resources of a certain type under a given namespace. |
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.
Deletes collection of resources (remove the mention of namespaces entirely)
I like where this is headed, interested in getting some other feedback - most notably wrt to graceful delete. |
Will have comments later on this, please hold.
|
@smarterclayton thanks for taking a look! |
Approach looks fine to me, derek seems to have you covered on comments. |
@derekwaynecarr I'm going to resume work on this. Do you have any preference between the adapter/delegate approaches? Personally, I would choose the delegate approach, but that's only because I'm familiar with that, and not exactly sure right now how to implement an adapter :-) |
A default delegate is probably better on generic.Etcd - do the default list implementation and have a number of selectable implementations an implementor can choose to use. |
7e49ed4
to
e1d0e52
Compare
I've added a little more, trying to implement according to your suggestions. If you guys think this is the right approach, I'll start 'widening' this patch to cover all other resources. |
@csrwng can you describe the changes you are making as well so Karl is aware? ----- Original Message -----
|
@kbeecher @smarterclayton
|
@csrwng Thanks for the info. Is this only in planning so far, or do you also have some code/PRs that I can look at? |
@kbeecher mostly planning. I submitted a PR to start that change with the Create method here: #7718 with corresponding comments in the rest package: csrwng@fd65427#diff-47bcf1e79133be8a14b98c919e1d1361R31 |
I don't see a reason to gate this work with what Cesar is looking at. They seem aligned from what I can gather. I would like to get this in and used before Kube 1.0 Sent from my iPhone
|
Labelling this PR as size/XL |
Labelling this PR as size/L |
@derekwaynecarr - I'm getting back to it since I would really like to make it happen. I think that we can solve the watch problem using the the "watch in apiserver" mechanism that I added some time ago. However, I think that there might be one more problem - basically I'm talking about graceful deletion. What should happen if DeletionGracePeriodSeconds is set for an object and we are removing directory that contains such objects? I think that shouldn't be ignored... @smarterclayton |
We had discussed leaving pod deletion to happen on a per item basis, but Do you have an idea for how much complication this adds to our watch cache On Thursday, October 8, 2015, Wojciech Tyczynski notifications@github.com
|
So do we implicitly assume that graceful deletion makes sense only for pods? The graceful deletion period is defined at the ObjectMeta level, so potentially it can be set for any object.
Actually - I just looked into the code and I'm afraid I was wrong :( So unfortunately it will NOT be easy... |
Graceful is going to extend over other resources in the future on a case by I suspect bulk deletion is orthogonal to whether you can graceful On Oct 8, 2015, at 8:53 AM, Wojciech Tyczynski notifications@github.com We had discussed leaving pod deletion to happen on a per item basis, but So do we implicitly assume that graceful deletion makes sense only for Do you have an idea for how much complication this adds to our watch cache Actually - I just looked into the code and I'm afraid I was wrong :( So unfortunately it will NOT be easy... — |
@derekwaynecarr - I talked to coreos folks about the watch issue and they already solve it in v3 api, but are not going to solve it in v2 api - see etcd-io/etcd#3672 for reference. |
@derekwaynecarr @lavalamp @gmarek
The advantage of it is that deleting namespace can be much much faster, because we won't be blocked on namespace-controller QPS limit (and this will help us a lot in scalability tests) Any thoughts on it? If you agree with it, I'm happy to work on it next week. |
@wojtek-t - so if I understand correctly, we will still do N deletes to etcd, but client will make a single call to the API server? That sounds fine to me, fixes the watch problem for time being. I didn't think the v3 model fixed our watch problem either. I assume if request times out, caller just needs to know to try again (and the remaining items will be deleted)? |
That's what I'm suggesting.
In v3 api, this problem is solved - I talked to coreos guys about it.
Yes - I guess so. |
@wojtek-t - sgtm. |
I'm sorry for being so late to this party, but can we make the collection-level deletion take the same parameters as list (and watch)--e.g., label and field selectors--and not call it "delete-all"? (maybe "bulk-delete") I think that'd be much more generally useful! |
Yeah, I think @wojtek-t and I are on the same page. |
please cc me on the resultant PR, i am interested in understanding how large the impact will be. please confirm that the delete collection call also delete the directory node in the registry, and not just its child items as this PR intended? |
sure
I will check if we can easily do it without v3 etcd api (I talked with coreos guys and it will definitely be possible in v3). |
I'd prefer DELETE against the collection - we probably to support delete On Dec 4, 2015, at 8:17 PM, Daniel Smith notifications@github.com wrote: I'm sorry for being so late to this party, but can we make the — |
@smarterclayton - I agree that passing both ListOption & DeletionOptions is exactly what we need. |
@derekwaynecarr @smarterclayton - I've just send out the initial version of my idea in #18290 out for review. |
Yes, that SGTM On Sat, Dec 5, 2015 at 7:45 AM, Clayton Coleman notifications@github.com
|
+1 |
A WIP that so far aims to cover points 1 and 2 in @derekwaynecarr's comment: #5933 (comment)
Refs: #5933