Skip to content

Commit 65c176d

Browse files
committed
validations: allow IPv6 configurations for unmanaged clusters
(AWSCluster resource)
1 parent 66d14e5 commit 65c176d

7 files changed

+33
-54
lines changed

api/v1beta1/network_types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ type SubnetSpec struct {
249249

250250
// IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
251251
// A subnet can have an IPv4 and an IPv6 address.
252-
// IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
253252
// +optional
254253
IPv6CidrBlock string `json:"ipv6CidrBlock,omitempty"`
255254

@@ -261,7 +260,6 @@ type SubnetSpec struct {
261260
IsPublic bool `json:"isPublic"`
262261

263262
// IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
264-
// IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
265263
// +optional
266264
IsIPv6 bool `json:"isIpv6,omitempty"`
267265

api/v1beta2/awscluster_webhook.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,7 @@ func (r *AWSCluster) validateSSHKeyName() field.ErrorList {
301301

302302
func (r *AWSCluster) validateNetwork() field.ErrorList {
303303
var allErrs field.ErrorList
304-
if r.Spec.NetworkSpec.VPC.IsIPv6Enabled() {
305-
allErrs = append(allErrs, field.Invalid(field.NewPath("ipv6"), r.Spec.NetworkSpec.VPC.IPv6, "IPv6 cannot be used with unmanaged clusters at this time."))
306-
}
307304
for _, subnet := range r.Spec.NetworkSpec.Subnets {
308-
if subnet.IsIPv6 || subnet.IPv6CidrBlock != "" {
309-
allErrs = append(allErrs, field.Invalid(field.NewPath("subnets"), r.Spec.NetworkSpec.Subnets, "IPv6 cannot be used with unmanaged clusters at this time."))
310-
}
311305
if subnet.ZoneType != nil && subnet.IsEdge() {
312306
if subnet.ParentZoneName == nil {
313307
allErrs = append(allErrs, field.Invalid(field.NewPath("subnets"), r.Spec.NetworkSpec.Subnets, "ParentZoneName must be set when ZoneType is 'local-zone'."))

api/v1beta2/awscluster_webhook_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ func TestAWSClusterValidateCreate(t *testing.T) {
324324
wantErr: false,
325325
},
326326
{
327-
name: "rejects ipv6",
327+
name: "accepts ipv6",
328328
cluster: &AWSCluster{
329329
Spec: AWSClusterSpec{
330330
NetworkSpec: NetworkSpec{
@@ -337,10 +337,10 @@ func TestAWSClusterValidateCreate(t *testing.T) {
337337
},
338338
},
339339
},
340-
wantErr: true,
340+
wantErr: false,
341341
},
342342
{
343-
name: "rejects ipv6 enabled subnet",
343+
name: "accepts ipv6 enabled subnet",
344344
cluster: &AWSCluster{
345345
Spec: AWSClusterSpec{
346346
NetworkSpec: NetworkSpec{
@@ -356,10 +356,10 @@ func TestAWSClusterValidateCreate(t *testing.T) {
356356
},
357357
},
358358
},
359-
wantErr: true,
359+
wantErr: false,
360360
},
361361
{
362-
name: "rejects ipv6 cidr block for subnets",
362+
name: "accepts ipv6 cidr block for subnets",
363363
cluster: &AWSCluster{
364364
Spec: AWSClusterSpec{
365365
NetworkSpec: NetworkSpec{
@@ -372,7 +372,7 @@ func TestAWSClusterValidateCreate(t *testing.T) {
372372
},
373373
},
374374
},
375-
wantErr: true,
375+
wantErr: false,
376376
},
377377
{
378378
name: "rejects ingress rules with cidr block and source security group id",

api/v1beta2/network_types.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,7 @@ type VPCSpec struct {
432432
// Mutually exclusive with CidrBlock.
433433
IPAMPool *IPAMPool `json:"ipamPool,omitempty"`
434434

435-
// IPv6 contains ipv6 specific settings for the network. Supported only in managed clusters.
436-
// This field cannot be set on AWSCluster object.
435+
// IPv6 contains ipv6 specific settings for the network.
437436
// +optional
438437
IPv6 *IPv6 `json:"ipv6,omitempty"`
439438

@@ -561,7 +560,6 @@ type SubnetSpec struct {
561560

562561
// IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
563562
// A subnet can have an IPv4 and an IPv6 address.
564-
// IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
565563
// +optional
566564
IPv6CidrBlock string `json:"ipv6CidrBlock,omitempty"`
567565

@@ -573,7 +571,6 @@ type SubnetSpec struct {
573571
IsPublic bool `json:"isPublic"`
574572

575573
// IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
576-
// IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
577574
// +optional
578575
IsIPv6 bool `json:"isIpv6,omitempty"`
579576

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,11 @@ spec:
594594
description: |-
595595
IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
596596
A subnet can have an IPv4 and an IPv6 address.
597-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
598597
type: string
599598
isIpv6:
600-
description: |-
601-
IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
602-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
599+
description: IsIPv6 defines the subnet as an IPv6 subnet.
600+
A subnet is IPv6 when it is associated with a VPC that
601+
has IPv6 enabled.
603602
type: boolean
604603
isPublic:
605604
description: IsPublic defines the subnet as a public subnet.
@@ -780,9 +779,8 @@ spec:
780779
type: integer
781780
type: object
782781
ipv6:
783-
description: |-
784-
IPv6 contains ipv6 specific settings for the network. Supported only in managed clusters.
785-
This field cannot be set on AWSCluster object.
782+
description: IPv6 contains ipv6 specific settings for the
783+
network.
786784
properties:
787785
cidrBlock:
788786
description: |-
@@ -2766,12 +2764,11 @@ spec:
27662764
description: |-
27672765
IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
27682766
A subnet can have an IPv4 and an IPv6 address.
2769-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
27702767
type: string
27712768
isIpv6:
2772-
description: |-
2773-
IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
2774-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
2769+
description: IsIPv6 defines the subnet as an IPv6 subnet.
2770+
A subnet is IPv6 when it is associated with a VPC that
2771+
has IPv6 enabled.
27752772
type: boolean
27762773
isPublic:
27772774
description: IsPublic defines the subnet as a public subnet.
@@ -2952,9 +2949,8 @@ spec:
29522949
type: integer
29532950
type: object
29542951
ipv6:
2955-
description: |-
2956-
IPv6 contains ipv6 specific settings for the network. Supported only in managed clusters.
2957-
This field cannot be set on AWSCluster object.
2952+
description: IPv6 contains ipv6 specific settings for the
2953+
network.
29582954
properties:
29592955
cidrBlock:
29602956
description: |-

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,11 @@ spec:
284284
description: |-
285285
IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
286286
A subnet can have an IPv4 and an IPv6 address.
287-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
288287
type: string
289288
isIpv6:
290-
description: |-
291-
IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
292-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
289+
description: IsIPv6 defines the subnet as an IPv6 subnet.
290+
A subnet is IPv6 when it is associated with a VPC that
291+
has IPv6 enabled.
293292
type: boolean
294293
isPublic:
295294
description: IsPublic defines the subnet as a public subnet.
@@ -1546,12 +1545,11 @@ spec:
15461545
description: |-
15471546
IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
15481547
A subnet can have an IPv4 and an IPv6 address.
1549-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
15501548
type: string
15511549
isIpv6:
1552-
description: |-
1553-
IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
1554-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
1550+
description: IsIPv6 defines the subnet as an IPv6 subnet.
1551+
A subnet is IPv6 when it is associated with a VPC that
1552+
has IPv6 enabled.
15551553
type: boolean
15561554
isPublic:
15571555
description: IsPublic defines the subnet as a public subnet.
@@ -1732,9 +1730,8 @@ spec:
17321730
type: integer
17331731
type: object
17341732
ipv6:
1735-
description: |-
1736-
IPv6 contains ipv6 specific settings for the network. Supported only in managed clusters.
1737-
This field cannot be set on AWSCluster object.
1733+
description: IPv6 contains ipv6 specific settings for the
1734+
network.
17381735
properties:
17391736
cidrBlock:
17401737
description: |-

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,11 @@ spec:
303303
description: |-
304304
IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
305305
A subnet can have an IPv4 and an IPv6 address.
306-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
307306
type: string
308307
isIpv6:
309-
description: |-
310-
IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
311-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
308+
description: IsIPv6 defines the subnet as an IPv6
309+
subnet. A subnet is IPv6 when it is associated
310+
with a VPC that has IPv6 enabled.
312311
type: boolean
313312
isPublic:
314313
description: IsPublic defines the subnet as a public
@@ -1133,12 +1132,11 @@ spec:
11331132
description: |-
11341133
IPv6CidrBlock is the IPv6 CIDR block to be used when the provider creates a managed VPC.
11351134
A subnet can have an IPv4 and an IPv6 address.
1136-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
11371135
type: string
11381136
isIpv6:
1139-
description: |-
1140-
IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
1141-
IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
1137+
description: IsIPv6 defines the subnet as an IPv6
1138+
subnet. A subnet is IPv6 when it is associated
1139+
with a VPC that has IPv6 enabled.
11421140
type: boolean
11431141
isPublic:
11441142
description: IsPublic defines the subnet as a public
@@ -1320,9 +1318,8 @@ spec:
13201318
type: integer
13211319
type: object
13221320
ipv6:
1323-
description: |-
1324-
IPv6 contains ipv6 specific settings for the network. Supported only in managed clusters.
1325-
This field cannot be set on AWSCluster object.
1321+
description: IPv6 contains ipv6 specific settings
1322+
for the network.
13261323
properties:
13271324
cidrBlock:
13281325
description: |-

0 commit comments

Comments
 (0)