Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VPC: VPCCluster definition extension #1683

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the shared basic types is added in time, this should be COSInstanceReference, from types.go.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm dropping this reference, as I don't plan to manage COS resources.

Instead, I will incorporate a new ImageSpec, which will have details about the expected VSI Custom Image, which could include a COS ObjectURL, to create a new Custom Image from, if necessary.


// 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"`
}
Comment on lines +137 to +153
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove these dummy types if the other PR's adding them are merged before.
#1670
#1669


// 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