mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-10-28 12:19:16 +00:00 
			
		
		
		
	update logic of adding default DS pod tolerations
- update DS pod default tolerations: add PIDPressure, remove OutOfDisk - remove useless tolerations testcases
This commit is contained in:
		| @@ -145,24 +145,12 @@ func TestTaintNodeByCondition(t *testing.T) { | ||||
| 		Effect:   v1.TaintEffectNoSchedule, | ||||
| 	} | ||||
|  | ||||
| 	unreachableToleration := v1.Toleration{ | ||||
| 		Key:      schedulerapi.TaintNodeUnreachable, | ||||
| 		Operator: v1.TolerationOpExists, | ||||
| 		Effect:   v1.TaintEffectNoSchedule, | ||||
| 	} | ||||
|  | ||||
| 	unschedulableToleration := v1.Toleration{ | ||||
| 		Key:      schedulerapi.TaintNodeUnschedulable, | ||||
| 		Operator: v1.TolerationOpExists, | ||||
| 		Effect:   v1.TaintEffectNoSchedule, | ||||
| 	} | ||||
|  | ||||
| 	outOfDiskToleration := v1.Toleration{ | ||||
| 		Key:      schedulerapi.TaintNodeOutOfDisk, | ||||
| 		Operator: v1.TolerationOpExists, | ||||
| 		Effect:   v1.TaintEffectNoSchedule, | ||||
| 	} | ||||
|  | ||||
| 	memoryPressureToleration := v1.Toleration{ | ||||
| 		Key:      schedulerapi.TaintNodeMemoryPressure, | ||||
| 		Operator: v1.TolerationOpExists, | ||||
| @@ -240,46 +228,6 @@ func TestTaintNodeByCondition(t *testing.T) { | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "unreachable node", | ||||
| 			existingTaints: []v1.Taint{ | ||||
| 				{ | ||||
| 					Key:    schedulerapi.TaintNodeUnreachable, | ||||
| 					Effect: v1.TaintEffectNoSchedule, | ||||
| 				}, | ||||
| 			}, | ||||
| 			nodeConditions: []v1.NodeCondition{ | ||||
| 				{ | ||||
| 					Type:   v1.NodeReady, | ||||
| 					Status: v1.ConditionUnknown, // node status is "Unknown" | ||||
| 				}, | ||||
| 			}, | ||||
| 			expectedTaints: []v1.Taint{ | ||||
| 				{ | ||||
| 					Key:    schedulerapi.TaintNodeUnreachable, | ||||
| 					Effect: v1.TaintEffectNoSchedule, | ||||
| 				}, | ||||
| 			}, | ||||
| 			pods: []podCase{ | ||||
| 				{ | ||||
| 					pod:  bestEffortPod, | ||||
| 					fits: false, | ||||
| 				}, | ||||
| 				{ | ||||
| 					pod:  burstablePod, | ||||
| 					fits: false, | ||||
| 				}, | ||||
| 				{ | ||||
| 					pod:  guaranteePod, | ||||
| 					fits: false, | ||||
| 				}, | ||||
| 				{ | ||||
| 					pod:         bestEffortPod, | ||||
| 					tolerations: []v1.Toleration{unreachableToleration}, | ||||
| 					fits:        true, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:          "unschedulable node", | ||||
| 			unschedulable: true, // node.spec.unschedulable = true | ||||
| @@ -315,50 +263,6 @@ func TestTaintNodeByCondition(t *testing.T) { | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "out of disk node", | ||||
| 			nodeConditions: []v1.NodeCondition{ | ||||
| 				{ | ||||
| 					Type:   v1.NodeOutOfDisk, | ||||
| 					Status: v1.ConditionTrue, | ||||
| 				}, | ||||
| 				{ | ||||
| 					Type:   v1.NodeReady, | ||||
| 					Status: v1.ConditionTrue, | ||||
| 				}, | ||||
| 			}, | ||||
| 			expectedTaints: []v1.Taint{ | ||||
| 				{ | ||||
| 					Key:    schedulerapi.TaintNodeOutOfDisk, | ||||
| 					Effect: v1.TaintEffectNoSchedule, | ||||
| 				}, | ||||
| 			}, | ||||
| 			// In OutOfDisk condition, only pods with toleration can be scheduled. | ||||
| 			pods: []podCase{ | ||||
| 				{ | ||||
| 					pod:  bestEffortPod, | ||||
| 					fits: false, | ||||
| 				}, | ||||
| 				{ | ||||
| 					pod:  burstablePod, | ||||
| 					fits: false, | ||||
| 				}, | ||||
| 				{ | ||||
| 					pod:  guaranteePod, | ||||
| 					fits: false, | ||||
| 				}, | ||||
| 				{ | ||||
| 					pod:         bestEffortPod, | ||||
| 					tolerations: []v1.Toleration{outOfDiskToleration}, | ||||
| 					fits:        true, | ||||
| 				}, | ||||
| 				{ | ||||
| 					pod:         bestEffortPod, | ||||
| 					tolerations: []v1.Toleration{diskPressureToleration}, | ||||
| 					fits:        false, | ||||
| 				}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name: "memory pressure node", | ||||
| 			nodeConditions: []v1.NodeCondition{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user