remove feature-gate StableLoadBalancerNodeSet

This commit is contained in:
carlory 2024-08-21 14:37:51 +08:00
parent 4ce63b4822
commit 295ecc19d4
4 changed files with 8 additions and 56 deletions

View File

@ -772,15 +772,6 @@ const (
// Enables kubelet support to size memory backed volumes
SizeMemoryBackedVolumes featuregate.Feature = "SizeMemoryBackedVolumes"
// owner: @alexanderConstantinescu
// kep: http://kep.k8s.io/3458
// beta: v1.27
// GA: v1.30
//
// Enables less load balancer re-configurations by the service controller
// (KCCM) as an effect of changing node state.
StableLoadBalancerNodeSet featuregate.Feature = "StableLoadBalancerNodeSet"
// owner: @mattcary
// alpha: v1.22
// beta: v1.27
@ -1183,8 +1174,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
SizeMemoryBackedVolumes: {Default: true, PreRelease: featuregate.Beta},
StableLoadBalancerNodeSet: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.30, remove in 1.32
StatefulSetAutoDeletePVC: {Default: true, PreRelease: featuregate.Beta},
StatefulSetStartOrdinal: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.31, remove in 1.33

View File

@ -30,7 +30,6 @@ import (
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
coreinformers "k8s.io/client-go/informers/core/v1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
@ -44,7 +43,6 @@ import (
servicehelper "k8s.io/cloud-provider/service/helpers"
"k8s.io/component-base/featuregate"
controllersmetrics "k8s.io/component-base/metrics/prometheus/controllers"
"k8s.io/controller-manager/pkg/features"
"k8s.io/klog/v2"
)
@ -439,7 +437,7 @@ func (c *Controller) syncLoadBalancerIfNeeded(ctx context.Context, service *v1.S
}
func (c *Controller) ensureLoadBalancer(ctx context.Context, service *v1.Service) (*v1.LoadBalancerStatus, error) {
nodes, err := listWithPredicates(c.nodeLister, getNodePredicatesForService(service)...)
nodes, err := listWithPredicates(c.nodeLister, stableNodeSetPredicates...)
if err != nil {
return nil, err
}
@ -701,12 +699,9 @@ func loggableNodeNames(nodes []*v1.Node) []string {
func shouldSyncUpdatedNode(oldNode, newNode *v1.Node) bool {
// Evaluate the individual node exclusion predicate before evaluating the
// compounded result of all predicates. We don't sync changes on the
// readiness condition for eTP:Local services or when
// StableLoadBalancerNodeSet is enabled, hence if a node remains NotReady
// and a user adds the exclusion label we will need to sync as to make sure
// this change is reflected correctly on ETP=local services. The sync
// function compares lastSyncedNodes with the new (existing) set of nodes
// compounded result of all predicates.
//
// The sync function compares lastSyncedNodes with the new (existing) set of nodes
// for each service, so services which are synced with the same set of nodes
// should be skipped internally in the sync function. This is needed as to
// trigger a global sync for all services and make sure no service gets
@ -718,9 +713,7 @@ func shouldSyncUpdatedNode(oldNode, newNode *v1.Node) bool {
if oldNode.Spec.ProviderID != newNode.Spec.ProviderID {
return true
}
if !utilfeature.DefaultFeatureGate.Enabled(features.StableLoadBalancerNodeSet) {
return respectsPredicates(oldNode, allNodePredicates...) != respectsPredicates(newNode, allNodePredicates...)
}
return false
}
@ -760,8 +753,8 @@ func (c *Controller) nodeSyncService(svc *v1.Service) bool {
nodeSyncErrorCount.Inc()
return retNeedRetry
}
newNodes = filterWithPredicates(newNodes, getNodePredicatesForService(svc)...)
oldNodes := filterWithPredicates(c.getLastSyncedNodes(svc), getNodePredicatesForService(svc)...)
newNodes = filterWithPredicates(newNodes, stableNodeSetPredicates...)
oldNodes := filterWithPredicates(c.getLastSyncedNodes(svc), stableNodeSetPredicates...)
// Store last synced nodes without actually determining if we successfully
// synced them or not. Failed node syncs are passed off to retries in the
// service queue, so no need to wait. If we don't store it now, we risk
@ -1011,11 +1004,7 @@ var (
nodeUnTaintedPredicate,
nodeReadyPredicate,
}
etpLocalNodePredicates []NodeConditionPredicate = []NodeConditionPredicate{
nodeIncludedPredicate,
nodeUnTaintedPredicate,
nodeReadyPredicate,
}
stableNodeSetPredicates []NodeConditionPredicate = []NodeConditionPredicate{
nodeNotDeletedPredicate,
nodeIncludedPredicate,
@ -1028,16 +1017,6 @@ var (
}
)
func getNodePredicatesForService(service *v1.Service) []NodeConditionPredicate {
if utilfeature.DefaultFeatureGate.Enabled(features.StableLoadBalancerNodeSet) {
return stableNodeSetPredicates
}
if service.Spec.ExternalTrafficPolicy == v1.ServiceExternalTrafficPolicyLocal {
return etpLocalNodePredicates
}
return allNodePredicates
}
// We consider the node for load balancing only when the node is not labelled for exclusion.
func nodeIncludedPredicate(node *v1.Node) bool {
_, hasExcludeBalancerLabel := node.Labels[v1.LabelNodeExcludeBalancers]

View File

@ -37,15 +37,6 @@ const (
// alpha: v1.27
// Enable webhook in cloud controller manager
CloudControllerManagerWebhook featuregate.Feature = "CloudControllerManagerWebhook"
// owner: @alexanderConstantinescu
// kep: http://kep.k8s.io/3458
// beta: v1.27
// GA: v1.30
//
// Enables less load balancer re-configurations by the service controller
// (KCCM) as an effect of changing node state.
StableLoadBalancerNodeSet featuregate.Feature = "StableLoadBalancerNodeSet"
)
func SetupCurrentKubernetesSpecificFeatureGates(featuregates featuregate.MutableFeatureGate) error {
@ -56,5 +47,4 @@ func SetupCurrentKubernetesSpecificFeatureGates(featuregates featuregate.Mutable
// To add a new feature, define a key for it at k8s.io/api/pkg/features and add it here.
var cloudPublicFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
CloudControllerManagerWebhook: {Default: false, PreRelease: featuregate.Alpha},
StableLoadBalancerNodeSet: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.30, remove in 1.31
}

View File

@ -760,12 +760,6 @@
lockToDefault: false
preRelease: Beta
version: ""
- name: StableLoadBalancerNodeSet
versionedSpecs:
- default: true
lockToDefault: true
preRelease: GA
version: ""
- name: StatefulSetAutoDeletePVC
versionedSpecs:
- default: true