-
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
Added unschedulable taint #61161
Added unschedulable taint #61161
Conversation
@@ -438,7 +438,20 @@ func (nc *Controller) doNoScheduleTaintingPass(node *v1.Node) error { | |||
} | |||
} | |||
} | |||
if node.Spec.Unschedulable { | |||
// If unscheduable, append related taint. |
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.
what removes this taint when the node becomes schedulable again?
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.
definitely needs a test demonstrating this lifecycle works properly
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.
Good point. This might break kubectl cordon/uncordon
too.
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.
@janetkuo +1 as we need to ensure how the taint is removed when kubectl uncordon
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.
The removal is handled here: https://github.com/kubernetes/kubernetes/pull/61161/files#diff-43035107687eb30550696751ac1066e4R458 . we'll get target taints according to the conditions, and the exist taints on the node; and then get taintsToAdd
and taintsToDel
by TaintSetDiff
. SwapNodeControllerTaint
will update the taints accordingly.
re a test
: definitely :)
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.
added integration test for unschedulable; tested removal manually.
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.
When Unschedulable field is cleared, we need to remove the "NoSchedule" taint.
|
||
// AppendUnscheduableTaintIfNotExist appends unscheduable toleration to `.spec` if not exist; otherwise, | ||
// no changes to `.spec.tolerations`. | ||
func AppendUnscheduableTaintIfNotExist(tolerations []v1.Toleration) []v1.Toleration { |
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 rename to AppendNoScheduleTolerationIfNotExist
.
func AppendUnscheduableTaintIfNotExist(tolerations []v1.Toleration) []v1.Toleration { | ||
unscheduableTaintExist := false | ||
for _, t := range tolerations { | ||
if t.Key == algorithm.TaintNodeUnscheduable { |
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 the key being equal to the taint key does not necessarily mean that the toleration is the right one that we need. It could have an operator or a different effect. We should check if the key is the same, operator is "Exists" and effect is "NoSchedule".
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.
@bsalamat - we should create a function under util/toleration
that checks if a toleration exists in a slice of tolerations, IIRC we’re doing the same for taints.
|
||
if !unscheduableTaintExist { | ||
tolerations = append(tolerations, v1.Toleration{ | ||
Key: algorithm.TaintNodeUnscheduable, |
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 think we need to set operator
to "Exists" as well.
// TaintNodeUnscheduable will be added when node becomes unscheduable | ||
// and feature-gate for TaintNodesByCondition flag is enabled, | ||
// and removed when node becomes scheduable. | ||
TaintNodeUnscheduable = "node.kubernetes.io/unscheduable" |
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.
s/TaintNodeUnscheduable/TaintNodeUnschedulable
s/unscheduable/unschedulable
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.
good catch!
/milestone v1.10 |
/sig node |
// AppendUnscheduableTaintIfNotExist appends unscheduable toleration to `.spec` if not exist; otherwise, | ||
// no changes to `.spec.tolerations`. | ||
func AppendUnscheduableTaintIfNotExist(tolerations []v1.Toleration) []v1.Toleration { | ||
unscheduableTaintExist := false |
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.
typo please rename tounschedulableTaintExist
@dims it's not. #60763 is not caused by DaemonSet, see #60763 (comment) |
@krzyzacy is this release blocking? it looks like this is just changing function behind alpha gates, and is still WIP. Should it move out of the milestone? edit: I see it is fixing alpha function for the alpha feature CI job |
@mikedanese ping for pkg/controller/daemon/ approval |
/assign @gmarek |
[MILESTONENOTIFIER] Milestone Pull Request: Up-to-date for process @bsalamat @gmarek @janetkuo @k82cn Pull Request Labels
|
/lgtm |
LGTM for NodeController. /approve |
@mikedanese @janetkuo can one of you approve this PR please? |
@kow3ns does this look good to you too? |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, gmarek, janetkuo, k82cn 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 |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
Signed-off-by: Da K. Ma klaus1982.cn@gmail.com
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):part of #59194; fixes #61050
Release note: