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

Namespace deletion uses discovery + dynamic client #21400

Conversation

derekwaynecarr
Copy link
Member

Fixes: #14765
Fixes: #21701

The namespace controller:

  • takes a list of group version resources supported based on the discovery client
  • during deletion, uses dynamic client to remove those resources
    • does DELETE_COLLECTION if supported, otherwise falls back to LIST/DELETE by name.
    • verifies that no items exist for each collection for each resource.

This means developers no longer need to remember to clean-up their resource as part of namespace lifecycle.

@k8s-github-robot k8s-github-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Feb 17, 2016
@derekwaynecarr
Copy link
Member Author

see: #20351 (comment)

@derekwaynecarr derekwaynecarr force-pushed the namespace_deletion_discovery branch 3 times, most recently from 92c57fd to c41330b Compare February 23, 2016 06:59
@k8s-github-robot k8s-github-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 23, 2016
@derekwaynecarr derekwaynecarr force-pushed the namespace_deletion_discovery branch 2 times, most recently from 3e40b48 to 5ba3797 Compare February 23, 2016 08:22
@derekwaynecarr derekwaynecarr changed the title WIP: Namespace deletion uses discovery + dynamic client Namespace deletion uses discovery + dynamic client Feb 23, 2016
@derekwaynecarr
Copy link
Member Author

@lavalamp @thockin @bgrant0607 - this PR updates the namespace controller to use the discovery client to find the list of supported resources, and the dynamic client to then delete those resources. this should eliminate developer errors where developers had forgot to do this manually. assuming this is stable, it may be worth our while to have it in 1.2.

/cc @smarterclayton @kubernetes/rh-cluster-infra

@derekwaynecarr derekwaynecarr added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Feb 23, 2016
@derekwaynecarr derekwaynecarr force-pushed the namespace_deletion_discovery branch 2 times, most recently from ed20247 to f3b8b73 Compare February 23, 2016 16:28
@derekwaynecarr
Copy link
Member Author

@liggitt - can you take a look as well?

@k8s-bot
Copy link

k8s-bot commented Feb 23, 2016

GCE e2e test build/test passed for commit f3b8b739d0ef19fe6c0fce50128077eb4b85bfea.

@lavalamp
Copy link
Member

@krousey Can you take a look?

@krousey
Copy link
Contributor

krousey commented Feb 23, 2016

@lavalamp sure. Is this 1.2 critical?

@lavalamp
Copy link
Member

It's 1.2 nice-to-have.

@derekwaynecarr
Copy link
Member Author

Looks like my last commit broke a unit test, investigating.

@lavalamp @krousey I agree its a nice-to-have for 1.2. I always worry that people forget to handle deletion issues as things move around API groups, and this just eliminates that worry from the project.

@derekwaynecarr derekwaynecarr force-pushed the namespace_deletion_discovery branch 2 times, most recently from 05556c6 to 788e65c Compare February 23, 2016 18:47
@derekwaynecarr
Copy link
Member Author

Recording here so I do not forget:

To support re-using the same controller to delete downstream OpenShift specific resources or in federated API server use cases, I will need to let a namespace controller have a finalizer token that it is associated with passed in during creation.

@k8s-bot
Copy link

k8s-bot commented Feb 23, 2016

GCE e2e test build/test passed for commit 05556c62977dc0c5d867d64c96040c2cebf0b390.

@k8s-bot
Copy link

k8s-bot commented Feb 23, 2016

GCE e2e test build/test passed for commit 788e65c7fda85d321ee96f667168487d16a7f1bb.

if len(groupVersion.Group) == 0 {
return "/api"
}
return "/apis"
Copy link
Contributor

Choose a reason for hiding this comment

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

I know it's not, but shouldn't this be in the discovery into?

Copy link
Member Author

Choose a reason for hiding this comment

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

opened issue: #21916

@lavalamp
Copy link
Member

I finally got a chance to go through this. @derekwaynecarr sorry it took me so long.

@k8s-github-robot
Copy link

PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 29, 2016
@derekwaynecarr derekwaynecarr force-pushed the namespace_deletion_discovery branch from 41c4797 to 601096f Compare March 3, 2016 04:23
@derekwaynecarr
Copy link
Member Author

@lavalamp - rebased, and updated per code review requests. PTAL

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 3, 2016
@derekwaynecarr derekwaynecarr force-pushed the namespace_deletion_discovery branch from 601096f to 773cf73 Compare March 3, 2016 04:36
@k8s-bot
Copy link

k8s-bot commented Mar 3, 2016

GCE e2e build/test passed for commit 773cf73.

@eparis
Copy link
Contributor

eparis commented Mar 3, 2016

@k8s-bot test this, issue #22435

@k8s-bot
Copy link

k8s-bot commented Mar 3, 2016

GCE e2e build/test passed for commit beace2d.

// this is strange, but we need to special case for both MethodNotSupported and NotFound errors
// TODO: https://github.com/kubernetes/kubernetes/issues/22413
// we have a resource returned in the discovery API that supports no top-level verbs:
// /apis/extensions/v1beta1/namespaces/default/replicationcontrollers
Copy link
Member

Choose a reason for hiding this comment

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

So, rather than this special case here, you may want to special case just this and keep it out of the resource list entirely. That path only exists to mount a subresource. We won't ever make anything like it again.

@lavalamp
Copy link
Member

lavalamp commented Mar 3, 2016

So I have a bunch of nitpicky things that I said and some I didn't say. But if you're confident that this works, I'm willing to hold my nose and LGTM.

@derekwaynecarr
Copy link
Member Author

@lavalamp - I'm confident it works, as for holding noses, if we are fine holding our nose on ReplicationControllerDummy (#22413), I think this smells a little better than what we had before and vote to merge for 1.2.

@lavalamp lavalamp added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 3, 2016
@lavalamp
Copy link
Member

lavalamp commented Mar 3, 2016

LGTM thanks!

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Mar 4, 2016

GCE e2e build/test passed for commit beace2d.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Mar 4, 2016
@k8s-github-robot k8s-github-robot merged commit 258eac5 into kubernetes:master Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. 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.

10 participants