mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	address review comments 2
This commit is contained in:
		@@ -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,18 +329,10 @@ func (t *Toleration) ToleratesTaint(taint *Taint) bool {
 | 
				
			|||||||
		return false
 | 
							return false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if t.TolerationSeconds != nil {
 | 
					 | 
				
			||||||
		// taint with no timeAdded indicated can only be tolerated
 | 
					 | 
				
			||||||
		// by toleration with no tolerationSeconds.
 | 
					 | 
				
			||||||
		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.
 | 
						// 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))) {
 | 
						if t.TolerationSeconds != nil && metav1.Now().After(taint.TimeAdded.Add(time.Second*time.Duration(*t.TolerationSeconds))) {
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: Use proper defaulting when Toleration becomes a field of PodSpec
 | 
						// TODO: Use proper defaulting when Toleration becomes a field of PodSpec
 | 
				
			||||||
	switch t.Operator {
 | 
						switch t.Operator {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user