Skip to content

Commit

Permalink
VPC: Extend VPC API's to support v2 Infra (#1875)
Browse files Browse the repository at this point in the history
Extend the VPC API's to allow for quick support of
the v2 (extended) Infrastructure management code path.
  • Loading branch information
cjschaef authored Jul 12, 2024
1 parent 74e35af commit 05cd6ef
Show file tree
Hide file tree
Showing 6 changed files with 187 additions and 20 deletions.
8 changes: 8 additions & 0 deletions api/v1beta1/ibmvpc_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,11 @@ func Convert_Slice_Pointer_v1beta2_IBMVPCResourceReference_To_Slice_Pointer_stri
func Convert_v1beta2_VPCLoadBalancerSpec_To_v1beta1_VPCLoadBalancerSpec(in *infrav1beta2.VPCLoadBalancerSpec, out *VPCLoadBalancerSpec, s apiconversion.Scope) error {
return autoConvert_v1beta2_VPCLoadBalancerSpec_To_v1beta1_VPCLoadBalancerSpec(in, out, s)
}

func Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in *infrav1beta2.IBMVPCClusterSpec, out *IBMVPCClusterSpec, s apiconversion.Scope) error {
return autoConvert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in, out, s)
}

func Convert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in *infrav1beta2.IBMVPCClusterStatus, out *IBMVPCClusterStatus, s apiconversion.Scope) error {
return autoConvert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in, out, s)
}
31 changes: 11 additions & 20 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions api/v1beta2/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ type IBMVPCClusterSpec struct {
// ControlPlaneLoadBalancer is optional configuration for customizing control plane behavior.
// +optional
ControlPlaneLoadBalancer *VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"`

// network represents the VPC network to use for the cluster.
// +optional
Network *VPCNetworkSpec `json:"network,omitempty"`
}

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

// VPCNetworkSpec defines the desired state of the network resources for the cluster.
type VPCNetworkSpec struct {
// workerSubnets is a set of Subnet's which define the Worker subnets.
// +optional
WorkerSubnets []Subnet `json:"workerSubnets,omitempty"`

// controlPlaneSubnets is a set of Subnet's which define the Control Plane subnets.
// +optional
ControlPlaneSubnets []Subnet `json:"controlPlaneSubnets,omitempty"`

// resourceGroup is the name of the Resource Group containing all of the newtork resources.
// This can be different than the Resource Group containing the remaining cluster resources.
// +optional
ResourceGroup *string `json:"resourceGroup,omitempty"`

// TODO(cjschaef): Complete spec definition (SecurityGroups, VPC)
}

// VPCSecurityGroupStatus defines a vpc security group resource status with its id and respective rule's ids.
type VPCSecurityGroupStatus struct {
// id represents the id of the resource.
Expand Down
39 changes: 39 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,59 @@ spec:
private
type: boolean
type: object
network:
description: network represents the VPC network to use for the cluster.
properties:
controlPlaneSubnets:
description: controlPlaneSubnets is a set of Subnet's which define
the Control Plane subnets.
items:
description: Subnet describes a subnet.
properties:
cidr:
type: string
id:
maxLength: 64
minLength: 1
pattern: ^[-0-9a-z_]+$
type: string
name:
maxLength: 63
minLength: 1
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
zone:
type: string
type: object
type: array
resourceGroup:
description: |-
resourceGroup is the name of the Resource Group containing all of the newtork resources.
This can be different than the Resource Group containing the remaining cluster resources.
type: string
workerSubnets:
description: workerSubnets is a set of Subnet's which define the
Worker subnets.
items:
description: Subnet describes a subnet.
properties:
cidr:
type: string
id:
maxLength: 64
minLength: 1
pattern: ^[-0-9a-z_]+$
type: string
name:
maxLength: 63
minLength: 1
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
zone:
type: string
type: object
type: array
type: object
region:
description: The IBM Cloud Region the cluster lives in.
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,60 @@ spec:
or private
type: boolean
type: object
network:
description: network represents the VPC network to use for
the cluster.
properties:
controlPlaneSubnets:
description: controlPlaneSubnets is a set of Subnet's
which define the Control Plane subnets.
items:
description: Subnet describes a subnet.
properties:
cidr:
type: string
id:
maxLength: 64
minLength: 1
pattern: ^[-0-9a-z_]+$
type: string
name:
maxLength: 63
minLength: 1
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
zone:
type: string
type: object
type: array
resourceGroup:
description: |-
resourceGroup is the name of the Resource Group containing all of the newtork resources.
This can be different than the Resource Group containing the remaining cluster resources.
type: string
workerSubnets:
description: workerSubnets is a set of Subnet's which
define the Worker subnets.
items:
description: Subnet describes a subnet.
properties:
cidr:
type: string
id:
maxLength: 64
minLength: 1
pattern: ^[-0-9a-z_]+$
type: string
name:
maxLength: 63
minLength: 1
pattern: ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
type: string
zone:
type: string
type: object
type: array
type: object
region:
description: The IBM Cloud Region the cluster lives in.
type: string
Expand Down

0 comments on commit 05cd6ef

Please sign in to comment.