Skip to content

Commit 276f162

Browse files
committed
[feat] Remove annotation in favor of well-known label
1 parent aaef694 commit 276f162

File tree

5 files changed

+16
-25
lines changed

5 files changed

+16
-25
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ make mockgen
110110

111111
## Common Gotchas
112112
- NodeBalancer backends require VPC configuration when `Options.VPCNames` is set
113-
- Node exclusion annotation: `node.k8s.linode.com/exclude-from-nb`
113+
- Node exclusion label: `node.kubernetes.io/exclude-from-external-load-balancers=true`
114114
- Port configurations must be valid JSON in annotations
115115
- Health check types depend on protocol (UDP vs TCP/HTTP)
116116
- Instance cache is global and shared across controllers

cloud/annotations/annotations.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const (
4747
AnnLinodeNodePublicIPv6 = "node.k8s.linode.com/public-ipv6"
4848

4949
AnnLinodeNodeIPSharingUpdated = "node.k8s.linode.com/ip-sharing-updated"
50-
AnnExcludeNodeFromNb = "node.k8s.linode.com/exclude-from-nb"
5150

5251
NodeBalancerBackendIPv4Range = "service.beta.kubernetes.io/linode-loadbalancer-backend-ipv4-range"
5352

cloud/linode/loadbalancers.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -506,10 +506,6 @@ func (l *loadbalancers) updateNodeBalancer(
506506
subnetID = id
507507
}
508508
for _, node := range nodes {
509-
if _, ok := node.Annotations[annotations.AnnExcludeNodeFromNb]; ok {
510-
klog.Infof("Node %s is excluded from NodeBalancer by annotation, skipping", node.Name)
511-
continue
512-
}
513509
var newNodeOpts *linodego.NodeBalancerConfigRebuildNodeOptions
514510
newNodeOpts, err = l.buildNodeBalancerNodeConfigRebuildOptions(node, port.NodePort, subnetID, newNBCfg.Protocol)
515511
if err != nil {
@@ -1087,10 +1083,6 @@ func (l *loadbalancers) buildLoadBalancerRequest(ctx context.Context, clusterNam
10871083
createOpt := config.GetCreateOptions()
10881084

10891085
for _, node := range nodes {
1090-
if _, ok := node.Annotations[annotations.AnnExcludeNodeFromNb]; ok {
1091-
klog.Infof("Node %s is excluded from NodeBalancer by annotation, skipping", node.Name)
1092-
continue
1093-
}
10941086
newNodeOpts, err := l.buildNodeBalancerNodeConfigRebuildOptions(node, port.NodePort, subnetID, config.Protocol)
10951087
if err != nil {
10961088
sentry.CaptureError(ctx, err)

cloud/linode/loadbalancers_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4711,8 +4711,8 @@ func testUpdateLoadBalancerNodeExcludedByAnnotation(t *testing.T, client *linode
47114711
{
47124712
ObjectMeta: metav1.ObjectMeta{
47134713
Name: "node-2",
4714-
Annotations: map[string]string{
4715-
annotations.AnnExcludeNodeFromNb: "true",
4714+
Labels: map[string]string{
4715+
v1.LabelNodeExcludeBalancers: "true",
47164716
},
47174717
},
47184718
Status: v1.NodeStatus{
@@ -4764,8 +4764,8 @@ func testUpdateLoadBalancerNodeExcludedByAnnotation(t *testing.T, client *linode
47644764
{
47654765
ObjectMeta: metav1.ObjectMeta{
47664766
Name: "node-1",
4767-
Annotations: map[string]string{
4768-
annotations.AnnExcludeNodeFromNb: "true", // Now exclude node-1
4767+
Labels: map[string]string{
4768+
v1.LabelNodeExcludeBalancers: "true",
47694769
},
47704770
},
47714771
Status: v1.NodeStatus{
@@ -4780,8 +4780,8 @@ func testUpdateLoadBalancerNodeExcludedByAnnotation(t *testing.T, client *linode
47804780
{
47814781
ObjectMeta: metav1.ObjectMeta{
47824782
Name: "node-2",
4783-
Annotations: map[string]string{
4784-
annotations.AnnExcludeNodeFromNb: "true", // Still excluded
4783+
Labels: map[string]string{
4784+
v1.LabelNodeExcludeBalancers: "true",
47854785
},
47864786
},
47874787
Status: v1.NodeStatus{
@@ -4833,8 +4833,8 @@ func testUpdateLoadBalancerNodeExcludedByAnnotation(t *testing.T, client *linode
48334833
{
48344834
ObjectMeta: metav1.ObjectMeta{
48354835
Name: "node-1",
4836-
Annotations: map[string]string{
4837-
annotations.AnnExcludeNodeFromNb: "true",
4836+
Labels: map[string]string{
4837+
v1.LabelNodeExcludeBalancers: "true",
48384838
},
48394839
},
48404840
Status: v1.NodeStatus{
@@ -4849,8 +4849,8 @@ func testUpdateLoadBalancerNodeExcludedByAnnotation(t *testing.T, client *linode
48494849
{
48504850
ObjectMeta: metav1.ObjectMeta{
48514851
Name: "node-2",
4852-
Annotations: map[string]string{
4853-
annotations.AnnExcludeNodeFromNb: "true",
4852+
Labels: map[string]string{
4853+
v1.LabelNodeExcludeBalancers: "true",
48544854
},
48554855
},
48564856
Status: v1.NodeStatus{
@@ -4865,8 +4865,8 @@ func testUpdateLoadBalancerNodeExcludedByAnnotation(t *testing.T, client *linode
48654865
{
48664866
ObjectMeta: metav1.ObjectMeta{
48674867
Name: "node-3",
4868-
Annotations: map[string]string{
4869-
annotations.AnnExcludeNodeFromNb: "true",
4868+
Labels: map[string]string{
4869+
v1.LabelNodeExcludeBalancers: "true",
48704870
},
48714871
},
48724872
Status: v1.NodeStatus{

docs/configuration/loadbalancer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ metadata:
255255
```
256256

257257
### Excluding nodes from nodebalancer
258-
Add the an annotation to the node object to exclude
258+
Add the a label to the node object to exclude
259259

260260
```yaml
261261
apiVersion: v1
262262
kind: Node
263263
metadata:
264264
name: node-to-exclude
265-
annotations:
266-
node.k8s.linode.com/exclude-from-nb: "true"
265+
labels:
266+
node.kubernetes.io/exclude-from-external-load-balancers: "true"
267267
```
268268

269269
## Related Documentation

0 commit comments

Comments
 (0)