Skip to content

Commit 5f272fb

Browse files
committed
feat: support IPAM Manager for VPC IPv6 creation
1 parent f43a36b commit 5f272fb

11 files changed

+237
-37
lines changed

api/v1beta1/awscluster_conversion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ func (src *AWSCluster) ConvertTo(dstRaw conversion.Hub) error {
6262
restoreIPAMPool(restored.Spec.NetworkSpec.VPC.IPAMPool, dst.Spec.NetworkSpec.VPC.IPAMPool)
6363
}
6464

65+
if restored.Spec.NetworkSpec.VPC.IsIPv6Enabled() && restored.Spec.NetworkSpec.VPC.IPv6.IPAMPool != nil {
66+
if dst.Spec.NetworkSpec.VPC.IPv6.IPAMPool == nil {
67+
dst.Spec.NetworkSpec.VPC.IPv6.IPAMPool = &infrav2.IPAMPool{}
68+
}
69+
70+
restoreIPAMPool(restored.Spec.NetworkSpec.VPC.IPv6.IPAMPool, dst.Spec.NetworkSpec.VPC.IPv6.IPAMPool)
71+
}
72+
6573
return nil
6674
}
6775

api/v1beta1/conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,7 @@ func Convert_v1beta2_IngressRule_To_v1beta1_IngressRule(in *v1beta2.IngressRule,
8686
func Convert_v1beta2_VPCSpec_To_v1beta1_VPCSpec(in *v1beta2.VPCSpec, out *VPCSpec, s conversion.Scope) error {
8787
return autoConvert_v1beta2_VPCSpec_To_v1beta1_VPCSpec(in, out, s)
8888
}
89+
90+
func Convert_v1beta2_IPv6_To_v1beta1_IPv6(in *v1beta2.IPv6, out *IPv6, s conversion.Scope) error {
91+
return autoConvert_v1beta2_IPv6_To_v1beta1_IPv6(in, out, s)
92+
}

api/v1beta1/zz_generated.conversion.go

Lines changed: 24 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/network_types.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,24 @@ type NetworkSpec struct {
233233
// IPv6 contains ipv6 specific settings for the network.
234234
type IPv6 struct {
235235
// CidrBlock is the CIDR block provided by Amazon when VPC has enabled IPv6.
236+
// Mutually exclusive with IPAMPool.
236237
// +optional
237238
CidrBlock string `json:"cidrBlock,omitempty"`
238239

239240
// PoolID is the IP pool which must be defined in case of BYO IP is defined.
241+
// Must be specified if CidrBlock is set.
242+
// Mutually exclusive with IPAMPool.
240243
// +optional
241244
PoolID string `json:"poolId,omitempty"`
242245

243246
// EgressOnlyInternetGatewayID is the id of the egress only internet gateway associated with an IPv6 enabled VPC.
244247
// +optional
245248
EgressOnlyInternetGatewayID *string `json:"egressOnlyInternetGatewayId,omitempty"`
249+
250+
// IPAMPool defines the IPAMv6 pool to be used for VPC.
251+
// Mutually exclusive with CidrBlock.
252+
// +optional
253+
IPAMPool *IPAMPool `json:"ipamPool,omitempty"`
246254
}
247255

248256
// IPAMPool defines the IPAM pool to be used for VPC.
@@ -264,9 +272,11 @@ type VPCSpec struct {
264272

265273
// CidrBlock is the CIDR block to be used when the provider creates a managed VPC.
266274
// Defaults to 10.0.0.0/16.
275+
// Mutually exclusive with IPAMPool.
267276
CidrBlock string `json:"cidrBlock,omitempty"`
268277

269-
// IPAMPool defines the IPAM pool to be used for VPC.
278+
// IPAMPool defines the IPAMv4 pool to be used for VPC.
279+
// Mutually exclusive with CidrBlock.
270280
IPAMPool *IPAMPool `json:"ipamPool,omitempty"`
271281

272282
// IPv6 contains ipv6 specific settings for the network. Supported only in managed clusters.

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 52 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ spec:
483483
cidrBlock:
484484
description: CidrBlock is the CIDR block to be used when the
485485
provider creates a managed VPC. Defaults to 10.0.0.0/16.
486+
Mutually exclusive with IPAMPool.
486487
type: string
487488
id:
488489
description: ID is the vpc-id of the VPC this provider should
@@ -493,8 +494,8 @@ spec:
493494
associated with the VPC.
494495
type: string
495496
ipamPool:
496-
description: IPAMPool defines the IPAM pool to be used for
497-
VPC.
497+
description: IPAMPool defines the IPAMv4 pool to be used for
498+
VPC. Mutually exclusive with CidrBlock.
498499
properties:
499500
id:
500501
description: ID is the ID of the IPAM pool this provider
@@ -518,16 +519,37 @@ spec:
518519
properties:
519520
cidrBlock:
520521
description: CidrBlock is the CIDR block provided by Amazon
521-
when VPC has enabled IPv6.
522+
when VPC has enabled IPv6. Mutually exclusive with IPAMPool.
522523
type: string
523524
egressOnlyInternetGatewayId:
524525
description: EgressOnlyInternetGatewayID is the id of
525526
the egress only internet gateway associated with an
526527
IPv6 enabled VPC.
527528
type: string
529+
ipamPool:
530+
description: IPAMPool defines the IPAMv6 pool to be used
531+
for VPC. Mutually exclusive with CidrBlock.
532+
properties:
533+
id:
534+
description: ID is the ID of the IPAM pool this provider
535+
should use to create VPC.
536+
type: string
537+
name:
538+
description: Name is the name of the IPAM pool this
539+
provider should use to create VPC.
540+
type: string
541+
netmaskLength:
542+
description: The netmask length of the IPv4 CIDR you
543+
want to allocate to VPC from an Amazon VPC IP Address
544+
Manager (IPAM) pool. Defaults to /16 for IPv4 if
545+
not specified.
546+
format: int64
547+
type: integer
548+
type: object
528549
poolId:
529550
description: PoolID is the IP pool which must be defined
530-
in case of BYO IP is defined.
551+
in case of BYO IP is defined. Must be specified if CidrBlock
552+
is set. Mutually exclusive with IPAMPool.
531553
type: string
532554
type: object
533555
tags:
@@ -1950,6 +1972,7 @@ spec:
19501972
cidrBlock:
19511973
description: CidrBlock is the CIDR block to be used when the
19521974
provider creates a managed VPC. Defaults to 10.0.0.0/16.
1975+
Mutually exclusive with IPAMPool.
19531976
type: string
19541977
id:
19551978
description: ID is the vpc-id of the VPC this provider should
@@ -1960,8 +1983,8 @@ spec:
19601983
associated with the VPC.
19611984
type: string
19621985
ipamPool:
1963-
description: IPAMPool defines the IPAM pool to be used for
1964-
VPC.
1986+
description: IPAMPool defines the IPAMv4 pool to be used for
1987+
VPC. Mutually exclusive with CidrBlock.
19651988
properties:
19661989
id:
19671990
description: ID is the ID of the IPAM pool this provider
@@ -1985,16 +2008,37 @@ spec:
19852008
properties:
19862009
cidrBlock:
19872010
description: CidrBlock is the CIDR block provided by Amazon
1988-
when VPC has enabled IPv6.
2011+
when VPC has enabled IPv6. Mutually exclusive with IPAMPool.
19892012
type: string
19902013
egressOnlyInternetGatewayId:
19912014
description: EgressOnlyInternetGatewayID is the id of
19922015
the egress only internet gateway associated with an
19932016
IPv6 enabled VPC.
19942017
type: string
2018+
ipamPool:
2019+
description: IPAMPool defines the IPAMv6 pool to be used
2020+
for VPC. Mutually exclusive with CidrBlock.
2021+
properties:
2022+
id:
2023+
description: ID is the ID of the IPAM pool this provider
2024+
should use to create VPC.
2025+
type: string
2026+
name:
2027+
description: Name is the name of the IPAM pool this
2028+
provider should use to create VPC.
2029+
type: string
2030+
netmaskLength:
2031+
description: The netmask length of the IPv4 CIDR you
2032+
want to allocate to VPC from an Amazon VPC IP Address
2033+
Manager (IPAM) pool. Defaults to /16 for IPv4 if
2034+
not specified.
2035+
format: int64
2036+
type: integer
2037+
type: object
19952038
poolId:
19962039
description: PoolID is the IP pool which must be defined
1997-
in case of BYO IP is defined.
2040+
in case of BYO IP is defined. Must be specified if CidrBlock
2041+
is set. Mutually exclusive with IPAMPool.
19982042
type: string
19992043
type: object
20002044
tags:

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

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@ spec:
12861286
cidrBlock:
12871287
description: CidrBlock is the CIDR block to be used when the
12881288
provider creates a managed VPC. Defaults to 10.0.0.0/16.
1289+
Mutually exclusive with IPAMPool.
12891290
type: string
12901291
id:
12911292
description: ID is the vpc-id of the VPC this provider should
@@ -1296,8 +1297,8 @@ spec:
12961297
associated with the VPC.
12971298
type: string
12981299
ipamPool:
1299-
description: IPAMPool defines the IPAM pool to be used for
1300-
VPC.
1300+
description: IPAMPool defines the IPAMv4 pool to be used for
1301+
VPC. Mutually exclusive with CidrBlock.
13011302
properties:
13021303
id:
13031304
description: ID is the ID of the IPAM pool this provider
@@ -1321,16 +1322,37 @@ spec:
13211322
properties:
13221323
cidrBlock:
13231324
description: CidrBlock is the CIDR block provided by Amazon
1324-
when VPC has enabled IPv6.
1325+
when VPC has enabled IPv6. Mutually exclusive with IPAMPool.
13251326
type: string
13261327
egressOnlyInternetGatewayId:
13271328
description: EgressOnlyInternetGatewayID is the id of
13281329
the egress only internet gateway associated with an
13291330
IPv6 enabled VPC.
13301331
type: string
1332+
ipamPool:
1333+
description: IPAMPool defines the IPAMv6 pool to be used
1334+
for VPC. Mutually exclusive with CidrBlock.
1335+
properties:
1336+
id:
1337+
description: ID is the ID of the IPAM pool this provider
1338+
should use to create VPC.
1339+
type: string
1340+
name:
1341+
description: Name is the name of the IPAM pool this
1342+
provider should use to create VPC.
1343+
type: string
1344+
netmaskLength:
1345+
description: The netmask length of the IPv4 CIDR you
1346+
want to allocate to VPC from an Amazon VPC IP Address
1347+
Manager (IPAM) pool. Defaults to /16 for IPv4 if
1348+
not specified.
1349+
format: int64
1350+
type: integer
1351+
type: object
13311352
poolId:
13321353
description: PoolID is the IP pool which must be defined
1333-
in case of BYO IP is defined.
1354+
in case of BYO IP is defined. Must be specified if CidrBlock
1355+
is set. Mutually exclusive with IPAMPool.
13341356
type: string
13351357
type: object
13361358
tags:

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

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ spec:
892892
cidrBlock:
893893
description: CidrBlock is the CIDR block to be used
894894
when the provider creates a managed VPC. Defaults
895-
to 10.0.0.0/16.
895+
to 10.0.0.0/16. Mutually exclusive with IPAMPool.
896896
type: string
897897
id:
898898
description: ID is the vpc-id of the VPC this provider
@@ -903,8 +903,8 @@ spec:
903903
gateway associated with the VPC.
904904
type: string
905905
ipamPool:
906-
description: IPAMPool defines the IPAM pool to be
907-
used for VPC.
906+
description: IPAMPool defines the IPAMv4 pool to be
907+
used for VPC. Mutually exclusive with CidrBlock.
908908
properties:
909909
id:
910910
description: ID is the ID of the IPAM pool this
@@ -929,16 +929,41 @@ spec:
929929
properties:
930930
cidrBlock:
931931
description: CidrBlock is the CIDR block provided
932-
by Amazon when VPC has enabled IPv6.
932+
by Amazon when VPC has enabled IPv6. Mutually
933+
exclusive with IPAMPool.
933934
type: string
934935
egressOnlyInternetGatewayId:
935936
description: EgressOnlyInternetGatewayID is the
936937
id of the egress only internet gateway associated
937938
with an IPv6 enabled VPC.
938939
type: string
940+
ipamPool:
941+
description: IPAMPool defines the IPAMv6 pool
942+
to be used for VPC. Mutually exclusive with
943+
CidrBlock.
944+
properties:
945+
id:
946+
description: ID is the ID of the IPAM pool
947+
this provider should use to create VPC.
948+
type: string
949+
name:
950+
description: Name is the name of the IPAM
951+
pool this provider should use to create
952+
VPC.
953+
type: string
954+
netmaskLength:
955+
description: The netmask length of the IPv4
956+
CIDR you want to allocate to VPC from an
957+
Amazon VPC IP Address Manager (IPAM) pool.
958+
Defaults to /16 for IPv4 if not specified.
959+
format: int64
960+
type: integer
961+
type: object
939962
poolId:
940963
description: PoolID is the IP pool which must
941-
be defined in case of BYO IP is defined.
964+
be defined in case of BYO IP is defined. Must
965+
be specified if CidrBlock is set. Mutually exclusive
966+
with IPAMPool.
942967
type: string
943968
type: object
944969
tags:

0 commit comments

Comments
 (0)