Skip to content

Commit

Permalink
VPC: VPCCluster definition extension
Browse files Browse the repository at this point in the history
Extend the VPCCluster definition to include additional
VPC resources and expand configuration options.
  • Loading branch information
cjschaef committed Mar 27, 2024
1 parent ff8b672 commit 33d3af9
Show file tree
Hide file tree
Showing 6 changed files with 711 additions and 44 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)
}
46 changes: 21 additions & 25 deletions api/v1beta1/zz_generated.conversion.go

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

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

// cosInstance is the IBM COS instance to use for cluster resources.
// +optional
COSInstance *COSInstance `json:"cosInstance,omitempty"`

// loadBalancers is a set of VPC Load Balancers definition to use for the cluster.
// +optional
LoadBalancers []*VPCLoadBalancerSpec `json:"loadbalancers,omitempty"`

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

// VPCLoadBalancerSpec defines the desired state of an VPC load balancer.
Expand Down Expand Up @@ -103,25 +115,111 @@ type VPCLoadBalancerStatus struct {
ControllerCreated *bool `json:"controllerCreated,omitempty"`
}

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

// controlPlaneSubnetsSpec is a set of Subnet's which define the Control Plane subnets.
ControlPlaneSubnetsSpec []Subnet `json:"controlPlaneSubentsSpec,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.
ResourceGroup *string `json:"resourceGroup,omitempty"`

// securityGroups is a set of SecurityGroup's which define the VPC Security Groups that manage traffic within and out of the VPC.
SecurityGroups []SecurityGroup `json:"securityGroups,omitempty"`

// vpc defines the IBM Cloud VPC.
VPC *VPCResource `json:"vpc,omitempty"`
}

// SecurityGroup dummy.
// TODO(cjschaef): Dummy SecurityGroup until it is defined in a common location.
type SecurityGroup struct {
Name string `json:"name"`
}

// COSInstance dummy.
// TODO(cjschaef): Dummy COSInstance until it is defined in a common location.
type COSInstance struct {
Name string `json:"name"`
}

// VPCResource dummy.
// TODO(cjschaef): Dummy VPCResource until it is defined in a common location.
type VPCResource struct {
Name string `json:"name"`
}

// IBMVPCClusterStatus defines the observed state of IBMVPCCluster.
type IBMVPCClusterStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
VPC VPC `json:"vpc,omitempty"`

// Ready is true when the provider resource is ready.
// Conditions defines current service state of the load balancer.
// +optional
Ready bool `json:"ready"`
Subnet Subnet `json:"subnet,omitempty"`
VPCEndpoint VPCEndpoint `json:"vpcEndpoint,omitempty"`
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`

// ControlPlaneLoadBalancerState is the status of the load balancer.
// dep: rely on NetworkStatus instead.
// +optional
ControlPlaneLoadBalancerState VPCLoadBalancerState `json:"controlPlaneLoadBalancerState,omitempty"`

// Conditions defines current service state of the load balancer.
// COSInstance is the reference to the IBM Cloud COS Instance used for the cluster.
COSInstance *ResourceReference `json:"cosInstance,omitempty"`

// networkStatus is the status of the VPC network in its entirety resources.
NetworkStatus *VPCNetworkStatus `json:"networkStatus,omitempty"`

// ready is true when the provider resource is ready.
// +kubebuilder:default=false
Ready bool `json:"ready"`

// resourceGroup is the reference to the IBM Cloud VPC resource group under which the resources will be created.
ResourceGroup *ResourceReference `json:"resourceGroupID,omitempty"`

// dep: rely on NetworkStatus instead.
Subnet Subnet `json:"subnet,omitempty"`

// dep: rely on NetworkStatus instead.
VPC VPC `json:"vpc,omitempty"`

// dep: rely on ControlPlaneEndpoint
VPCEndpoint VPCEndpoint `json:"vpcEndpoint,omitempty"`
}

// VPCNetworkStatus provides details on the status of VPC network resources.
type VPCNetworkStatus struct {
// computeSubnets references the VPC Subnets for the cluster's Data Plane.
// +optional
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
ComputeSubnets []*VPCResourceStatus `json:"computeSubnets,omitempty"`

// controlPlaneSubnets references the VPC Subnets for the cluster's Control Plane.
// +optional
ControlPlaneSubnets []*VPCResourceStatus `json:"controlPlaneSubnets,omitempty"`

// loadBalancers references the VPC Load Balancer's for the cluster.
// +optional
LoadBalancers []VPCLoadBalancerStatus `json:"loadBalancers,omitempty"`

// publicGateways references the VPC Public Gateways for the cluster.
// +optional
PublicGateways []*VPCResourceStatus `json:"publicGateways,omitempty"`

// securityGroups references the VPC Security Groups for the cluster.
// +optional
SecurityGroups []*VPCResourceStatus `json:"securityGroups,omitempty"`

// vpc references the IBM Cloud VPC.
// +optional
VPC *VPCResourceStatus `json:"vpc,omitempty"`
}

// VPCResourceStatus identifies a resource by crn and type and whether it was created by the controller.
type VPCResourceStatus struct {
// crn defines the IBM Cloud CRN of the resource.
// +required
CRN string `json:"crn"`
}

// VPC holds the VPC information.
Expand Down
Loading

0 comments on commit 33d3af9

Please sign in to comment.