-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
Add kubelet awareness to taint tolerant match caculator. #26501
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,53 @@ func (w *predicateAdmitHandler) Admit(attrs *PodAdmitAttributes) PodAdmitResult | |
Message: message, | ||
} | ||
} | ||
|
||
// Check toleration against taints | ||
// NOTE(harryz) consider move PodToleratesNodeTaints to GeneralPredicates to eliminate duplicate code here | ||
fit, reasons, err = predicates.PodToleratesNodeTaints(pod, nil, nodeInfo) | ||
if err != nil { | ||
message := fmt.Sprintf("PodToleratesNodeTaints failed due to %v, which is unexpected.", err) | ||
glog.Warningf("Failed to admit pod %v - %s", format.Pod(pod), message) | ||
return PodAdmitResult{ | ||
Admit: fit, | ||
Reason: "UnexpectedError", | ||
Message: message, | ||
} | ||
|
||
} | ||
if !fit { | ||
var reason string | ||
var message string | ||
if len(reasons) == 0 { | ||
message = fmt.Sprint("PodToleratesNodeTaints failed due to unknown reason, which is unexpected.") | ||
glog.Warningf("Failed to admit pod %v - %s", format.Pod(pod), message) | ||
return PodAdmitResult{ | ||
Admit: fit, | ||
Reason: "UnknownReason", | ||
Message: message, | ||
} | ||
} | ||
r := reasons[0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If multiple reasons are returned, why only output [0]? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The caller: |
||
switch re := r.(type) { | ||
case *predicates.ErrTaintsTolerationsNotMatch: | ||
// if kubelet should not care this unfit | ||
if !re.SomeUntoleratedTaintIsNoAdmit { | ||
return PodAdmitResult{ | ||
Admit: true, | ||
} | ||
} | ||
reason = "PodToleratesNodeTaints" | ||
message = re.Error() | ||
glog.Warningf("Failed to admit pod %v - %s", format.Pod(pod), message) | ||
} | ||
|
||
return PodAdmitResult{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment re: event. |
||
Admit: fit, | ||
Reason: reason, | ||
Message: message, | ||
} | ||
} | ||
|
||
return PodAdmitResult{ | ||
Admit: true, | ||
} | ||
|
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.
Without me popping through the node code, are the events log'd higher up the call chain?
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 see event will higher it up, more clues?