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

Implement taints and tolerations #24134

Merged
merged 1 commit into from
May 18, 2016

Conversation

kevin-wangzefeng
Copy link
Member

@kevin-wangzefeng kevin-wangzefeng commented Apr 12, 2016

  • taint & toleration api types
  • add taint to node.Annotations for alpha version
  • add toleration to pod.Annotations for alpha version
  • predicate algorithm for taint-toleration matching
  • priority algorithm for taint-toleration matching
  • add new kubectl command for applying taints to node
  • dedicated nodes implementation (will in a separate PR): Implement an admission controller that adds tolerations to pods that are supposed to be allowed to use dedicated nodes (for example, based on pod's namespace).

P.S. kubelet eviction behaviour will not be included in this PR

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. release-note-label-needed labels Apr 12, 2016
@kevin-wangzefeng kevin-wangzefeng assigned davidopp and unassigned thockin Apr 12, 2016
@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Apr 12, 2016
type Taint struct {
// Required. The taint key to be applied to a node .
Key string `json:"key" patchStrategy:"merge" patchMergeKey:"key"`
// Required. Value is the taint value the toleration matches to.
Copy link
Member

Choose a reason for hiding this comment

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

s/Value is the taint value the toleration matches to/The taint value corresponding to the taint key./

@davidopp
Copy link
Member

Oh, I just saw your checklist explicitly mentioned "add taint to node.Annotations for alpha version,
add toleration to pod.Annotations for alpha version" so I didn't need to mention that in my review. :-)

Anyway, you're definitely on the right track; my comments are pretty minor. Let me know when you have a new commit for me to look at. Thanks again for working on this!

@davidopp
Copy link
Member

BTW it would be great if you can also do the "dedicated nodes" implementation (that uses taints and tolerations) for 1.3. It should go in a different PR, of course. The design doc describes this as "Implement an admission controller that adds tolerations to pods that are supposed to be allowed to use dedicated nodes (for example, based on pod's namespace)."

@kevin-wangzefeng
Copy link
Member Author

Thanks very much for your review, will address the comments in the following commits. :-)

BTW it would be great if you can also do the "dedicated nodes" implementation (that uses taints and tolerations) for 1.3. It should go in a different PR, of course. The design doc describes this as "Implement an admission controller that adds tolerations to pods that are supposed to be allowed to use dedicated nodes (for example, based on pod's namespace)."

Yes, my plan is to implement "dedicated nodes" after the first steps become solid. I also refreshed the PR description just to make a note.

@k8s-github-robot
Copy link

@kevin-wangzefeng
You must link to the test flake issue which caused you to request this manual re-test.
Re-test requests should be in the form of: k8s-bot test this issue: #<number>
Here is the list of open test flakes.

@davidopp
Copy link
Member

@k8sbot e2e test this issue: #IGNORE

@kevin-wangzefeng
Copy link
Member Author

@k8s-bot test this please, issue #22655

.nf
# Update node 'foo' with a taint with key 'dedicated' and value 'special\-user' and effect 'NoScheduleNoAdmitNoExecute'.
# If a taint with that key already exists, its value and effect are replaced as specified.
kubectl taint nodes foo dedicated=special\-user:NoScheduleNoAdmitNoExecute
Copy link
Member

Choose a reason for hiding this comment

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

NoScheduleNoAdmitNoExecute is not implemented yet so shouldn't be used here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for reminding, should be "NoSchedule" here.

@kevin-wangzefeng
Copy link
Member Author

@davidopp refreshed, PTAL


By("removing the taint " + taintName + " off the node " + nodeName)
framework.RunKubectlOrDie("taint", "nodes", nodeName, taintName+"-")
By("verifying the node doesn't have the taint " + taintName)
Copy link
Member

Choose a reason for hiding this comment

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

Add one more step, where you verify that the pod gets schedule after you remove the taint.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I was not clear what I meant. What I meant was: "add one more step, when you verify that the pod that was pending gets scheduled after you remove the taint. So do not create another pod. When you remove the taint from the node, the same pod that was pending, should now get scheduled.

Please do that in a follow-up PR; I am going to LGTM this PR now so we can make sure it gets merged in time.

@davidopp davidopp changed the title [WIP] taints tolerations implementation Implement taints and tolerations May 17, 2016
@davidopp davidopp added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-label-needed labels May 17, 2016
@davidopp
Copy link
Member

I just had one small comment on the e2e test. Once you implement that, please squash the commits and then I will add LGTM label. Thanks!!

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2016
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 18, 2016
@k8s-bot
Copy link

k8s-bot commented May 18, 2016

GCE e2e build/test passed for commit 52fb89f.

@kevin-wangzefeng
Copy link
Member Author

@davidopp refreshed, PTAL

@davidopp davidopp added lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. labels May 18, 2016
@davidopp
Copy link
Member

LGTM

I had one more comment on the e2e test, but you can address it in a follow-up PR.

@davidopp
Copy link
Member

BTW I do not see any label complaining about the docs, so I think this can merge via submit queue instead of manually.

@davidopp
Copy link
Member

Hmm, it does have the kind/old-docs label (though not the do-not-merge) label. I'm a little worried submit queue might not take it, due to old-docs label, and you did update docs/user-guide. So I'm going to manually merge.

@davidopp davidopp merged commit 35c9ca8 into kubernetes:master May 18, 2016
k8s-github-robot pushed a commit that referenced this pull request Jul 29, 2016
…s-e2e

Automatic merge from submit-queue

Remove redundant pod deletion in scheduler predicates tests and fix taints-tolerations e2e

~~In scheduler predicates test, some tests won't clean pods they created when exit with failure, which may lead to pod leak. This PR is to fix it.~~

Remove redundant pod deletion in scheduler predicates tests, since framework.AfterEach() already did the cleanup work after every test.

Also fix the test "validates that taints-tolerations is respected if not matching", refer to the change on taint-toleration test in #29003, and #24134 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants