Skip to content

Commit 4e6e873

Browse files
authored
[feat] make firewallID mutable, propagate it from lmt->lm (#813)
* feat: make firewallID mutable, propagate it from lmt->lm
1 parent 6e6db1b commit 4e6e873

File tree

16 files changed

+501
-31
lines changed

16 files changed

+501
-31
lines changed

api/v1alpha2/linodemachine_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ type LinodeMachineSpec struct {
6767
PrivateIP *bool `json:"privateIP,omitempty"`
6868
// Tags is a list of tags to apply to the Linode instance.
6969
Tags []string `json:"tags,omitempty"`
70-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
70+
// FirewallID is the id of the cloud firewall to apply to the Linode Instance
7171
FirewallID int `json:"firewallID,omitempty"`
7272
// OSDisk is configuration for the root disk that includes the OS,
7373
// if not specified this defaults to whatever space is not taken up by the DataDisks

api/v1alpha2/linodemachinetemplate_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ type LinodeMachineTemplateStatus struct {
3333
// +optional
3434
Tags []string `json:"tags,omitempty"`
3535

36+
// Firewall ID that is currently applied to the LinodeMachineTemplate.
37+
// +optional
38+
FirewallID int `json:"firewallID,omitempty"`
39+
3640
// Conditions represent the latest available observations of a LinodeMachineTemplate's current state.
3741
// +optional
3842
Conditions []metav1.Condition `json:"conditions,omitempty"`

clients/clients.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ type LinodeInstanceClient interface {
5555
GetRegion(ctx context.Context, regionID string) (*linodego.Region, error)
5656
GetImage(ctx context.Context, imageID string) (*linodego.Image, error)
5757
GetType(ctx context.Context, typeID string) (*linodego.LinodeType, error)
58+
ListInstanceFirewalls(ctx context.Context, linodeID int, opts *linodego.ListOptions) ([]linodego.Firewall, error)
59+
UpdateInstanceFirewalls(ctx context.Context, linodeID int, opts linodego.InstanceFirewallUpdateOptions) ([]linodego.Firewall, error)
5860
}
5961

6062
// LinodeVPCClient defines the methods that interact with Linode's VPC service.

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,9 @@ spec:
164164
- message: Value is immutable
165165
rule: self == oldSelf
166166
firewallID:
167+
description: FirewallID is the id of the cloud firewall to apply to
168+
the Linode Instance
167169
type: integer
168-
x-kubernetes-validations:
169-
- message: Value is immutable
170-
rule: self == oldSelf
171170
firewallRef:
172171
description: FirewallRef is a reference to a firewall object. This
173172
makes the linode use the specified firewall.

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,9 @@ spec:
154154
- message: Value is immutable
155155
rule: self == oldSelf
156156
firewallID:
157+
description: FirewallID is the id of the cloud firewall to
158+
apply to the Linode Instance
157159
type: integer
158-
x-kubernetes-validations:
159-
- message: Value is immutable
160-
rule: self == oldSelf
161160
firewallRef:
162161
description: FirewallRef is a reference to a firewall object.
163162
This makes the linode use the specified firewall.
@@ -541,6 +540,9 @@ spec:
541540
- type
542541
type: object
543542
type: array
543+
firewallID:
544+
description: Firewall ID that is currently applied to the LinodeMachineTemplate.
545+
type: integer
544546
tags:
545547
description: tags that are currently applied to the LinodeMachineTemplate.
546548
items:

docs/src/reference/out.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ _Appears in:_
629629
| `backupsEnabled` _boolean_ | | | |
630630
| `privateIP` _boolean_ | | | |
631631
| `tags` _string array_ | Tags is a list of tags to apply to the Linode instance. | | |
632-
| `firewallID` _integer_ | | | |
632+
| `firewallID` _integer_ | FirewallID is the id of the cloud firewall to apply to the Linode Instance | | |
633633
| `osDisk` _[InstanceDisk](#instancedisk)_ | OSDisk is configuration for the root disk that includes the OS,<br />if not specified this defaults to whatever space is not taken up by the DataDisks | | |
634634
| `dataDisks` _object (keys:string, values:[InstanceDisk](#instancedisk))_ | DataDisks is a map of any additional disks to add to an instance,<br />The sum of these disks + the OSDisk must not be more than allowed on a linodes plan | | |
635635
| `diskEncryption` _string_ | DiskEncryption determines if the disks of the instance should be encrypted. The default is disabled. | | Enum: [enabled disabled] <br /> |
@@ -755,6 +755,7 @@ _Appears in:_
755755
| Field | Description | Default | Validation |
756756
| --- | --- | --- | --- |
757757
| `tags` _string array_ | tags that are currently applied to the LinodeMachineTemplate. | | |
758+
| `firewallID` _integer_ | Firewall ID that is currently applied to the LinodeMachineTemplate. | | |
758759
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#condition-v1-meta) array_ | Conditions represent the latest available observations of a LinodeMachineTemplate's current state. | | |
759760

760761

e2e/linodemachine-controller/linodemachine-vpcref-integration/chainsaw-test.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ spec:
4343
- describe:
4444
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
4545
kind: LinodeVPC
46+
- podLogs:
47+
namespace: capl-system
48+
selector: control-plane=controller-manager
49+
tail: 250
4650
- name: Create LinodeMachine with VPCRef
4751
try:
4852
- apply:
@@ -56,6 +60,10 @@ spec:
5660
- describe:
5761
apiVersion: cluster.x-k8s.io/v1beta1
5862
kind: Machine
63+
- podLogs:
64+
namespace: capl-system
65+
selector: control-plane=controller-manager
66+
tail: 250
5967
- name: Check if the Linodes & VPC were created
6068
try:
6169
- script:

e2e/linodemachine-controller/minimal-linodemachine/chainsaw-test.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ spec:
3131
- describe:
3232
apiVersion: cluster.x-k8s.io/v1beta1
3333
kind: Cluster
34+
- podLogs:
35+
namespace: capl-system
36+
selector: control-plane=controller-manager
37+
tail: 250
3438
- name: Create LinodeMachine resource
3539
try:
3640
- apply:
@@ -41,6 +45,10 @@ spec:
4145
- describe:
4246
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2
4347
kind: LinodeMachineTemplate
48+
- podLogs:
49+
namespace: capl-system
50+
selector: control-plane=controller-manager
51+
tail: 250
4452
- describe:
4553
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
4654
kind: KubeadmControlPlane

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.53.1-0.20250728194520-172cba1c457a
1919
github.com/onsi/ginkgo/v2 v2.23.4
2020
github.com/onsi/gomega v1.38.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.53.1-0.20250728194520-172cba1c457a h1:5PaGcDTgxlOZOaYNChSKHnzZp4oKFvzqEn8TQ7hv2Pg=
181+
github.com/linode/linodego v1.53.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=

0 commit comments

Comments
 (0)