Skip to content

Commit 6b8fc8d

Browse files
skilxn-goYe-Tian-Zero
authored andcommitted
Move TaintBasedEvictions feature gates to GA
1 parent 672aa55 commit 6b8fc8d

File tree

8 files changed

+13
-43
lines changed

8 files changed

+13
-43
lines changed

cmd/kube-controller-manager/app/core.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ func startNodeLifecycleController(ctx ControllerContext) (http.Handler, bool, er
207207
ctx.ComponentConfig.NodeLifecycleController.LargeClusterSizeThreshold,
208208
ctx.ComponentConfig.NodeLifecycleController.UnhealthyZoneThreshold,
209209
ctx.ComponentConfig.NodeLifecycleController.EnableTaintManager,
210-
utilfeature.DefaultFeatureGate.Enabled(features.TaintBasedEvictions),
211210
)
212211
if err != nil {
213212
return nil, true, err

pkg/controller/nodelifecycle/node_lifecycle_controller.go

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,6 @@ type Controller struct {
351351
// tainted nodes, if they're not tolerated.
352352
runTaintManager bool
353353

354-
// if set to true Controller will taint Nodes with 'TaintNodeNotReady' and 'TaintNodeUnreachable'
355-
// taints instead of evicting Pods itself.
356-
useTaintBasedEvictions bool
357-
358354
nodeUpdateQueue workqueue.Interface
359355
podUpdateQueue workqueue.RateLimitingInterface
360356
}
@@ -375,7 +371,6 @@ func NewNodeLifecycleController(
375371
largeClusterThreshold int32,
376372
unhealthyZoneThreshold float32,
377373
runTaintManager bool,
378-
useTaintBasedEvictions bool,
379374
) (*Controller, error) {
380375

381376
if kubeClient == nil {
@@ -416,13 +411,9 @@ func NewNodeLifecycleController(
416411
largeClusterThreshold: largeClusterThreshold,
417412
unhealthyZoneThreshold: unhealthyZoneThreshold,
418413
runTaintManager: runTaintManager,
419-
useTaintBasedEvictions: useTaintBasedEvictions && runTaintManager,
420414
nodeUpdateQueue: workqueue.NewNamed("node_lifecycle_controller"),
421415
podUpdateQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "node_lifecycle_controller_pods"),
422416
}
423-
if useTaintBasedEvictions {
424-
klog.Infof("Controller is using taint based evictions.")
425-
}
426417

427418
nc.enterPartialDisruptionFunc = nc.ReducedQPSFunc
428419
nc.enterFullDisruptionFunc = nc.HealthyQPSFunc
@@ -580,7 +571,7 @@ func (nc *Controller) Run(stopCh <-chan struct{}) {
580571
go wait.Until(nc.doPodProcessingWorker, time.Second, stopCh)
581572
}
582573

583-
if nc.useTaintBasedEvictions {
574+
if nc.runTaintManager {
584575
// Handling taint based evictions. Because we don't want a dedicated logic in TaintManager for NC-originated
585576
// taints and we normally don't rate limit evictions caused by taints, we need to rate limit adding taints.
586577
go wait.Until(nc.doNoExecuteTaintingPass, scheduler.NodeEvictionPeriod, stopCh)
@@ -768,9 +759,7 @@ func (nc *Controller) doEvictionPass() {
768759

769760
// monitorNodeHealth verifies node health are constantly updated by kubelet, and
770761
// 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.
774763
func (nc *Controller) monitorNodeHealth() error {
775764
// We are listing nodes from local cache as we can tolerate some small delays
776765
// comparing to state from etcd and there is eventual consistency anyway.
@@ -789,7 +778,7 @@ func (nc *Controller) monitorNodeHealth() error {
789778
nodeutil.RecordNodeEvent(nc.recorder, added[i].Name, string(added[i].UID), v1.EventTypeNormal, "RegisteredNode", fmt.Sprintf("Registered Node %v in Controller", added[i].Name))
790779
nc.knownNodeSet[added[i].Name] = added[i]
791780
nc.addPodEvictorForNewZone(added[i])
792-
if nc.useTaintBasedEvictions {
781+
if nc.runTaintManager {
793782
nc.markNodeAsReachable(added[i])
794783
} else {
795784
nc.cancelPodEviction(added[i])
@@ -843,7 +832,7 @@ func (nc *Controller) monitorNodeHealth() error {
843832
}
844833
continue
845834
}
846-
if nc.useTaintBasedEvictions {
835+
if nc.runTaintManager {
847836
nc.processTaintBaseEviction(node, &observedReadyCondition)
848837
} else {
849838
if err := nc.processNoTaintBaseEviction(node, &observedReadyCondition, gracePeriod, pods); err != nil {
@@ -1209,7 +1198,7 @@ func (nc *Controller) handleDisruption(zoneToNodeConditions map[string][]*v1.Nod
12091198
if allAreFullyDisrupted {
12101199
klog.V(0).Info("Controller detected that all Nodes are not-Ready. Entering master disruption mode.")
12111200
for i := range nodes {
1212-
if nc.useTaintBasedEvictions {
1201+
if nc.runTaintManager {
12131202
_, err := nc.markNodeAsReachable(nodes[i])
12141203
if err != nil {
12151204
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
12201209
}
12211210
// We stop all evictions.
12221211
for k := range nc.zoneStates {
1223-
if nc.useTaintBasedEvictions {
1212+
if nc.runTaintManager {
12241213
nc.zoneNoExecuteTainter[k].SwapLimiter(0)
12251214
} else {
12261215
nc.zonePodEvictor[k].SwapLimiter(0)
@@ -1332,7 +1321,7 @@ func (nc *Controller) processPod(podItem podUpdateItem) {
13321321
pods := []*v1.Pod{pod}
13331322
// In taint-based eviction mode, only node updates are processed by NodeLifecycleController.
13341323
// Pods are processed by TaintManager.
1335-
if !nc.useTaintBasedEvictions {
1324+
if !nc.runTaintManager {
13361325
if err := nc.processNoTaintBaseEviction(node, currentReadyCondition, nc.nodeMonitorGracePeriod, pods); err != nil {
13371326
klog.Warningf("Unable to process pod %+v eviction from node %v: %v.", podItem, nodeName, err)
13381327
nc.podUpdateQueue.AddRateLimited(podItem)
@@ -1351,21 +1340,21 @@ func (nc *Controller) processPod(podItem podUpdateItem) {
13511340
func (nc *Controller) setLimiterInZone(zone string, zoneSize int, state ZoneState) {
13521341
switch state {
13531342
case stateNormal:
1354-
if nc.useTaintBasedEvictions {
1343+
if nc.runTaintManager {
13551344
nc.zoneNoExecuteTainter[zone].SwapLimiter(nc.evictionLimiterQPS)
13561345
} else {
13571346
nc.zonePodEvictor[zone].SwapLimiter(nc.evictionLimiterQPS)
13581347
}
13591348
case statePartialDisruption:
1360-
if nc.useTaintBasedEvictions {
1349+
if nc.runTaintManager {
13611350
nc.zoneNoExecuteTainter[zone].SwapLimiter(
13621351
nc.enterPartialDisruptionFunc(zoneSize))
13631352
} else {
13641353
nc.zonePodEvictor[zone].SwapLimiter(
13651354
nc.enterPartialDisruptionFunc(zoneSize))
13661355
}
13671356
case stateFullDisruption:
1368-
if nc.useTaintBasedEvictions {
1357+
if nc.runTaintManager {
13691358
nc.zoneNoExecuteTainter[zone].SwapLimiter(
13701359
nc.enterFullDisruptionFunc(zoneSize))
13711360
} else {
@@ -1431,7 +1420,7 @@ func (nc *Controller) addPodEvictorForNewZone(node *v1.Node) {
14311420
zone := utilnode.GetZoneKey(node)
14321421
if _, found := nc.zoneStates[zone]; !found {
14331422
nc.zoneStates[zone] = stateInitial
1434-
if !nc.useTaintBasedEvictions {
1423+
if !nc.runTaintManager {
14351424
nc.zonePodEvictor[zone] =
14361425
scheduler.NewRateLimitedTimedQueue(
14371426
flowcontrol.NewTokenBucketRateLimiter(nc.evictionLimiterQPS, scheduler.EvictionRateLimiterBurst))

pkg/controller/nodelifecycle/node_lifecycle_controller_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ func newNodeLifecycleControllerFromClient(
180180
largeClusterThreshold,
181181
unhealthyZoneThreshold,
182182
useTaints,
183-
useTaints,
184183
)
185184
if err != nil {
186185
return nil, err

pkg/features/kube_features.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const (
6161

6262
// owner: @Huang-Wei
6363
// beta: v1.13
64+
// ga: v1.18
6465
//
6566
// Changes the logic behind evicting Pods from not ready Nodes
6667
// to take advantage of NoExecute Taints and Tolerations.
@@ -592,7 +593,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
592593
DynamicKubeletConfig: {Default: true, PreRelease: featuregate.Beta},
593594
ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: featuregate.Beta},
594595
DevicePlugins: {Default: true, PreRelease: featuregate.Beta},
595-
TaintBasedEvictions: {Default: true, PreRelease: featuregate.Beta},
596+
TaintBasedEvictions: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.19
596597
RotateKubeletServerCertificate: {Default: true, PreRelease: featuregate.Beta},
597598
RotateKubeletClientCertificate: {Default: true, PreRelease: featuregate.Beta},
598599
LocalStorageCapacityIsolation: {Default: true, PreRelease: featuregate.Beta},

staging/src/k8s.io/api/core/v1/well_known_taints.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,31 @@ package v1
1818

1919
const (
2020
// TaintNodeNotReady will be added when node is not ready
21-
// and feature-gate for TaintBasedEvictions flag is enabled,
2221
// and removed when node becomes ready.
2322
TaintNodeNotReady = "node.kubernetes.io/not-ready"
2423

2524
// TaintNodeUnreachable will be added when node becomes unreachable
2625
// (corresponding to NodeReady status ConditionUnknown)
27-
// and feature-gate for TaintBasedEvictions flag is enabled,
2826
// and removed when node becomes reachable (NodeReady status ConditionTrue).
2927
TaintNodeUnreachable = "node.kubernetes.io/unreachable"
3028

3129
// TaintNodeUnschedulable will be added when node becomes unschedulable
32-
// and feature-gate for TaintNodesByCondition flag is enabled,
3330
// and removed when node becomes scheduable.
3431
TaintNodeUnschedulable = "node.kubernetes.io/unschedulable"
3532

3633
// TaintNodeMemoryPressure will be added when node has memory pressure
37-
// and feature-gate for TaintNodesByCondition flag is enabled,
3834
// and removed when node has enough memory.
3935
TaintNodeMemoryPressure = "node.kubernetes.io/memory-pressure"
4036

4137
// TaintNodeDiskPressure will be added when node has disk pressure
42-
// and feature-gate for TaintNodesByCondition flag is enabled,
4338
// and removed when node has enough disk.
4439
TaintNodeDiskPressure = "node.kubernetes.io/disk-pressure"
4540

4641
// TaintNodeNetworkUnavailable will be added when node's network is unavailable
47-
// and feature-gate for TaintNodesByCondition flag is enabled,
4842
// and removed when network becomes ready.
4943
TaintNodeNetworkUnavailable = "node.kubernetes.io/network-unavailable"
5044

5145
// TaintNodePIDPressure will be added when node has pid pressure
52-
// and feature-gate for TaintNodesByCondition flag is enabled,
5346
// and removed when node has enough disk.
5447
TaintNodePIDPressure = "node.kubernetes.io/pid-pressure"
5548
)

test/integration/node/BUILD

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ go_test(
1515
tags = ["integration"],
1616
deps = [
1717
"//pkg/controller/nodelifecycle:go_default_library",
18-
"//pkg/features:go_default_library",
1918
"//plugin/pkg/admission/defaulttolerationseconds:go_default_library",
2019
"//plugin/pkg/admission/podtolerationrestriction:go_default_library",
2120
"//plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction:go_default_library",
@@ -25,11 +24,9 @@ go_test(
2524
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
2625
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
2726
"//staging/src/k8s.io/apiserver/pkg/admission:go_default_library",
28-
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
2927
"//staging/src/k8s.io/client-go/informers:go_default_library",
3028
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
3129
"//staging/src/k8s.io/client-go/rest:go_default_library",
32-
"//staging/src/k8s.io/component-base/featuregate/testing:go_default_library",
3330
"//test/e2e/framework/pod:go_default_library",
3431
"//test/integration/framework:go_default_library",
3532
"//test/integration/util:go_default_library",

test/integration/node/lifecycle_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,10 @@ import (
2828
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2929
"k8s.io/apimachinery/pkg/runtime/schema"
3030
"k8s.io/apiserver/pkg/admission"
31-
utilfeature "k8s.io/apiserver/pkg/util/feature"
3231
"k8s.io/client-go/informers"
3332
"k8s.io/client-go/kubernetes"
3433
restclient "k8s.io/client-go/rest"
35-
featuregatetesting "k8s.io/component-base/featuregate/testing"
3634
"k8s.io/kubernetes/pkg/controller/nodelifecycle"
37-
"k8s.io/kubernetes/pkg/features"
3835
"k8s.io/kubernetes/plugin/pkg/admission/defaulttolerationseconds"
3936
"k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction"
4037
pluginapi "k8s.io/kubernetes/plugin/pkg/admission/podtolerationrestriction/apis/podtolerationrestriction"
@@ -109,9 +106,6 @@ func TestTaintBasedEvictions(t *testing.T) {
109106
},
110107
}
111108

112-
// Enable TaintBasedEvictions
113-
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.TaintBasedEvictions, true)()
114-
115109
// Build admission chain handler.
116110
podTolerations := podtolerationrestriction.NewPodTolerationsPlugin(&pluginapi.Configuration{})
117111
admission := admission.NewChainHandler(
@@ -156,7 +150,6 @@ func TestTaintBasedEvictions(t *testing.T) {
156150
50, // Large cluster threshold
157151
0.55, // Unhealthy zone threshold
158152
true, // Run taint manager
159-
true, // Use taint based evictions
160153
)
161154
if err != nil {
162155
t.Errorf("Failed to create node controller: %v", err)

test/integration/scheduler/taint_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ func TestTaintNodeByCondition(t *testing.T) {
9898
100, // Large cluster threshold
9999
100, // Unhealthy zone threshold
100100
true, // Run taint manager
101-
true, // Use taint based evictions
102101
)
103102
if err != nil {
104103
t.Errorf("Failed to create node controller: %v", err)

0 commit comments

Comments
 (0)