diff --git a/api/v1beta1/ibmvpc_conversion.go b/api/v1beta1/ibmvpc_conversion.go index 3679f88b46..f049de2bfb 100644 --- a/api/v1beta1/ibmvpc_conversion.go +++ b/api/v1beta1/ibmvpc_conversion.go @@ -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) +} diff --git a/api/v1beta1/zz_generated.conversion.go b/api/v1beta1/zz_generated.conversion.go index 16331b3613..98e8e5a569 100644 --- a/api/v1beta1/zz_generated.conversion.go +++ b/api/v1beta1/zz_generated.conversion.go @@ -259,21 +259,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta2.IBMVPCClusterSpec)(nil), (*IBMVPCClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(a.(*v1beta2.IBMVPCClusterSpec), b.(*IBMVPCClusterSpec), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*IBMVPCClusterStatus)(nil), (*v1beta2.IBMVPCClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_IBMVPCClusterStatus_To_v1beta2_IBMVPCClusterStatus(a.(*IBMVPCClusterStatus), b.(*v1beta2.IBMVPCClusterStatus), scope) }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta2.IBMVPCClusterStatus)(nil), (*IBMVPCClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(a.(*v1beta2.IBMVPCClusterStatus), b.(*IBMVPCClusterStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*IBMVPCMachine)(nil), (*v1beta2.IBMVPCMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_IBMVPCMachine_To_v1beta2_IBMVPCMachine(a.(*IBMVPCMachine), b.(*v1beta2.IBMVPCMachine), scope) }); err != nil { @@ -444,6 +434,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta2.IBMVPCClusterSpec)(nil), (*IBMVPCClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(a.(*v1beta2.IBMVPCClusterSpec), b.(*IBMVPCClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.IBMVPCClusterStatus)(nil), (*IBMVPCClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(a.(*v1beta2.IBMVPCClusterStatus), b.(*IBMVPCClusterStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta2.IBMVPCMachineSpec)(nil), (*IBMVPCMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_IBMVPCMachineSpec_To_v1beta1_IBMVPCMachineSpec(a.(*v1beta2.IBMVPCMachineSpec), b.(*IBMVPCMachineSpec), scope) }); err != nil { @@ -1253,10 +1253,6 @@ func Convert_v1beta1_IBMVPCClusterSpec_To_v1beta2_IBMVPCClusterSpec(in *IBMVPCCl } func autoConvert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in *v1beta2.IBMVPCClusterSpec, out *IBMVPCClusterSpec, s conversion.Scope) error { - out.Region = in.Region - out.ResourceGroup = in.ResourceGroup - out.VPC = in.VPC - out.Zone = in.Zone out.ControlPlaneEndpoint = in.ControlPlaneEndpoint if in.ControlPlaneLoadBalancer != nil { in, out := &in.ControlPlaneLoadBalancer, &out.ControlPlaneLoadBalancer @@ -1267,14 +1263,16 @@ func autoConvert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in *v1be } else { out.ControlPlaneLoadBalancer = nil } + // WARNING: in.COSInstance requires manual conversion: does not exist in peer-type + // WARNING: in.LoadBalancers requires manual conversion: does not exist in peer-type + // WARNING: in.NetworkSpec requires manual conversion: does not exist in peer-type + out.Region = in.Region + out.ResourceGroup = in.ResourceGroup + out.VPC = in.VPC + out.Zone = in.Zone return nil } -// Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec is an autogenerated conversion function. -func Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in *v1beta2.IBMVPCClusterSpec, out *IBMVPCClusterSpec, s conversion.Scope) error { - return autoConvert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in, out, s) -} - func autoConvert_v1beta1_IBMVPCClusterStatus_To_v1beta2_IBMVPCClusterStatus(in *IBMVPCClusterStatus, out *v1beta2.IBMVPCClusterStatus, s conversion.Scope) error { if err := Convert_v1beta1_VPC_To_v1beta2_VPC(&in.VPC, &out.VPC, s); err != nil { return err @@ -1297,26 +1295,24 @@ func Convert_v1beta1_IBMVPCClusterStatus_To_v1beta2_IBMVPCClusterStatus(in *IBMV } func autoConvert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in *v1beta2.IBMVPCClusterStatus, out *IBMVPCClusterStatus, s conversion.Scope) error { - if err := Convert_v1beta2_VPC_To_v1beta1_VPC(&in.VPC, &out.VPC, s); err != nil { - return err - } + out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) + out.ControlPlaneLoadBalancerState = VPCLoadBalancerState(in.ControlPlaneLoadBalancerState) + // WARNING: in.COSInstance requires manual conversion: does not exist in peer-type + // WARNING: in.NetworkStatus requires manual conversion: does not exist in peer-type out.Ready = in.Ready + // WARNING: in.ResourceGroup requires manual conversion: does not exist in peer-type if err := Convert_v1beta2_Subnet_To_v1beta1_Subnet(&in.Subnet, &out.Subnet, s); err != nil { return err } + if err := Convert_v1beta2_VPC_To_v1beta1_VPC(&in.VPC, &out.VPC, s); err != nil { + return err + } if err := Convert_v1beta2_VPCEndpoint_To_v1beta1_VPCEndpoint(&in.VPCEndpoint, &out.VPCEndpoint, s); err != nil { return err } - out.ControlPlaneLoadBalancerState = VPCLoadBalancerState(in.ControlPlaneLoadBalancerState) - out.Conditions = *(*apiv1beta1.Conditions)(unsafe.Pointer(&in.Conditions)) return nil } -// Convert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus is an autogenerated conversion function. -func Convert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in *v1beta2.IBMVPCClusterStatus, out *IBMVPCClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in, out, s) -} - func autoConvert_v1beta1_IBMVPCMachine_To_v1beta2_IBMVPCMachine(in *IBMVPCMachine, out *v1beta2.IBMVPCMachine, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1beta1_IBMVPCMachineSpec_To_v1beta2_IBMVPCMachineSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/api/v1beta2/ibmvpccluster_types.go b/api/v1beta2/ibmvpccluster_types.go index 3581aa78ab..c9ea62aac4 100644 --- a/api/v1beta2/ibmvpccluster_types.go +++ b/api/v1beta2/ibmvpccluster_types.go @@ -32,28 +32,39 @@ const ( // IBMVPCClusterSpec defines the desired state of IBMVPCCluster. type IBMVPCClusterSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file - // The IBM Cloud Region the cluster lives in. + // controlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"` + + // ControlPlaneLoadBalancer is optional configuration for customizing control plane behavior. + // +optional + // dep: use LoadBalancers instead + ControlPlaneLoadBalancer *VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"` + + // cosInstance is the IBM COS instance to use for cluster resources. + COSInstance *COSInstance `json:"cosInstance,omitempty"` + + // loadBalancers is a set of VPC Load Balancers definition to use for the cluster. + LoadBalancers []*VPCLoadBalancerSpec `json:"loadbalancers,omitempty"` + + // networkSpec represents the VPC network to use for the cluster. + NetworkSpec *VPCNetworkSpec `json:"networkSpec,omitempty"` + + // region defines the IBM Cloud Region the cluster resources will be deployed in. Region string `json:"region"` - // The VPC resources should be created under the resource group. + // resourceGroup defines the IBM Cloud resource group where the cluster resources should be created. ResourceGroup string `json:"resourceGroup"` // The Name of VPC. + // dep: use NetworkSpec instead. VPC string `json:"vpc,omitempty"` // The Name of availability zone. + // dep: use NetworkSpec instead. Zone string `json:"zone,omitempty"` - - // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. - // +optional - ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"` - - // ControlPlaneLoadBalancer is optional configuration for customizing control plane behavior. - // +optional - ControlPlaneLoadBalancer *VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"` } // VPCLoadBalancerSpec defines the desired state of an VPC load balancer. @@ -103,25 +114,118 @@ 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 { + // controllerCreated indicates whether the resource is created by the CAPI controller. + ControllerCreated bool `json:"controllerCreated,omitempty"` + + // crn defines the IBM Cloud CRN of the resource. + // +required + CRN string `json:"crn"` + + // type defines the type of IBM Cloud resource. + // +required + Type ResourceType `json:"type"` } // VPC holds the VPC information. diff --git a/api/v1beta2/types.go b/api/v1beta2/types.go index 70d3386426..236f1a6ea5 100644 --- a/api/v1beta2/types.go +++ b/api/v1beta2/types.go @@ -134,6 +134,10 @@ var ( ResourceTypeVPC = ResourceType("vpc") // ResourceTypeSubnet is VPC subnet resource. ResourceTypeSubnet = ResourceType("subnet") + // ResourceTypePublicGateway is a VPC Public Gateway. + ResourceTypePublicGateway = ResourceType("publicGateway") + // ResourceTypeSecurityGroup is a VPC Security Group. + ResourceTypeSecurityGroup = ResourceType("securityGroup") // ResourceTypeCOSInstance is IBM COS instance resource. ResourceTypeCOSInstance = ResourceType("cosInstance") // ResourceTypeResourceGroup is IBM Resource Group. diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index 031aa66711..96691cc248 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -42,6 +42,21 @@ func (in *AdditionalListenerSpec) DeepCopy() *AdditionalListenerSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *COSInstance) DeepCopyInto(out *COSInstance) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new COSInstance. +func (in *COSInstance) DeepCopy() *COSInstance { + if in == nil { + return nil + } + out := new(COSInstance) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *CosInstance) DeepCopyInto(out *CosInstance) { *out = *in @@ -859,6 +874,27 @@ func (in *IBMVPCClusterSpec) DeepCopyInto(out *IBMVPCClusterSpec) { *out = new(VPCLoadBalancerSpec) (*in).DeepCopyInto(*out) } + if in.COSInstance != nil { + in, out := &in.COSInstance, &out.COSInstance + *out = new(COSInstance) + **out = **in + } + if in.LoadBalancers != nil { + in, out := &in.LoadBalancers, &out.LoadBalancers + *out = make([]*VPCLoadBalancerSpec, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(VPCLoadBalancerSpec) + (*in).DeepCopyInto(*out) + } + } + } + if in.NetworkSpec != nil { + in, out := &in.NetworkSpec, &out.NetworkSpec + *out = new(VPCNetworkSpec) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBMVPCClusterSpec. @@ -874,9 +910,6 @@ func (in *IBMVPCClusterSpec) DeepCopy() *IBMVPCClusterSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IBMVPCClusterStatus) DeepCopyInto(out *IBMVPCClusterStatus) { *out = *in - out.VPC = in.VPC - in.Subnet.DeepCopyInto(&out.Subnet) - in.VPCEndpoint.DeepCopyInto(&out.VPCEndpoint) if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions *out = make(v1beta1.Conditions, len(*in)) @@ -884,6 +917,24 @@ func (in *IBMVPCClusterStatus) DeepCopyInto(out *IBMVPCClusterStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.COSInstance != nil { + in, out := &in.COSInstance, &out.COSInstance + *out = new(ResourceReference) + (*in).DeepCopyInto(*out) + } + if in.NetworkStatus != nil { + in, out := &in.NetworkStatus, &out.NetworkStatus + *out = new(VPCNetworkStatus) + (*in).DeepCopyInto(*out) + } + if in.ResourceGroup != nil { + in, out := &in.ResourceGroup, &out.ResourceGroup + *out = new(ResourceReference) + (*in).DeepCopyInto(*out) + } + in.Subnet.DeepCopyInto(&out.Subnet) + out.VPC = in.VPC + in.VPCEndpoint.DeepCopyInto(&out.VPCEndpoint) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBMVPCClusterStatus. @@ -1301,6 +1352,21 @@ func (in *ResourceReference) DeepCopy() *ResourceReference { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecurityGroup) DeepCopyInto(out *SecurityGroup) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityGroup. +func (in *SecurityGroup) DeepCopy() *SecurityGroup { + if in == nil { + return nil + } + out := new(SecurityGroup) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Subnet) DeepCopyInto(out *Subnet) { *out = *in @@ -1466,6 +1532,136 @@ func (in *VPCLoadBalancerStatus) DeepCopy() *VPCLoadBalancerStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VPCNetworkSpec) DeepCopyInto(out *VPCNetworkSpec) { + *out = *in + if in.ComputeSubnetsSpec != nil { + in, out := &in.ComputeSubnetsSpec, &out.ComputeSubnetsSpec + *out = make([]Subnet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ControlPlaneSubnetsSpec != nil { + in, out := &in.ControlPlaneSubnetsSpec, &out.ControlPlaneSubnetsSpec + *out = make([]Subnet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ResourceGroup != nil { + in, out := &in.ResourceGroup, &out.ResourceGroup + *out = new(string) + **out = **in + } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]SecurityGroup, len(*in)) + copy(*out, *in) + } + if in.VPC != nil { + in, out := &in.VPC, &out.VPC + *out = new(VPCResource) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCNetworkSpec. +func (in *VPCNetworkSpec) DeepCopy() *VPCNetworkSpec { + if in == nil { + return nil + } + out := new(VPCNetworkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VPCNetworkStatus) DeepCopyInto(out *VPCNetworkStatus) { + *out = *in + if in.ComputeSubnets != nil { + in, out := &in.ComputeSubnets, &out.ComputeSubnets + *out = make([]*VPCResourceStatus, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(VPCResourceStatus) + **out = **in + } + } + } + if in.ControlPlaneSubnets != nil { + in, out := &in.ControlPlaneSubnets, &out.ControlPlaneSubnets + *out = make([]*VPCResourceStatus, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(VPCResourceStatus) + **out = **in + } + } + } + if in.LoadBalancers != nil { + in, out := &in.LoadBalancers, &out.LoadBalancers + *out = make([]VPCLoadBalancerStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PublicGateways != nil { + in, out := &in.PublicGateways, &out.PublicGateways + *out = make([]*VPCResourceStatus, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(VPCResourceStatus) + **out = **in + } + } + } + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]*VPCResourceStatus, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(VPCResourceStatus) + **out = **in + } + } + } + if in.VPC != nil { + in, out := &in.VPC, &out.VPC + *out = new(VPCResourceStatus) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCNetworkStatus. +func (in *VPCNetworkStatus) DeepCopy() *VPCNetworkStatus { + if in == nil { + return nil + } + out := new(VPCNetworkStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VPCResource) DeepCopyInto(out *VPCResource) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCResource. +func (in *VPCResource) DeepCopy() *VPCResource { + if in == nil { + return nil + } + out := new(VPCResource) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCResourceReference) DeepCopyInto(out *VPCResourceReference) { *out = *in @@ -1496,6 +1692,21 @@ func (in *VPCResourceReference) DeepCopy() *VPCResourceReference { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VPCResourceStatus) DeepCopyInto(out *VPCResourceStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCResourceStatus. +func (in *VPCResourceStatus) DeepCopy() *VPCResourceStatus { + if in == nil { + return nil + } + out := new(VPCResourceStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCVolume) DeepCopyInto(out *VPCVolume) { *out = *in diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml index 1bcde6e4d3..b003913d15 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml @@ -223,7 +223,7 @@ spec: description: IBMVPCClusterSpec defines the desired state of IBMVPCCluster. properties: controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint used to + description: controlPlaneEndpoint represents the endpoint used to communicate with the control plane. properties: host: @@ -238,8 +238,8 @@ spec: - port type: object controlPlaneLoadBalancer: - description: ControlPlaneLoadBalancer is optional configuration for - customizing control plane behavior. + description: 'ControlPlaneLoadBalancer is optional configuration for + customizing control plane behavior. dep: use LoadBalancers instead' properties: additionalListeners: description: AdditionalListeners sets the additional listeners @@ -274,18 +274,134 @@ spec: private type: boolean type: object + cosInstance: + description: cosInstance is the IBM COS instance to use for cluster + resources. + properties: + name: + type: string + required: + - name + type: object + loadbalancers: + description: loadBalancers is a set of VPC Load Balancers definition + to use for the cluster. + items: + description: VPCLoadBalancerSpec defines the desired state of an + VPC load balancer. + properties: + additionalListeners: + description: AdditionalListeners sets the additional listeners + for the control plane load balancer. + items: + description: AdditionalListenerSpec defines the desired state + of an additional listener on an VPC load balancer. + properties: + port: + description: Port sets the port for the additional listener. + format: int64 + maximum: 65535 + minimum: 1 + type: integer + required: + - port + type: object + type: array + x-kubernetes-list-map-keys: + - port + x-kubernetes-list-type: map + id: + description: id of the loadbalancer + type: string + name: + description: Name sets the name of the VPC load balancer. + maxLength: 63 + type: string + public: + default: true + description: public indicates that load balancer is public or + private + type: boolean + type: object + type: array + networkSpec: + description: networkSpec represents the VPC network to use for the + cluster. + properties: + computeSubnetsSpec: + description: computeSubnetsSpec is a set of Subnet's which define + the Compute subnets. + items: + description: Subnet describes a subnet. + properties: + cidr: + type: string + id: + type: string + name: + type: string + zone: + type: string + type: object + type: array + controlPlaneSubentsSpec: + description: controlPlaneSubnetsSpec is a set of Subnet's which + define the Control Plane subnets. + items: + description: Subnet describes a subnet. + properties: + cidr: + type: string + id: + type: string + name: + 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 + securityGroups: + description: securityGroups is a set of SecurityGroup's which + define the VPC Security Groups that manage traffic within and + out of the VPC. + items: + description: 'SecurityGroup dummy. TODO(cjschaef): Dummy SecurityGroup + until it is defined in a common location.' + properties: + name: + type: string + required: + - name + type: object + type: array + vpc: + description: vpc defines the IBM Cloud VPC. + properties: + name: + type: string + required: + - name + type: object + type: object region: - description: The IBM Cloud Region the cluster lives in. + description: region defines the IBM Cloud Region the cluster resources + will be deployed in. type: string resourceGroup: - description: The VPC resources should be created under the resource - group. + description: resourceGroup defines the IBM Cloud resource group where + the cluster resources should be created. type: string vpc: - description: The Name of VPC. + description: 'The Name of VPC. dep: use NetworkSpec instead.' type: string zone: - description: The Name of availability zone. + description: 'The Name of availability zone. dep: use NetworkSpec + instead.' type: string required: - region @@ -341,14 +457,174 @@ spec: type: object type: array controlPlaneLoadBalancerState: - description: ControlPlaneLoadBalancerState is the status of the load - balancer. + description: 'ControlPlaneLoadBalancerState is the status of the load + balancer. dep: rely on NetworkStatus instead.' type: string + cosInstance: + description: COSInstance is the reference to the IBM Cloud COS Instance + used for the cluster. + properties: + controllerCreated: + default: false + description: controllerCreated indicates whether the resource + is created by the controller. + type: boolean + id: + description: id represents the id of the resource. + type: string + type: object + networkStatus: + description: networkStatus is the status of the VPC network in its + entirety resources. + properties: + computeSubnets: + description: computeSubnets references the VPC Subnets for the + cluster's Data Plane. + items: + description: VPCResourceStatus identifies a resource by crn + and type and whether it was created by the controller. + properties: + controllerCreated: + description: controllerCreated indicates whether the resource + is created by the CAPI controller. + type: boolean + crn: + description: crn defines the IBM Cloud CRN of the resource. + type: string + type: + description: type defines the type of IBM Cloud resource. + type: string + required: + - crn + - type + type: object + type: array + controlPlaneSubnets: + description: controlPlaneSubnets references the VPC Subnets for + the cluster's Control Plane. + items: + description: VPCResourceStatus identifies a resource by crn + and type and whether it was created by the controller. + properties: + controllerCreated: + description: controllerCreated indicates whether the resource + is created by the CAPI controller. + type: boolean + crn: + description: crn defines the IBM Cloud CRN of the resource. + type: string + type: + description: type defines the type of IBM Cloud resource. + type: string + required: + - crn + - type + type: object + type: array + loadBalancers: + description: loadBalancers references the VPC Load Balancer's + for the cluster. + items: + description: VPCLoadBalancerStatus defines the status VPC load + balancer. + properties: + controllerCreated: + default: false + description: controllerCreated indicates whether the resource + is created by the controller. + type: boolean + hostname: + description: hostname is the hostname of load balancer. + type: string + id: + description: id of VPC load balancer. + type: string + state: + description: State is the status of the load balancer. + type: string + type: object + type: array + publicGateways: + description: publicGateways references the VPC Public Gateways + for the cluster. + items: + description: VPCResourceStatus identifies a resource by crn + and type and whether it was created by the controller. + properties: + controllerCreated: + description: controllerCreated indicates whether the resource + is created by the CAPI controller. + type: boolean + crn: + description: crn defines the IBM Cloud CRN of the resource. + type: string + type: + description: type defines the type of IBM Cloud resource. + type: string + required: + - crn + - type + type: object + type: array + securityGroups: + description: securityGroups references the VPC Security Groups + for the cluster. + items: + description: VPCResourceStatus identifies a resource by crn + and type and whether it was created by the controller. + properties: + controllerCreated: + description: controllerCreated indicates whether the resource + is created by the CAPI controller. + type: boolean + crn: + description: crn defines the IBM Cloud CRN of the resource. + type: string + type: + description: type defines the type of IBM Cloud resource. + type: string + required: + - crn + - type + type: object + type: array + vpc: + description: vpc references the IBM Cloud VPC. + properties: + controllerCreated: + description: controllerCreated indicates whether the resource + is created by the CAPI controller. + type: boolean + crn: + description: crn defines the IBM Cloud CRN of the resource. + type: string + type: + description: type defines the type of IBM Cloud resource. + type: string + required: + - crn + - type + type: object + type: object ready: - description: Ready is true when the provider resource is ready. + default: false + description: ready is true when the provider resource is ready. type: boolean + resourceGroupID: + description: resourceGroup is the reference to the IBM Cloud VPC resource + group under which the resources will be created. + properties: + controllerCreated: + default: false + description: controllerCreated indicates whether the resource + is created by the controller. + type: boolean + id: + description: id represents the id of the resource. + type: string + type: object subnet: - description: Subnet describes a subnet. + description: 'dep: rely on NetworkStatus instead.' properties: cidr: type: string @@ -360,9 +636,7 @@ spec: type: string type: object vpc: - description: 'INSERT ADDITIONAL STATUS FIELD - define observed state - of cluster Important: Run "make" to regenerate code after modifying - this file' + description: 'dep: rely on NetworkStatus instead.' properties: id: type: string @@ -373,7 +647,7 @@ spec: - name type: object vpcEndpoint: - description: VPCEndpoint describes a VPCEndpoint. + description: 'dep: rely on ControlPlaneEndpoint' properties: address: type: string @@ -386,6 +660,8 @@ spec: required: - address type: object + required: + - ready type: object type: object served: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml index c19cbe3aa7..7b5efa4696 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml @@ -73,7 +73,7 @@ spec: description: IBMVPCClusterSpec defines the desired state of IBMVPCCluster. properties: controlPlaneEndpoint: - description: ControlPlaneEndpoint represents the endpoint + description: controlPlaneEndpoint represents the endpoint used to communicate with the control plane. properties: host: @@ -88,8 +88,9 @@ spec: - port type: object controlPlaneLoadBalancer: - description: ControlPlaneLoadBalancer is optional configuration - for customizing control plane behavior. + description: 'ControlPlaneLoadBalancer is optional configuration + for customizing control plane behavior. dep: use LoadBalancers + instead' properties: additionalListeners: description: AdditionalListeners sets the additional listeners @@ -125,18 +126,136 @@ spec: or private type: boolean type: object + cosInstance: + description: cosInstance is the IBM COS instance to use for + cluster resources. + properties: + name: + type: string + required: + - name + type: object + loadbalancers: + description: loadBalancers is a set of VPC Load Balancers + definition to use for the cluster. + items: + description: VPCLoadBalancerSpec defines the desired state + of an VPC load balancer. + properties: + additionalListeners: + description: AdditionalListeners sets the additional + listeners for the control plane load balancer. + items: + description: AdditionalListenerSpec defines the desired + state of an additional listener on an VPC load balancer. + properties: + port: + description: Port sets the port for the additional + listener. + format: int64 + maximum: 65535 + minimum: 1 + type: integer + required: + - port + type: object + type: array + x-kubernetes-list-map-keys: + - port + x-kubernetes-list-type: map + id: + description: id of the loadbalancer + type: string + name: + description: Name sets the name of the VPC load balancer. + maxLength: 63 + type: string + public: + default: true + description: public indicates that load balancer is + public or private + type: boolean + type: object + type: array + networkSpec: + description: networkSpec represents the VPC network to use + for the cluster. + properties: + computeSubnetsSpec: + description: computeSubnetsSpec is a set of Subnet's which + define the Compute subnets. + items: + description: Subnet describes a subnet. + properties: + cidr: + type: string + id: + type: string + name: + type: string + zone: + type: string + type: object + type: array + controlPlaneSubentsSpec: + description: controlPlaneSubnetsSpec is a set of Subnet's + which define the Control Plane subnets. + items: + description: Subnet describes a subnet. + properties: + cidr: + type: string + id: + type: string + name: + 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 + securityGroups: + description: securityGroups is a set of SecurityGroup's + which define the VPC Security Groups that manage traffic + within and out of the VPC. + items: + description: 'SecurityGroup dummy. TODO(cjschaef): Dummy + SecurityGroup until it is defined in a common location.' + properties: + name: + type: string + required: + - name + type: object + type: array + vpc: + description: vpc defines the IBM Cloud VPC. + properties: + name: + type: string + required: + - name + type: object + type: object region: - description: The IBM Cloud Region the cluster lives in. + description: region defines the IBM Cloud Region the cluster + resources will be deployed in. type: string resourceGroup: - description: The VPC resources should be created under the - resource group. + description: resourceGroup defines the IBM Cloud resource + group where the cluster resources should be created. type: string vpc: - description: The Name of VPC. + description: 'The Name of VPC. dep: use NetworkSpec instead.' type: string zone: - description: The Name of availability zone. + description: 'The Name of availability zone. dep: use NetworkSpec + instead.' type: string required: - region