@@ -30,7 +30,6 @@ import (
30
30
"k8s.io/apimachinery/pkg/util/runtime"
31
31
"k8s.io/apimachinery/pkg/util/sets"
32
32
"k8s.io/apimachinery/pkg/util/wait"
33
- utilfeature "k8s.io/apiserver/pkg/util/feature"
34
33
coreinformers "k8s.io/client-go/informers/core/v1"
35
34
clientset "k8s.io/client-go/kubernetes"
36
35
"k8s.io/client-go/kubernetes/scheme"
@@ -44,7 +43,6 @@ import (
44
43
servicehelper "k8s.io/cloud-provider/service/helpers"
45
44
"k8s.io/component-base/featuregate"
46
45
controllersmetrics "k8s.io/component-base/metrics/prometheus/controllers"
47
- "k8s.io/controller-manager/pkg/features"
48
46
"k8s.io/klog/v2"
49
47
)
50
48
@@ -439,7 +437,7 @@ func (c *Controller) syncLoadBalancerIfNeeded(ctx context.Context, service *v1.S
439
437
}
440
438
441
439
func (c * Controller ) ensureLoadBalancer (ctx context.Context , service * v1.Service ) (* v1.LoadBalancerStatus , error ) {
442
- nodes , err := listWithPredicates (c .nodeLister , getNodePredicatesForService ( service ) ... )
440
+ nodes , err := listWithPredicates (c .nodeLister , stableNodeSetPredicates ... )
443
441
if err != nil {
444
442
return nil , err
445
443
}
@@ -701,12 +699,9 @@ func loggableNodeNames(nodes []*v1.Node) []string {
701
699
702
700
func shouldSyncUpdatedNode (oldNode , newNode * v1.Node ) bool {
703
701
// Evaluate the individual node exclusion predicate before evaluating the
704
- // compounded result of all predicates. We don't sync changes on the
705
- // readiness condition for eTP:Local services or when
706
- // StableLoadBalancerNodeSet is enabled, hence if a node remains NotReady
707
- // and a user adds the exclusion label we will need to sync as to make sure
708
- // this change is reflected correctly on ETP=local services. The sync
709
- // function compares lastSyncedNodes with the new (existing) set of nodes
702
+ // compounded result of all predicates.
703
+ //
704
+ // The sync function compares lastSyncedNodes with the new (existing) set of nodes
710
705
// for each service, so services which are synced with the same set of nodes
711
706
// should be skipped internally in the sync function. This is needed as to
712
707
// trigger a global sync for all services and make sure no service gets
@@ -718,9 +713,7 @@ func shouldSyncUpdatedNode(oldNode, newNode *v1.Node) bool {
718
713
if oldNode .Spec .ProviderID != newNode .Spec .ProviderID {
719
714
return true
720
715
}
721
- if ! utilfeature .DefaultFeatureGate .Enabled (features .StableLoadBalancerNodeSet ) {
722
- return respectsPredicates (oldNode , allNodePredicates ... ) != respectsPredicates (newNode , allNodePredicates ... )
723
- }
716
+
724
717
return false
725
718
}
726
719
@@ -760,8 +753,8 @@ func (c *Controller) nodeSyncService(svc *v1.Service) bool {
760
753
nodeSyncErrorCount .Inc ()
761
754
return retNeedRetry
762
755
}
763
- newNodes = filterWithPredicates (newNodes , getNodePredicatesForService ( svc ) ... )
764
- oldNodes := filterWithPredicates (c .getLastSyncedNodes (svc ), getNodePredicatesForService ( svc ) ... )
756
+ newNodes = filterWithPredicates (newNodes , stableNodeSetPredicates ... )
757
+ oldNodes := filterWithPredicates (c .getLastSyncedNodes (svc ), stableNodeSetPredicates ... )
765
758
// Store last synced nodes without actually determining if we successfully
766
759
// synced them or not. Failed node syncs are passed off to retries in the
767
760
// service queue, so no need to wait. If we don't store it now, we risk
@@ -1011,11 +1004,7 @@ var (
1011
1004
nodeUnTaintedPredicate ,
1012
1005
nodeReadyPredicate ,
1013
1006
}
1014
- etpLocalNodePredicates []NodeConditionPredicate = []NodeConditionPredicate {
1015
- nodeIncludedPredicate ,
1016
- nodeUnTaintedPredicate ,
1017
- nodeReadyPredicate ,
1018
- }
1007
+
1019
1008
stableNodeSetPredicates []NodeConditionPredicate = []NodeConditionPredicate {
1020
1009
nodeNotDeletedPredicate ,
1021
1010
nodeIncludedPredicate ,
@@ -1028,16 +1017,6 @@ var (
1028
1017
}
1029
1018
)
1030
1019
1031
- func getNodePredicatesForService (service * v1.Service ) []NodeConditionPredicate {
1032
- if utilfeature .DefaultFeatureGate .Enabled (features .StableLoadBalancerNodeSet ) {
1033
- return stableNodeSetPredicates
1034
- }
1035
- if service .Spec .ExternalTrafficPolicy == v1 .ServiceExternalTrafficPolicyLocal {
1036
- return etpLocalNodePredicates
1037
- }
1038
- return allNodePredicates
1039
- }
1040
-
1041
1020
// We consider the node for load balancing only when the node is not labelled for exclusion.
1042
1021
func nodeIncludedPredicate (node * v1.Node ) bool {
1043
1022
_ , hasExcludeBalancerLabel := node .Labels [v1 .LabelNodeExcludeBalancers ]
0 commit comments