Skip to content

Commit 05cd6ef

Browse files
authored
VPC: Extend VPC API's to support v2 Infra (#1875)
Extend the VPC API's to allow for quick support of the v2 (extended) Infrastructure management code path.
1 parent 74e35af commit 05cd6ef

6 files changed

+187
-20
lines changed

api/v1beta1/ibmvpc_conversion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,11 @@ func Convert_Slice_Pointer_v1beta2_IBMVPCResourceReference_To_Slice_Pointer_stri
223223
func Convert_v1beta2_VPCLoadBalancerSpec_To_v1beta1_VPCLoadBalancerSpec(in *infrav1beta2.VPCLoadBalancerSpec, out *VPCLoadBalancerSpec, s apiconversion.Scope) error {
224224
return autoConvert_v1beta2_VPCLoadBalancerSpec_To_v1beta1_VPCLoadBalancerSpec(in, out, s)
225225
}
226+
227+
func Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in *infrav1beta2.IBMVPCClusterSpec, out *IBMVPCClusterSpec, s apiconversion.Scope) error {
228+
return autoConvert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in, out, s)
229+
}
230+
231+
func Convert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in *infrav1beta2.IBMVPCClusterStatus, out *IBMVPCClusterStatus, s apiconversion.Scope) error {
232+
return autoConvert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in, out, s)
233+
}

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/ibmvpccluster_types.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ type IBMVPCClusterSpec struct {
5454
// ControlPlaneLoadBalancer is optional configuration for customizing control plane behavior.
5555
// +optional
5656
ControlPlaneLoadBalancer *VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"`
57+
58+
// network represents the VPC network to use for the cluster.
59+
// +optional
60+
Network *VPCNetworkSpec `json:"network,omitempty"`
5761
}
5862

5963
// VPCLoadBalancerSpec defines the desired state of an VPC load balancer.
@@ -94,6 +98,24 @@ type AdditionalListenerSpec struct {
9498
Port int64 `json:"port"`
9599
}
96100

101+
// VPCNetworkSpec defines the desired state of the network resources for the cluster.
102+
type VPCNetworkSpec struct {
103+
// workerSubnets is a set of Subnet's which define the Worker subnets.
104+
// +optional
105+
WorkerSubnets []Subnet `json:"workerSubnets,omitempty"`
106+
107+
// controlPlaneSubnets is a set of Subnet's which define the Control Plane subnets.
108+
// +optional
109+
ControlPlaneSubnets []Subnet `json:"controlPlaneSubnets,omitempty"`
110+
111+
// resourceGroup is the name of the Resource Group containing all of the newtork resources.
112+
// This can be different than the Resource Group containing the remaining cluster resources.
113+
// +optional
114+
ResourceGroup *string `json:"resourceGroup,omitempty"`
115+
116+
// TODO(cjschaef): Complete spec definition (SecurityGroups, VPC)
117+
}
118+
97119
// VPCSecurityGroupStatus defines a vpc security group resource status with its id and respective rule's ids.
98120
type VPCSecurityGroupStatus struct {
99121
// id represents the id of the resource.

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 39 additions & 0 deletions
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_ibmvpcclusters.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,59 @@ spec:
290290
private
291291
type: boolean
292292
type: object
293+
network:
294+
description: network represents the VPC network to use for the cluster.
295+
properties:
296+
controlPlaneSubnets:
297+
description: controlPlaneSubnets is a set of Subnet's which define
298+
the Control Plane subnets.
299+
items:
300+
description: Subnet describes a subnet.
301+
properties:
302+
cidr:
303+
type: string
304+
id:
305+
maxLength: 64
306+
minLength: 1
307+
pattern: ^[-0-9a-z_]+$
308+
type: string
309+
name:
310+
maxLength: 63
311+
minLength: 1
312+
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
313+
type: string
314+
zone:
315+
type: string
316+
type: object
317+
type: array
318+
resourceGroup:
319+
description: |-
320+
resourceGroup is the name of the Resource Group containing all of the newtork resources.
321+
This can be different than the Resource Group containing the remaining cluster resources.
322+
type: string
323+
workerSubnets:
324+
description: workerSubnets is a set of Subnet's which define the
325+
Worker subnets.
326+
items:
327+
description: Subnet describes a subnet.
328+
properties:
329+
cidr:
330+
type: string
331+
id:
332+
maxLength: 64
333+
minLength: 1
334+
pattern: ^[-0-9a-z_]+$
335+
type: string
336+
name:
337+
maxLength: 63
338+
minLength: 1
339+
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
340+
type: string
341+
zone:
342+
type: string
343+
type: object
344+
type: array
345+
type: object
293346
region:
294347
description: The IBM Cloud Region the cluster lives in.
295348
type: string

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,60 @@ spec:
139139
or private
140140
type: boolean
141141
type: object
142+
network:
143+
description: network represents the VPC network to use for
144+
the cluster.
145+
properties:
146+
controlPlaneSubnets:
147+
description: controlPlaneSubnets is a set of Subnet's
148+
which define the Control Plane subnets.
149+
items:
150+
description: Subnet describes a subnet.
151+
properties:
152+
cidr:
153+
type: string
154+
id:
155+
maxLength: 64
156+
minLength: 1
157+
pattern: ^[-0-9a-z_]+$
158+
type: string
159+
name:
160+
maxLength: 63
161+
minLength: 1
162+
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
163+
type: string
164+
zone:
165+
type: string
166+
type: object
167+
type: array
168+
resourceGroup:
169+
description: |-
170+
resourceGroup is the name of the Resource Group containing all of the newtork resources.
171+
This can be different than the Resource Group containing the remaining cluster resources.
172+
type: string
173+
workerSubnets:
174+
description: workerSubnets is a set of Subnet's which
175+
define the Worker subnets.
176+
items:
177+
description: Subnet describes a subnet.
178+
properties:
179+
cidr:
180+
type: string
181+
id:
182+
maxLength: 64
183+
minLength: 1
184+
pattern: ^[-0-9a-z_]+$
185+
type: string
186+
name:
187+
maxLength: 63
188+
minLength: 1
189+
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
190+
type: string
191+
zone:
192+
type: string
193+
type: object
194+
type: array
195+
type: object
142196
region:
143197
description: The IBM Cloud Region the cluster lives in.
144198
type: string

0 commit comments

Comments
 (0)