Skip to content

Commit a740457

Browse files
committed
super mega ultra WIP
1 parent a857b88 commit a740457

17 files changed

+376
-98
lines changed

api/v1alpha2/linodecluster_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ type NetworkSpec struct {
190190
// example: 10.10.10.0/30
191191
// +optional
192192
NodeBalancerBackendIPv4Range string `json:"nodeBalancerBackendIPv4Range,omitempty"`
193+
// UseNewNetworkInterfaces indicates whether to use new network interfaces for the cluster.
194+
// +optional
195+
UseNewNetworkInterfaces bool `json:"useNewNetworkInterfaces,omitempty"`
193196
}
194197

195198
type LinodeNBPortConfig struct {

config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclusters.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ spec:
180180
description: subnetName is the name/label of the VPC subnet to
181181
be used by the cluster
182182
type: string
183+
useNewNetworkInterfaces:
184+
description: UseNewNetworkInterfaces indicates whether to use
185+
new network interfaces for the cluster.
186+
type: boolean
183187
useVlan:
184188
description: UseVlan provisions a cluster that uses VLANs instead
185189
of VPCs. IPAM is managed internally.

config/crd/bases/infrastructure.cluster.x-k8s.io_linodeclustertemplates.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ spec:
176176
description: subnetName is the name/label of the VPC subnet
177177
to be used by the cluster
178178
type: string
179+
useNewNetworkInterfaces:
180+
description: UseNewNetworkInterfaces indicates whether
181+
to use new network interfaces for the cluster.
182+
type: boolean
179183
useVlan:
180184
description: UseVlan provisions a cluster that uses VLANs
181185
instead of VPCs. IPAM is managed internally.

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require (
1515
github.com/go-logr/logr v1.4.3
1616
github.com/google/go-cmp v0.7.0
1717
github.com/google/uuid v1.6.0
18-
github.com/linode/linodego v1.53.1-0.20250709175023-9b152d30578c
18+
github.com/linode/linodego v1.54.1-0.20250728194520-172cba1c457a
1919
github.com/onsi/ginkgo/v2 v2.23.4
2020
github.com/onsi/gomega v1.37.0
2121
github.com/stretchr/testify v1.10.0
@@ -64,7 +64,7 @@ require (
6464
github.com/x448/float16 v0.8.4 // indirect
6565
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
6666
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect
67-
golang.org/x/sync v0.15.0 // indirect
67+
golang.org/x/sync v0.16.0 // indirect
6868
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
6969
k8s.io/apiserver v0.33.0 // indirect
7070
k8s.io/component-base v0.33.0 // indirect
@@ -130,11 +130,11 @@ require (
130130
go.uber.org/multierr v1.11.0 // indirect
131131
go.uber.org/ratelimit v0.2.0 // indirect
132132
go.uber.org/zap v1.27.0 // indirect
133-
golang.org/x/net v0.41.0 // indirect
133+
golang.org/x/net v0.42.0 // indirect
134134
golang.org/x/oauth2 v0.30.0 // indirect
135-
golang.org/x/sys v0.33.0 // indirect
136-
golang.org/x/term v0.32.0 // indirect
137-
golang.org/x/text v0.26.0 // indirect
135+
golang.org/x/sys v0.34.0 // indirect
136+
golang.org/x/term v0.33.0 // indirect
137+
golang.org/x/text v0.27.0 // indirect
138138
golang.org/x/time v0.9.0 // indirect
139139
golang.org/x/tools v0.34.0 // indirect
140140
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
177177
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
178178
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
179179
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
180-
github.com/linode/linodego v1.53.1-0.20250709175023-9b152d30578c h1:WlZm+YNHBuphycMZG2s2+F04hx2wx1ShuOwPAIInjP8=
181-
github.com/linode/linodego v1.53.1-0.20250709175023-9b152d30578c/go.mod h1:bI949fZaVchjWyKIA08hNyvAcV6BAS+PM2op3p7PAWA=
180+
github.com/linode/linodego v1.54.1-0.20250728194520-172cba1c457a h1:WtHqziHGlueosyUPxXIswDO5tQewj2fgeekD4GsdHoo=
181+
github.com/linode/linodego v1.54.1-0.20250728194520-172cba1c457a/go.mod h1:VHlFAbhj18634Cd7B7L5D723kFKFQMOxzIutSMcWsB4=
182182
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
183183
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
184184
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
@@ -333,8 +333,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
333333
golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
334334
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
335335
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
336-
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
337-
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
336+
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
337+
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
338338
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
339339
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
340340
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -346,30 +346,30 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
346346
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
347347
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
348348
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
349-
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
350-
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
349+
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
350+
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
351351
golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
352352
golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
353353
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
354354
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
355355
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
356356
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
357-
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
358-
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
357+
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
358+
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
359359
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
360360
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
361361
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
362362
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
363363
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
364-
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
365-
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
366-
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
367-
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
364+
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
365+
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
366+
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg=
367+
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0=
368368
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
369369
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
370370
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
371-
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
372-
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
371+
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
372+
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
373373
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
374374
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
375375
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

internal/controller/linodecluster_controller.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ import (
5151

5252
const (
5353
lbTypeDNS string = "dns"
54-
pauseAnnotationValue string = "true"
54+
lbTypeExternal string = "external"
55+
lbTypeNB string = "NodeBalancer"
5556
ConditionPreflightLinodeVPCReady string = "PreflightLinodeVPCReady"
5657
ConditionPreflightLinodeNBFirewallReady string = "PreflightLinodeNBFirewallReady"
5758
)
@@ -453,15 +454,15 @@ func (r *LinodeClusterReconciler) reconcileCreate(ctx context.Context, logger lo
453454
func (r *LinodeClusterReconciler) reconcileDelete(ctx context.Context, logger logr.Logger, clusterScope *scope.ClusterScope) error {
454455
logger.Info("deleting cluster")
455456
switch {
456-
case clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "external":
457+
case clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == lbTypeExternal:
457458
logger.Info("LoadBalacing managed externally, nothing to do.")
458459
conditions.Set(clusterScope.LinodeCluster, metav1.Condition{
459460
Type: string(clusterv1.ReadyCondition),
460461
Status: metav1.ConditionFalse,
461462
Reason: string(clusterv1.DeletedReason),
462463
Message: "Deletion in progress",
463464
})
464-
r.Recorder.Event(clusterScope.LinodeCluster, corev1.EventTypeWarning, "LoadBalacing managed externally", "LoadBalacing managed externally, nothing to do.")
465+
r.Recorder.Event(clusterScope.LinodeCluster, corev1.EventTypeWarning, "LoadBalancing managed externally", "LoadBalancing managed externally, nothing to do.")
465466

466467
case clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == lbTypeDNS:
467468
if err := removeMachineFromDNS(ctx, logger, clusterScope); err != nil {
@@ -475,11 +476,11 @@ func (r *LinodeClusterReconciler) reconcileDelete(ctx context.Context, logger lo
475476
})
476477
r.Recorder.Event(clusterScope.LinodeCluster, corev1.EventTypeNormal, clusterv1.DeletedReason, "Load balancing for Type DNS deleted")
477478

478-
case clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "NodeBalancer" && clusterScope.LinodeCluster.Spec.Network.NodeBalancerID == nil:
479+
case clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == lbTypeNB && clusterScope.LinodeCluster.Spec.Network.NodeBalancerID == nil:
479480
logger.Info("NodeBalancer ID is missing for Type NodeBalancer, nothing to do")
480481
r.Recorder.Event(clusterScope.LinodeCluster, corev1.EventTypeWarning, "NodeBalancerIDMissing", "NodeBalancer already removed, nothing to do")
481482

482-
case clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "NodeBalancer" && clusterScope.LinodeCluster.Spec.Network.NodeBalancerID != nil:
483+
case clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == lbTypeNB && clusterScope.LinodeCluster.Spec.Network.NodeBalancerID != nil:
483484
if err := removeMachineFromNB(ctx, logger, clusterScope); err != nil {
484485
return fmt.Errorf("remove machine from loadbalancer: %w", err)
485486
}

internal/controller/linodecluster_controller_helpers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ import (
2323

2424
func addMachineToLB(ctx context.Context, clusterScope *scope.ClusterScope) error {
2525
logger := logr.FromContextOrDiscard(ctx)
26-
if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "external" {
26+
if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == lbTypeExternal {
2727
logger.Info("LoadBalancing is handled externally")
2828
return nil
2929
}
30-
if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == "dns" {
30+
if clusterScope.LinodeCluster.Spec.Network.LoadBalancerType == lbTypeDNS {
3131
if err := services.EnsureDNSEntries(ctx, clusterScope, "create"); err != nil {
3232
logger.Error(err, "Failed to ensure DNS entries")
3333
return err
@@ -37,7 +37,7 @@ func addMachineToLB(ctx context.Context, clusterScope *scope.ClusterScope) error
3737
// Reconcile clusters with Spec.Network = {} and ControlPlaneEndpoint.Host externally managed
3838
if clusterScope.LinodeCluster.Spec.Network.NodeBalancerID == nil || clusterScope.LinodeCluster.Spec.Network.ApiserverNodeBalancerConfigID == nil {
3939
logger.Info("NodeBalancerID or ApiserverNodeBalancerConfigID not set for Type NodeBalancer, this cluster is managed externally")
40-
clusterScope.LinodeCluster.Spec.Network.LoadBalancerType = "external"
40+
clusterScope.LinodeCluster.Spec.Network.LoadBalancerType = lbTypeExternal
4141
return nil
4242
}
4343
nodeBalancerNodes, err := clusterScope.LinodeClient.ListNodeBalancerNodes(

internal/controller/linodecluster_controller_helpers_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func TestAddMachineToLB(t *testing.T) {
338338
LinodeCluster: &infrav1alpha2.LinodeCluster{
339339
Spec: infrav1alpha2.LinodeClusterSpec{
340340
Network: infrav1alpha2.NetworkSpec{
341-
LoadBalancerType: "external",
341+
LoadBalancerType: lbTypeExternal,
342342
},
343343
},
344344
},
@@ -352,7 +352,7 @@ func TestAddMachineToLB(t *testing.T) {
352352
LinodeCluster: &infrav1alpha2.LinodeCluster{
353353
Spec: infrav1alpha2.LinodeClusterSpec{
354354
Network: infrav1alpha2.NetworkSpec{
355-
LoadBalancerType: "nodebalancer",
355+
LoadBalancerType: lbTypeNB,
356356
// NodeBalancerID and ApiserverNodeBalancerConfigID are nil
357357
},
358358
},
@@ -367,7 +367,7 @@ func TestAddMachineToLB(t *testing.T) {
367367
LinodeCluster: &infrav1alpha2.LinodeCluster{
368368
Spec: infrav1alpha2.LinodeClusterSpec{
369369
Network: infrav1alpha2.NetworkSpec{
370-
LoadBalancerType: "nodebalancer",
370+
LoadBalancerType: lbTypeNB,
371371
NodeBalancerID: util.Pointer(12345),
372372
ApiserverNodeBalancerConfigID: util.Pointer(67890),
373373
},
@@ -395,7 +395,7 @@ func TestAddMachineToLB(t *testing.T) {
395395
LinodeCluster: &infrav1alpha2.LinodeCluster{
396396
Spec: infrav1alpha2.LinodeClusterSpec{
397397
Network: infrav1alpha2.NetworkSpec{
398-
LoadBalancerType: "nodebalancer",
398+
LoadBalancerType: lbTypeNB,
399399
NodeBalancerID: util.Pointer(12345),
400400
ApiserverNodeBalancerConfigID: util.Pointer(67890),
401401
},
@@ -449,9 +449,9 @@ func TestAddMachineToLB(t *testing.T) {
449449
}
450450
} else {
451451
require.NoError(t, err)
452-
// For the NodeBalancer without IDs case, verify that LoadBalancerType was changed to "external"
453-
if testcase.name == "NodeBalancer without IDs should set type to external" {
454-
assert.Equal(t, "external", testcase.clusterScope.LinodeCluster.Spec.Network.LoadBalancerType)
452+
// For the NodeBalancer without IDs case, verify that LoadBalancerType was changed to lbTypeExternal
453+
if testcase.name == "NodeBalancer without IDs should set type to lbTypeExternal" {
454+
assert.Equal(t, lbTypeExternal, testcase.clusterScope.LinodeCluster.Spec.Network.LoadBalancerType)
455455
}
456456
}
457457
})

0 commit comments

Comments
 (0)