mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Rename labelNodeRoleExcludeBalancer to labelNodeExcludeBalancers (#97767)
* Rename labelNodeRoleExcludeBalancer to labelNodeExcludeBalancers * Move labelNodeExcludeBalancers to well_known_labels * Rename labelNodeExcludeBalancers to LabelNodeExcludeBalancers * Fix LabelNodeExcludeBalancers reference * Fix extra space on well_known_labels * Rename commentary to match with the code name
This commit is contained in:
parent
3fb362bf0a
commit
c417626c49
@ -58,4 +58,11 @@ const (
|
|||||||
// controllers and kube-proxy to check if the Endpoint objects should be replicated when
|
// controllers and kube-proxy to check if the Endpoint objects should be replicated when
|
||||||
// using Headless Services
|
// using Headless Services
|
||||||
IsHeadlessService = "service.kubernetes.io/headless"
|
IsHeadlessService = "service.kubernetes.io/headless"
|
||||||
|
|
||||||
|
// LabelNodeExcludeBalancers specifies that the node should not be considered as a target
|
||||||
|
// for external load-balancers which use nodes as a second hop (e.g. many cloud LBs which only
|
||||||
|
// understand nodes). For services that use externalTrafficPolicy=Local, this may mean that
|
||||||
|
// any backends on excluded nodes are not reachable by those external load-balancers.
|
||||||
|
// Implementations of this exclusion may vary based on provider.
|
||||||
|
LabelNodeExcludeBalancers = "node.kubernetes.io/exclude-from-external-load-balancers"
|
||||||
)
|
)
|
||||||
|
@ -55,13 +55,6 @@ const (
|
|||||||
// should be changed appropriately.
|
// should be changed appropriately.
|
||||||
minRetryDelay = 5 * time.Second
|
minRetryDelay = 5 * time.Second
|
||||||
maxRetryDelay = 300 * time.Second
|
maxRetryDelay = 300 * time.Second
|
||||||
|
|
||||||
// labelNodeRoleExcludeBalancer specifies that the node should not be considered as a target
|
|
||||||
// for external load-balancers which use nodes as a second hop (e.g. many cloud LBs which only
|
|
||||||
// understand nodes). For services that use externalTrafficPolicy=Local, this may mean that
|
|
||||||
// any backends on excluded nodes are not reachable by those external load-balancers.
|
|
||||||
// Implementations of this exclusion may vary based on provider.
|
|
||||||
labelNodeRoleExcludeBalancer = "node.kubernetes.io/exclude-from-external-load-balancers"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type cachedService struct {
|
type cachedService struct {
|
||||||
@ -615,7 +608,7 @@ func nodeSlicesEqualForLB(x, y []*v1.Node) bool {
|
|||||||
|
|
||||||
func (s *Controller) getNodeConditionPredicate() NodeConditionPredicate {
|
func (s *Controller) getNodeConditionPredicate() NodeConditionPredicate {
|
||||||
return func(node *v1.Node) bool {
|
return func(node *v1.Node) bool {
|
||||||
if _, hasExcludeBalancerLabel := node.Labels[labelNodeRoleExcludeBalancer]; hasExcludeBalancerLabel {
|
if _, hasExcludeBalancerLabel := node.Labels[v1.LabelNodeExcludeBalancers]; hasExcludeBalancerLabel {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1382,7 +1382,7 @@ func Test_getNodeConditionPredicate(t *testing.T) {
|
|||||||
{want: true, input: &v1.Node{Spec: v1.NodeSpec{Unschedulable: true}, Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}},
|
{want: true, input: &v1.Node{Spec: v1.NodeSpec{Unschedulable: true}, Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}}}}},
|
||||||
|
|
||||||
{want: true, input: &v1.Node{Status: validNodeStatus, ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{}}}},
|
{want: true, input: &v1.Node{Status: validNodeStatus, ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{}}}},
|
||||||
{want: false, input: &v1.Node{Status: validNodeStatus, ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{labelNodeRoleExcludeBalancer: ""}}}},
|
{want: false, input: &v1.Node{Status: validNodeStatus, ObjectMeta: metav1.ObjectMeta{Labels: map[string]string{v1.LabelNodeExcludeBalancers: ""}}}},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
@ -1498,7 +1498,7 @@ func Test_shouldSyncNode(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: "node",
|
Name: "node",
|
||||||
Labels: map[string]string{
|
Labels: map[string]string{
|
||||||
labelNodeRoleExcludeBalancer: "",
|
v1.LabelNodeExcludeBalancers: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user