mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
address review comments 2
This commit is contained in:
parent
6a2ef1646b
commit
3c550c32fb
@ -316,10 +316,10 @@ func GetNodeTaints(node *Node) ([]Taint, error) {
|
|||||||
// (3) Empty toleration.key means to match all taint keys.
|
// (3) Empty toleration.key means to match all taint keys.
|
||||||
// If toleration.key is empty, toleration.operator must be 'Exists';
|
// If toleration.key is empty, toleration.operator must be 'Exists';
|
||||||
// this combination means to match all taint values and all taint keys.
|
// this combination means to match all taint values and all taint keys.
|
||||||
// (4) Nil toleration.tolerationSeconds means to match taints with
|
// (4) Nil toleration.tolerationSeconds means to tolerate the taint forever.
|
||||||
// any value of taint.timeAdded.
|
|
||||||
// (5) Non-nil positive toleration.tolerationSeconds means to
|
// (5) Non-nil positive toleration.tolerationSeconds means to
|
||||||
// match the taint for only a duration that starts at taint.timeAdded.
|
// match the taint for only a duration since the taint was observed
|
||||||
|
// by the TaintManager.
|
||||||
func (t *Toleration) ToleratesTaint(taint *Taint) bool {
|
func (t *Toleration) ToleratesTaint(taint *Taint) bool {
|
||||||
if len(t.Effect) > 0 && t.Effect != taint.Effect {
|
if len(t.Effect) > 0 && t.Effect != taint.Effect {
|
||||||
return false
|
return false
|
||||||
@ -329,17 +329,9 @@ func (t *Toleration) ToleratesTaint(taint *Taint) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.TolerationSeconds != nil {
|
// TODO: need to take time skew into consideration, make sure toleration won't become out of age ealier than expected.
|
||||||
// taint with no timeAdded indicated can only be tolerated
|
if t.TolerationSeconds != nil && metav1.Now().After(taint.TimeAdded.Add(time.Second*time.Duration(*t.TolerationSeconds))) {
|
||||||
// by toleration with no tolerationSeconds.
|
return false
|
||||||
if taint.TimeAdded.IsZero() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: need to take time skew into consideration, make sure toleration won't become out of age ealier than expected.
|
|
||||||
if metav1.Now().After(taint.TimeAdded.Add(time.Second * time.Duration(*t.TolerationSeconds))) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Use proper defaulting when Toleration becomes a field of PodSpec
|
// TODO: Use proper defaulting when Toleration becomes a field of PodSpec
|
||||||
|
Loading…
Reference in New Issue
Block a user