@@ -351,10 +351,6 @@ type Controller struct {
351
351
// tainted nodes, if they're not tolerated.
352
352
runTaintManager bool
353
353
354
- // if set to true Controller will taint Nodes with 'TaintNodeNotReady' and 'TaintNodeUnreachable'
355
- // taints instead of evicting Pods itself.
356
- useTaintBasedEvictions bool
357
-
358
354
nodeUpdateQueue workqueue.Interface
359
355
podUpdateQueue workqueue.RateLimitingInterface
360
356
}
@@ -375,7 +371,6 @@ func NewNodeLifecycleController(
375
371
largeClusterThreshold int32 ,
376
372
unhealthyZoneThreshold float32 ,
377
373
runTaintManager bool ,
378
- useTaintBasedEvictions bool ,
379
374
) (* Controller , error ) {
380
375
381
376
if kubeClient == nil {
@@ -416,13 +411,9 @@ func NewNodeLifecycleController(
416
411
largeClusterThreshold : largeClusterThreshold ,
417
412
unhealthyZoneThreshold : unhealthyZoneThreshold ,
418
413
runTaintManager : runTaintManager ,
419
- useTaintBasedEvictions : useTaintBasedEvictions && runTaintManager ,
420
414
nodeUpdateQueue : workqueue .NewNamed ("node_lifecycle_controller" ),
421
415
podUpdateQueue : workqueue .NewNamedRateLimitingQueue (workqueue .DefaultControllerRateLimiter (), "node_lifecycle_controller_pods" ),
422
416
}
423
- if useTaintBasedEvictions {
424
- klog .Infof ("Controller is using taint based evictions." )
425
- }
426
417
427
418
nc .enterPartialDisruptionFunc = nc .ReducedQPSFunc
428
419
nc .enterFullDisruptionFunc = nc .HealthyQPSFunc
@@ -580,7 +571,7 @@ func (nc *Controller) Run(stopCh <-chan struct{}) {
580
571
go wait .Until (nc .doPodProcessingWorker , time .Second , stopCh )
581
572
}
582
573
583
- if nc .useTaintBasedEvictions {
574
+ if nc .runTaintManager {
584
575
// Handling taint based evictions. Because we don't want a dedicated logic in TaintManager for NC-originated
585
576
// taints and we normally don't rate limit evictions caused by taints, we need to rate limit adding taints.
586
577
go wait .Until (nc .doNoExecuteTaintingPass , scheduler .NodeEvictionPeriod , stopCh )
@@ -768,9 +759,7 @@ func (nc *Controller) doEvictionPass() {
768
759
769
760
// monitorNodeHealth verifies node health are constantly updated by kubelet, and
770
761
// if not, post "NodeReady==ConditionUnknown".
771
- // For nodes who are not ready or not reachable for a long period of time.
772
- // This function will taint them if TaintBasedEvictions feature was enabled.
773
- // Otherwise, it would evict it directly.
762
+ // This function will taint nodes who are not ready or not reachable for a long period of time.
774
763
func (nc * Controller ) monitorNodeHealth () error {
775
764
// We are listing nodes from local cache as we can tolerate some small delays
776
765
// comparing to state from etcd and there is eventual consistency anyway.
@@ -789,7 +778,7 @@ func (nc *Controller) monitorNodeHealth() error {
789
778
nodeutil .RecordNodeEvent (nc .recorder , added [i ].Name , string (added [i ].UID ), v1 .EventTypeNormal , "RegisteredNode" , fmt .Sprintf ("Registered Node %v in Controller" , added [i ].Name ))
790
779
nc .knownNodeSet [added [i ].Name ] = added [i ]
791
780
nc .addPodEvictorForNewZone (added [i ])
792
- if nc .useTaintBasedEvictions {
781
+ if nc .runTaintManager {
793
782
nc .markNodeAsReachable (added [i ])
794
783
} else {
795
784
nc .cancelPodEviction (added [i ])
@@ -843,7 +832,7 @@ func (nc *Controller) monitorNodeHealth() error {
843
832
}
844
833
continue
845
834
}
846
- if nc .useTaintBasedEvictions {
835
+ if nc .runTaintManager {
847
836
nc .processTaintBaseEviction (node , & observedReadyCondition )
848
837
} else {
849
838
if err := nc .processNoTaintBaseEviction (node , & observedReadyCondition , gracePeriod , pods ); err != nil {
@@ -1209,7 +1198,7 @@ func (nc *Controller) handleDisruption(zoneToNodeConditions map[string][]*v1.Nod
1209
1198
if allAreFullyDisrupted {
1210
1199
klog .V (0 ).Info ("Controller detected that all Nodes are not-Ready. Entering master disruption mode." )
1211
1200
for i := range nodes {
1212
- if nc .useTaintBasedEvictions {
1201
+ if nc .runTaintManager {
1213
1202
_ , err := nc .markNodeAsReachable (nodes [i ])
1214
1203
if err != nil {
1215
1204
klog .Errorf ("Failed to remove taints from Node %v" , nodes [i ].Name )
@@ -1220,7 +1209,7 @@ func (nc *Controller) handleDisruption(zoneToNodeConditions map[string][]*v1.Nod
1220
1209
}
1221
1210
// We stop all evictions.
1222
1211
for k := range nc .zoneStates {
1223
- if nc .useTaintBasedEvictions {
1212
+ if nc .runTaintManager {
1224
1213
nc .zoneNoExecuteTainter [k ].SwapLimiter (0 )
1225
1214
} else {
1226
1215
nc .zonePodEvictor [k ].SwapLimiter (0 )
@@ -1332,7 +1321,7 @@ func (nc *Controller) processPod(podItem podUpdateItem) {
1332
1321
pods := []* v1.Pod {pod }
1333
1322
// In taint-based eviction mode, only node updates are processed by NodeLifecycleController.
1334
1323
// Pods are processed by TaintManager.
1335
- if ! nc .useTaintBasedEvictions {
1324
+ if ! nc .runTaintManager {
1336
1325
if err := nc .processNoTaintBaseEviction (node , currentReadyCondition , nc .nodeMonitorGracePeriod , pods ); err != nil {
1337
1326
klog .Warningf ("Unable to process pod %+v eviction from node %v: %v." , podItem , nodeName , err )
1338
1327
nc .podUpdateQueue .AddRateLimited (podItem )
@@ -1351,21 +1340,21 @@ func (nc *Controller) processPod(podItem podUpdateItem) {
1351
1340
func (nc * Controller ) setLimiterInZone (zone string , zoneSize int , state ZoneState ) {
1352
1341
switch state {
1353
1342
case stateNormal :
1354
- if nc .useTaintBasedEvictions {
1343
+ if nc .runTaintManager {
1355
1344
nc .zoneNoExecuteTainter [zone ].SwapLimiter (nc .evictionLimiterQPS )
1356
1345
} else {
1357
1346
nc .zonePodEvictor [zone ].SwapLimiter (nc .evictionLimiterQPS )
1358
1347
}
1359
1348
case statePartialDisruption :
1360
- if nc .useTaintBasedEvictions {
1349
+ if nc .runTaintManager {
1361
1350
nc .zoneNoExecuteTainter [zone ].SwapLimiter (
1362
1351
nc .enterPartialDisruptionFunc (zoneSize ))
1363
1352
} else {
1364
1353
nc .zonePodEvictor [zone ].SwapLimiter (
1365
1354
nc .enterPartialDisruptionFunc (zoneSize ))
1366
1355
}
1367
1356
case stateFullDisruption :
1368
- if nc .useTaintBasedEvictions {
1357
+ if nc .runTaintManager {
1369
1358
nc .zoneNoExecuteTainter [zone ].SwapLimiter (
1370
1359
nc .enterFullDisruptionFunc (zoneSize ))
1371
1360
} else {
@@ -1431,7 +1420,7 @@ func (nc *Controller) addPodEvictorForNewZone(node *v1.Node) {
1431
1420
zone := utilnode .GetZoneKey (node )
1432
1421
if _ , found := nc .zoneStates [zone ]; ! found {
1433
1422
nc .zoneStates [zone ] = stateInitial
1434
- if ! nc .useTaintBasedEvictions {
1423
+ if ! nc .runTaintManager {
1435
1424
nc .zonePodEvictor [zone ] =
1436
1425
scheduler .NewRateLimitedTimedQueue (
1437
1426
flowcontrol .NewTokenBucketRateLimiter (nc .evictionLimiterQPS , scheduler .EvictionRateLimiterBurst ))
0 commit comments