Skip to content

Commit d8d066a

Browse files
author
Rahul Sharma
committed
allow specifying multiple ipv6 ranges as supported by API. Multiple ranges are not supported for now but maybe in future
1 parent 7a29967 commit d8d066a

File tree

9 files changed

+342
-77
lines changed

9 files changed

+342
-77
lines changed

api/v1alpha2/linodevpc_types.go

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1alpha2
1818

1919
import (
20+
"github.com/linode/linodego"
2021
corev1 "k8s.io/api/core/v1"
2122
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2223
)
@@ -36,6 +37,16 @@ type LinodeVPCSpec struct {
3637
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
3738
Region string `json:"region"`
3839
// +optional
40+
// IPv6 is a list of IPv6 ranges allocated to the VPC.
41+
// Once ranges are allocated based on the IPv6Range field, they will be
42+
// added to this field.
43+
IPv6 []linodego.VPCIPv6Range `json:"ipv6,omitempty"`
44+
// +optional
45+
// IPv6Range is a list of IPv6 ranges to allocate to the VPC.
46+
// If not specified, the VPC will not have an IPv6 range allocated.
47+
// Once ranges are allocated, they will be added to the IPv6 field.
48+
IPv6Range []VPCCreateOptionsIPv6 `json:"ipv6Range,omitempty"`
49+
// +optional
3950
Subnets []VPCSubnetCreateOptions `json:"subnets,omitempty"`
4051

4152
// Retain allows you to keep the VPC after the LinodeVPC object is deleted.
@@ -50,12 +61,15 @@ type LinodeVPCSpec struct {
5061
// supplied then the credentials of the controller will be used.
5162
// +optional
5263
CredentialsRef *corev1.SecretReference `json:"credentialsRef,omitempty"`
53-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
54-
// +optional
55-
// +kubebuilder:validation:MinLength=2
56-
// +kubebuilder:validation:MaxLength=4
57-
// +kubebuilder:default="/52"
58-
IPv6Range string `json:"ipv6Range,omitempty"`
64+
}
65+
66+
// VPCCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC.
67+
// Its copied from linodego.VPCCreateOptionsIPv6 and should be kept in sync.
68+
// Values supported by the linode API should be used here.
69+
// See https://techdocs.akamai.com/linode-api/reference/post-vpc for more details.
70+
type VPCCreateOptionsIPv6 struct {
71+
Range *string `json:"range,omitempty"`
72+
AllocationClass *string `json:"allocation_class,omitempty"`
5973
}
6074

6175
// VPCSubnetCreateOptions defines subnet options
@@ -66,6 +80,16 @@ type VPCSubnetCreateOptions struct {
6680
Label string `json:"label,omitempty"`
6781
// +optional
6882
IPv4 string `json:"ipv4,omitempty"`
83+
// +optional
84+
// IPv6 is a list of IPv6 ranges allocated to the subnet.
85+
// Once ranges are allocated based on the IPv6Range field, they will be
86+
// added to this field.
87+
IPv6 []linodego.VPCIPv6Range `json:"ipv6,omitempty"`
88+
// +optional
89+
// IPv6Range is a list of IPv6 ranges to allocate to the subnet.
90+
// If not specified, the subnet will not have an IPv6 range allocated.
91+
// Once ranges are allocated, they will be added to the IPv6 field.
92+
IPv6Range []VPCSubnetCreateOptionsIPv6 `json:"ipv6Range,omitempty"`
6993
// SubnetID is subnet id for the subnet
7094
// +optional
7195
SubnetID int `json:"subnetID,omitempty"`
@@ -74,11 +98,14 @@ type VPCSubnetCreateOptions struct {
7498
// +optional
7599
// +kubebuilder:default=false
76100
Retain bool `json:"retain,omitempty"`
77-
// +optional
78-
// +kubebuilder:validation:MinLength=2
79-
// +kubebuilder:validation:MaxLength=4
80-
// +kubebuilder:default="/56"
81-
IPv6Range string `json:"ipv6Range,omitempty"`
101+
}
102+
103+
// VPCSubnetCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC subnet.
104+
// Its copied from linodego.VPCSubnetCreateOptionsIPv6 and should be kept in sync.
105+
// Values supported by the linode API should be used here.
106+
// See https://techdocs.akamai.com/linode-api/reference/post-vpc-subnet for more details.
107+
type VPCSubnetCreateOptionsIPv6 struct {
108+
Range *string `json:"range,omitempty"`
82109
}
83110

84111
// LinodeVPCStatus defines the observed state of LinodeVPC

api/v1alpha2/zz_generated.deepcopy.go

Lines changed: 72 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,39 @@ spec:
6767
x-kubernetes-map-type: atomic
6868
description:
6969
type: string
70+
ipv6:
71+
description: |-
72+
IPv6 is a list of IPv6 ranges allocated to the VPC.
73+
Once ranges are allocated based on the IPv6Range field, they will be
74+
added to this field.
75+
items:
76+
description: VPCIPv6Range represents a single IPv6 range assigned
77+
to a VPC.
78+
properties:
79+
range:
80+
type: string
81+
required:
82+
- range
83+
type: object
84+
type: array
7085
ipv6Range:
71-
default: /52
72-
maxLength: 4
73-
minLength: 2
74-
type: string
75-
x-kubernetes-validations:
76-
- message: Value is immutable
77-
rule: self == oldSelf
86+
description: |-
87+
IPv6Range is a list of IPv6 ranges to allocate to the VPC.
88+
If not specified, the VPC will not have an IPv6 range allocated.
89+
Once ranges are allocated, they will be added to the IPv6 field.
90+
items:
91+
description: |-
92+
VPCCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC.
93+
Its copied from linodego.VPCCreateOptionsIPv6 and should be kept in sync.
94+
Values supported by the linode API should be used here.
95+
See https://techdocs.akamai.com/linode-api/reference/post-vpc for more details.
96+
properties:
97+
allocation_class:
98+
type: string
99+
range:
100+
type: string
101+
type: object
102+
type: array
78103
region:
79104
type: string
80105
x-kubernetes-validations:
@@ -94,11 +119,37 @@ spec:
94119
properties:
95120
ipv4:
96121
type: string
122+
ipv6:
123+
description: |-
124+
IPv6 is a list of IPv6 ranges allocated to the subnet.
125+
Once ranges are allocated based on the IPv6Range field, they will be
126+
added to this field.
127+
items:
128+
description: VPCIPv6Range represents a single IPv6 range assigned
129+
to a VPC.
130+
properties:
131+
range:
132+
type: string
133+
required:
134+
- range
135+
type: object
136+
type: array
97137
ipv6Range:
98-
default: /56
99-
maxLength: 4
100-
minLength: 2
101-
type: string
138+
description: |-
139+
IPv6Range is a list of IPv6 ranges to allocate to the subnet.
140+
If not specified, the subnet will not have an IPv6 range allocated.
141+
Once ranges are allocated, they will be added to the IPv6 field.
142+
items:
143+
description: |-
144+
VPCSubnetCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC subnet.
145+
Its copied from linodego.VPCSubnetCreateOptionsIPv6 and should be kept in sync.
146+
Values supported by the linode API should be used here.
147+
See https://techdocs.akamai.com/linode-api/reference/post-vpc-subnet for more details.
148+
properties:
149+
range:
150+
type: string
151+
type: object
152+
type: array
102153
label:
103154
maxLength: 63
104155
minLength: 3

docs/src/reference/out.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,10 +1078,11 @@ _Appears in:_
10781078
| `vpcID` _integer_ | | | |
10791079
| `description` _string_ | | | |
10801080
| `region` _string_ | | | |
1081+
| `ipv6` _VPCIPv6Range array_ | IPv6 is a list of IPv6 ranges allocated to the VPC.<br />Once ranges are allocated based on the IPv6Range field, they will be<br />added to this field. | | |
1082+
| `ipv6Range` _[VPCCreateOptionsIPv6](#vpccreateoptionsipv6) array_ | IPv6Range is a list of IPv6 ranges to allocate to the VPC.<br />If not specified, the VPC will not have an IPv6 range allocated.<br />Once ranges are allocated, they will be added to the IPv6 field. | | |
10811083
| `subnets` _[VPCSubnetCreateOptions](#vpcsubnetcreateoptions) array_ | | | |
10821084
| `retain` _boolean_ | Retain allows you to keep the VPC after the LinodeVPC object is deleted.<br />This is useful if you want to use an existing VPC that was not created by this controller.<br />If set to true, the controller will not delete the VPC resource in Linode.<br />Defaults to false. | false | |
10831085
| `credentialsRef` _[SecretReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#secretreference-v1-core)_ | CredentialsRef is a reference to a Secret that contains the credentials to use for provisioning this VPC. If not<br />supplied then the credentials of the controller will be used. | | |
1084-
| `ipv6Range` _string_ | | /52 | MaxLength: 4 <br />MinLength: 2 <br /> |
10851086

10861087

10871088
#### LinodeVPCStatus
@@ -1188,6 +1189,26 @@ _Appears in:_
11881189
| `credentialsRef` _[SecretReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#secretreference-v1-core)_ | CredentialsRef is a reference to a Secret that contains the credentials to use for accessing the Cluster Object Store. | | |
11891190

11901191

1192+
#### VPCCreateOptionsIPv6
1193+
1194+
1195+
1196+
VPCCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC.
1197+
Its copied from linodego.VPCCreateOptionsIPv6 and should be kept in sync.
1198+
Values supported by the linode API should be used here.
1199+
See https://techdocs.akamai.com/linode-api/reference/post-vpc for more details.
1200+
1201+
1202+
1203+
_Appears in:_
1204+
- [LinodeVPCSpec](#linodevpcspec)
1205+
1206+
| Field | Description | Default | Validation |
1207+
| --- | --- | --- | --- |
1208+
| `range` _string_ | | | |
1209+
| `allocation_class` _string_ | | | |
1210+
1211+
11911212
#### VPCIPv4
11921213

11931214

@@ -1238,8 +1259,28 @@ _Appears in:_
12381259
| --- | --- | --- | --- |
12391260
| `label` _string_ | | | MaxLength: 63 <br />MinLength: 3 <br /> |
12401261
| `ipv4` _string_ | | | |
1262+
| `ipv6` _VPCIPv6Range array_ | IPv6 is a list of IPv6 ranges allocated to the subnet.<br />Once ranges are allocated based on the IPv6Range field, they will be<br />added to this field. | | |
1263+
| `ipv6Range` _[VPCSubnetCreateOptionsIPv6](#vpcsubnetcreateoptionsipv6) array_ | IPv6Range is a list of IPv6 ranges to allocate to the subnet.<br />If not specified, the subnet will not have an IPv6 range allocated.<br />Once ranges are allocated, they will be added to the IPv6 field. | | |
12411264
| `subnetID` _integer_ | SubnetID is subnet id for the subnet | | |
12421265
| `retain` _boolean_ | Retain allows you to keep the Subnet after the LinodeVPC object is deleted.<br />This is only applicable when the parent VPC has retain set to true. | false | |
1243-
| `ipv6Range` _string_ | | /56 | MaxLength: 4 <br />MinLength: 2 <br /> |
1266+
1267+
1268+
#### VPCSubnetCreateOptionsIPv6
1269+
1270+
1271+
1272+
VPCSubnetCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC subnet.
1273+
Its copied from linodego.VPCSubnetCreateOptionsIPv6 and should be kept in sync.
1274+
Values supported by the linode API should be used here.
1275+
See https://techdocs.akamai.com/linode-api/reference/post-vpc-subnet for more details.
1276+
1277+
1278+
1279+
_Appears in:_
1280+
- [VPCSubnetCreateOptions](#vpcsubnetcreateoptions)
1281+
1282+
| Field | Description | Default | Validation |
1283+
| --- | --- | --- | --- |
1284+
| `range` _string_ | | | |
12441285

12451286

go.mod

Lines changed: 1 addition & 3 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.0
18+
github.com/linode/linodego v1.53.1-0.20250709175023-9b152d30578c
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
@@ -152,5 +152,3 @@ require (
152152
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
153153
sigs.k8s.io/yaml v1.4.0 // indirect
154154
)
155-
156-
replace github.com/linode/linodego => github.com/rahulait/linodego v1.50.1-0.20250708032219-cf7181d2963f

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +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=
180182
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
181183
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
182184
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
@@ -221,8 +223,6 @@ github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2
221223
github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8=
222224
github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
223225
github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
224-
github.com/rahulait/linodego v1.50.1-0.20250708032219-cf7181d2963f h1:16z+vd4lkTN/jDfZB5KpG0j2MM+Q6m/ZAb0EugSFuPU=
225-
github.com/rahulait/linodego v1.50.1-0.20250708032219-cf7181d2963f/go.mod h1:bI949fZaVchjWyKIA08hNyvAcV6BAS+PM2op3p7PAWA=
226226
github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
227227
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
228228
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=

0 commit comments

Comments
 (0)