Skip to content

Commit 87dd5eb

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 d9b1313 commit 87dd5eb

File tree

9 files changed

+328
-77
lines changed

9 files changed

+328
-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,18 +37,31 @@ 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
// CredentialsRef is a reference to a Secret that contains the credentials to use for provisioning this VPC. If not
4253
// supplied then the credentials of the controller will be used.
4354
// +optional
4455
CredentialsRef *corev1.SecretReference `json:"credentialsRef,omitempty"`
45-
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
46-
// +optional
47-
// +kubebuilder:validation:MinLength=2
48-
// +kubebuilder:validation:MaxLength=4
49-
// +kubebuilder:default="/52"
50-
IPv6Range string `json:"ipv6Range,omitempty"`
56+
}
57+
58+
// VPCCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC.
59+
// Its copied from linodego.VPCCreateOptionsIPv6 and should be kept in sync.
60+
// Values supported by the linode API should be used here.
61+
// See https://techdocs.akamai.com/linode-api/reference/post-vpc for more details.
62+
type VPCCreateOptionsIPv6 struct {
63+
Range *string `json:"range,omitempty"`
64+
AllocationClass *string `json:"allocation_class,omitempty"`
5165
}
5266

5367
// VPCSubnetCreateOptions defines subnet options
@@ -58,14 +72,27 @@ type VPCSubnetCreateOptions struct {
5872
Label string `json:"label,omitempty"`
5973
// +optional
6074
IPv4 string `json:"ipv4,omitempty"`
75+
// +optional
76+
// IPv6 is a list of IPv6 ranges allocated to the subnet.
77+
// Once ranges are allocated based on the IPv6Range field, they will be
78+
// added to this field.
79+
IPv6 []linodego.VPCIPv6Range `json:"ipv6,omitempty"`
80+
// +optional
81+
// IPv6Range is a list of IPv6 ranges to allocate to the subnet.
82+
// If not specified, the subnet will not have an IPv6 range allocated.
83+
// Once ranges are allocated, they will be added to the IPv6 field.
84+
IPv6Range []VPCSubnetCreateOptionsIPv6 `json:"ipv6Range,omitempty"`
6185
// SubnetID is subnet id for the subnet
6286
// +optional
6387
SubnetID int `json:"subnetID,omitempty"`
64-
// +optional
65-
// +kubebuilder:validation:MinLength=2
66-
// +kubebuilder:validation:MaxLength=4
67-
// +kubebuilder:default="/56"
68-
IPv6Range string `json:"ipv6Range,omitempty"`
88+
}
89+
90+
// VPCSubnetCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC subnet.
91+
// Its copied from linodego.VPCSubnetCreateOptionsIPv6 and should be kept in sync.
92+
// Values supported by the linode API should be used here.
93+
// See https://techdocs.akamai.com/linode-api/reference/post-vpc-subnet for more details.
94+
type VPCSubnetCreateOptionsIPv6 struct {
95+
Range *string `json:"range,omitempty"`
6996
}
7097

7198
// 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:
@@ -86,11 +111,37 @@ spec:
86111
properties:
87112
ipv4:
88113
type: string
114+
ipv6:
115+
description: |-
116+
IPv6 is a list of IPv6 ranges allocated to the subnet.
117+
Once ranges are allocated based on the IPv6Range field, they will be
118+
added to this field.
119+
items:
120+
description: VPCIPv6Range represents a single IPv6 range assigned
121+
to a VPC.
122+
properties:
123+
range:
124+
type: string
125+
required:
126+
- range
127+
type: object
128+
type: array
89129
ipv6Range:
90-
default: /56
91-
maxLength: 4
92-
minLength: 2
93-
type: string
130+
description: |-
131+
IPv6Range is a list of IPv6 ranges to allocate to the subnet.
132+
If not specified, the subnet will not have an IPv6 range allocated.
133+
Once ranges are allocated, they will be added to the IPv6 field.
134+
items:
135+
description: |-
136+
VPCSubnetCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC subnet.
137+
Its copied from linodego.VPCSubnetCreateOptionsIPv6 and should be kept in sync.
138+
Values supported by the linode API should be used here.
139+
See https://techdocs.akamai.com/linode-api/reference/post-vpc-subnet for more details.
140+
properties:
141+
range:
142+
type: string
143+
type: object
144+
type: array
94145
label:
95146
maxLength: 63
96147
minLength: 3

docs/src/reference/out.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,9 +1078,10 @@ _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
| `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. | | |
1083-
| `ipv6Range` _string_ | | /52 | MaxLength: 4 <br />MinLength: 2 <br /> |
10841085

10851086

10861087
#### LinodeVPCStatus
@@ -1187,6 +1188,26 @@ _Appears in:_
11871188
| `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. | | |
11881189

11891190

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

11921213

@@ -1237,7 +1258,27 @@ _Appears in:_
12371258
| --- | --- | --- | --- |
12381259
| `label` _string_ | | | MaxLength: 63 <br />MinLength: 3 <br /> |
12391260
| `ipv4` _string_ | | | |
1261+
| `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. | | |
1262+
| `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. | | |
12401263
| `subnetID` _integer_ | SubnetID is subnet id for the subnet | | |
1241-
| `ipv6Range` _string_ | | /56 | MaxLength: 4 <br />MinLength: 2 <br /> |
1264+
1265+
1266+
#### VPCSubnetCreateOptionsIPv6
1267+
1268+
1269+
1270+
VPCSubnetCreateOptionsIPv6 defines the options for creating an IPv6 range in a VPC subnet.
1271+
Its copied from linodego.VPCSubnetCreateOptionsIPv6 and should be kept in sync.
1272+
Values supported by the linode API should be used here.
1273+
See https://techdocs.akamai.com/linode-api/reference/post-vpc-subnet for more details.
1274+
1275+
1276+
1277+
_Appears in:_
1278+
- [VPCSubnetCreateOptions](#vpcsubnetcreateoptions)
1279+
1280+
| Field | Description | Default | Validation |
1281+
| --- | --- | --- | --- |
1282+
| `range` _string_ | | | |
12421283

12431284

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.52.2
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)