From 959867b7f6c09661fc399ae8c64e0f961fe8286e Mon Sep 17 00:00:00 2001 From: Christopher J Schaefer Date: Mon, 7 Oct 2024 07:08:21 -0500 Subject: [PATCH] VPC: Extend VPC Machine API's (#1978) Extend the VPC Machine API's to include additional fields and types for more VPC Machine configuration support. Related: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/issues/1977 --- api/v1beta1/ibmvpc_conversion.go | 8 + api/v1beta1/zz_generated.conversion.go | 38 ++- api/v1beta2/ibmvpcmachine_types.go | 44 ++- api/v1beta2/types.go | 55 ++++ api/v1beta2/zz_generated.deepcopy.go | 132 +++++++- ...cture.cluster.x-k8s.io_ibmvpcmachines.yaml | 281 +++++++++++++++++- ...uster.x-k8s.io_ibmvpcmachinetemplates.yaml | 162 ++++++++++ 7 files changed, 693 insertions(+), 27 deletions(-) diff --git a/api/v1beta1/ibmvpc_conversion.go b/api/v1beta1/ibmvpc_conversion.go index f049de2bf..a839f00ac 100644 --- a/api/v1beta1/ibmvpc_conversion.go +++ b/api/v1beta1/ibmvpc_conversion.go @@ -231,3 +231,11 @@ func Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in *infrav1b 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) } + +func Convert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(in *infrav1beta2.IBMVPCMachineStatus, out *IBMVPCMachineStatus, s apiconversion.Scope) error { + return autoConvert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(in, out, s) +} + +func Convert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(in *infrav1beta2.NetworkInterface, out *NetworkInterface, s apiconversion.Scope) error { + return autoConvert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(in, out, s) +} diff --git a/api/v1beta1/zz_generated.conversion.go b/api/v1beta1/zz_generated.conversion.go index 18e6f0355..7d8fccee2 100644 --- a/api/v1beta1/zz_generated.conversion.go +++ b/api/v1beta1/zz_generated.conversion.go @@ -289,11 +289,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta2.IBMVPCMachineStatus)(nil), (*IBMVPCMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(a.(*v1beta2.IBMVPCMachineStatus), b.(*IBMVPCMachineStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*IBMVPCMachineTemplate)(nil), (*v1beta2.IBMVPCMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_IBMVPCMachineTemplate_To_v1beta2_IBMVPCMachineTemplate(a.(*IBMVPCMachineTemplate), b.(*v1beta2.IBMVPCMachineTemplate), scope) }); err != nil { @@ -344,11 +339,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta2.NetworkInterface)(nil), (*NetworkInterface)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(a.(*v1beta2.NetworkInterface), b.(*NetworkInterface), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*Subnet)(nil), (*v1beta2.Subnet)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_Subnet_To_v1beta2_Subnet(a.(*Subnet), b.(*v1beta2.Subnet), scope) }); err != nil { @@ -449,11 +439,21 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta2.IBMVPCMachineStatus)(nil), (*IBMVPCMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(a.(*v1beta2.IBMVPCMachineStatus), b.(*IBMVPCMachineStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta2.IBMVPCMachineTemplateStatus)(nil), (*IBMVPCMachineTemplateStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_IBMVPCMachineTemplateStatus_To_v1beta1_IBMVPCMachineTemplateStatus(a.(*v1beta2.IBMVPCMachineTemplateStatus), b.(*IBMVPCMachineTemplateStatus), scope) }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta2.NetworkInterface)(nil), (*NetworkInterface)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(a.(*v1beta2.NetworkInterface), b.(*NetworkInterface), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta2.VPCLoadBalancerSpec)(nil), (*VPCLoadBalancerSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_VPCLoadBalancerSpec_To_v1beta1_VPCLoadBalancerSpec(a.(*v1beta2.VPCLoadBalancerSpec), b.(*VPCLoadBalancerSpec), scope) }); err != nil { @@ -1408,7 +1408,10 @@ func autoConvert_v1beta1_IBMVPCMachineSpec_To_v1beta2_IBMVPCMachineSpec(in *IBMV func autoConvert_v1beta2_IBMVPCMachineSpec_To_v1beta1_IBMVPCMachineSpec(in *v1beta2.IBMVPCMachineSpec, out *IBMVPCMachineSpec, s conversion.Scope) error { out.Name = in.Name + // WARNING: in.CatalogOffering requires manual conversion: does not exist in peer-type + // WARNING: in.PlacementTarget requires manual conversion: does not exist in peer-type // WARNING: in.Image requires manual conversion: inconvertible types (*sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta2.IBMVPCResourceReference vs string) + // WARNING: in.LoadBalancerPoolMembers requires manual conversion: does not exist in peer-type out.Zone = in.Zone out.Profile = in.Profile out.BootVolume = (*VPCVolume)(unsafe.Pointer(in.BootVolume)) @@ -1439,15 +1442,14 @@ func autoConvert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(in * out.InstanceID = in.InstanceID out.Ready = in.Ready out.Addresses = *(*[]v1.NodeAddress)(unsafe.Pointer(&in.Addresses)) + // WARNING: in.Conditions requires manual conversion: does not exist in peer-type + // WARNING: in.FailureReason requires manual conversion: does not exist in peer-type + // WARNING: in.FailureMessage requires manual conversion: does not exist in peer-type out.InstanceStatus = in.InstanceStatus + // WARNING: in.LoadBalancerPoolMembers requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus is an autogenerated conversion function. -func Convert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(in *v1beta2.IBMVPCMachineStatus, out *IBMVPCMachineStatus, s conversion.Scope) error { - return autoConvert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(in, out, s) -} - func autoConvert_v1beta1_IBMVPCMachineTemplate_To_v1beta2_IBMVPCMachineTemplate(in *IBMVPCMachineTemplate, out *v1beta2.IBMVPCMachineTemplate, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1beta1_IBMVPCMachineTemplateSpec_To_v1beta2_IBMVPCMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { @@ -1595,15 +1597,11 @@ func Convert_v1beta1_NetworkInterface_To_v1beta2_NetworkInterface(in *NetworkInt } func autoConvert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(in *v1beta2.NetworkInterface, out *NetworkInterface, s conversion.Scope) error { + // WARNING: in.SecurityGroups requires manual conversion: does not exist in peer-type out.Subnet = in.Subnet return nil } -// Convert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface is an autogenerated conversion function. -func Convert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(in *v1beta2.NetworkInterface, out *NetworkInterface, s conversion.Scope) error { - return autoConvert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(in, out, s) -} - func autoConvert_v1beta1_Subnet_To_v1beta2_Subnet(in *Subnet, out *v1beta2.Subnet, s conversion.Scope) error { out.Ipv4CidrBlock = (*string)(unsafe.Pointer(in.Ipv4CidrBlock)) out.Name = (*string)(unsafe.Pointer(in.Name)) diff --git a/api/v1beta2/ibmvpcmachine_types.go b/api/v1beta2/ibmvpcmachine_types.go index 0a0b7b2d0..b36e31afa 100644 --- a/api/v1beta2/ibmvpcmachine_types.go +++ b/api/v1beta2/ibmvpcmachine_types.go @@ -19,6 +19,9 @@ package v1beta2 import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/errors" ) // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. @@ -30,16 +33,29 @@ const ( // IBMVPCMachineSpec defines the desired state of IBMVPCMachine. type IBMVPCMachineSpec struct { - // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + // INSERT ADDITIONAL SPEC FIELDS - desired state of machine. // Important: Run "make" to regenerate code after modifying this file // Name of the instance. Name string `json:"name,omitempty"` + // CatalogOffering is the Catalog Offering OS image which would be installed on the instance. + // An OfferingCRN or VersionCRN is required, the PlanCRN is optional. + // +optional + CatalogOffering *IBMCloudCatalogOffering `json:"catalogOffering,omitempty"` + + // PlacementTarget is the placement restrictions to use for the virtual server instance. No restrictions are used when this field is not defined. + // +optional + PlacementTarget *VPCMachinePlacementTarget `json:"placementTarget,omitempty"` + // Image is the OS image which would be install on the instance. // ID will take higher precedence over Name if both specified. Image *IBMVPCResourceReference `json:"image"` + // LoadBalancerPoolMembers is the set of IBM Cloud VPC Load Balancer Backend Pools the machine should be added to as a member. + // +optional + LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"` + // Zone is the place where the instance should be created. Example: us-south-3 // TODO: Actually zone is transparent to user. The field user can access is location. Example: Dallas 2 Zone string `json:"zone"` @@ -126,18 +142,40 @@ type IBMVPCMachineStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster // Important: Run "make" to regenerate code after modifying this file + // InstanceID defines the IBM Cloud VPC Instance UUID. + // +optional InstanceID string `json:"instanceID,omitempty"` // Ready is true when the provider resource is ready. // +optional Ready bool `json:"ready"` - // Addresses contains the GCP instance associated addresses. + // Addresses contains the IBM Cloud instance associated addresses. Addresses []corev1.NodeAddress `json:"addresses,omitempty"` - // InstanceStatus is the status of the GCP instance for this machine. + // Conditions deefines current service state of the IBMVPCMachine. + // +optional + Conditions capiv1beta1.Conditions `json:"conditions,omitempty"` + + // FailureReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // +optional + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + + // FailureMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` + + // InstanceStatus is the status of the IBM Cloud instance for this machine. // +optional InstanceStatus string `json:"instanceState,omitempty"` + + // LoadBalancerPoolMembers is the status of IBM Cloud VPC Load Balancer Backend Pools the machine is a member. + // +optional + LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"` } // +kubebuilder:object:root=true diff --git a/api/v1beta2/types.go b/api/v1beta2/types.go index e6d9efd7d..3d81846bc 100644 --- a/api/v1beta2/types.go +++ b/api/v1beta2/types.go @@ -356,12 +356,67 @@ type IBMCloudResourceReference struct { Name *string `json:"name,omitempty"` } +// IBMCloudCatalogOffering represents an IBM Cloud Catalog Offering resource. +// +kubebuilder:validation:XValidation:rule="(has(self.offeringCRN) && !has(self.versionCRN)) || (!has(self.offeringCRN) && has(self.versionCRN))",message="either offeringCRN or version CRN must be provided, not both" +type IBMCloudCatalogOffering struct { + // OfferingCRN defines the IBM Cloud Catalog Offering CRN. Using the OfferingCRN expects that the latest version of the Offering will be used. + // If a specific version should be used instead, rely on VersionCRN. + // +optional + OfferingCRN *string `json:"offeringCRN,omitempty"` + + // PlanCRN defines the IBM Cloud Catalog Offering Plan CRN to use for the Offering. + // +optional + PlanCRN *string `json:"planCRN,omitempty"` + + // VersionCRN defines the IBM Cloud Catalog Offering Version CRN. A specific version of the Catalog Offering will be used, as defined by this CRN. + // +optional + VersionCRN *string `json:"versionCRN,omitempty"` +} + // NetworkInterface holds the network interface information like subnet id. type NetworkInterface struct { + // SecurityGroups defines a set of IBM Cloud VPC Security Groups to attach to the network interface. + // +optional + SecurityGroups []VPCResource `json:"securityGroups,omitempty"` + // Subnet ID of the network interface. Subnet string `json:"subnet,omitempty"` } +// VPCLoadBalancerBackendPoolMember represents a VPC Load Balancer Backend Pool Member. +type VPCLoadBalancerBackendPoolMember struct { + // LoadBalancer defines the Load Balancer the Pool Member is for. + // +required + LoadBalancer VPCResource `json:"loadBalancer"` + + // Pool defines the Load Balancer Pool the Pool Member should be in. + // +required + Pool VPCResource `json:"pool"` + + // Port defines the Port the Load Balancer Pool Member listens for traffic. + // +required + Port int64 `json:"port"` + + // Weight of the service member. Only applicable if the pool algorithm is "weighted_round_robin". + // +optional + Weight *int64 `json:"weight,omitempty"` +} + +// VPCMachinePlacementTarget represents a VPC Machine's placement restrictions. +// +kubebuilder:validation:XValidation:rule="(has(self.dedicatedHost) && !has(self.dedicatedHostGroup) && !has(self.placementGroup)) || (!has(self.dedicatedHost) && has(self.dedicatedHostGroup) && !has(self.placementGroup)) || (!has(self.dedicatedHost) && !has(self.dedicatedHostGroup) && has(self.placementGroup))",message="only one of dedicatedHost, dedicatedHostGroup, or placementGroup must be defined for machine placement" +type VPCMachinePlacementTarget struct { + // DedicatedHost defines the Dedicated Host to place a VPC Machine (Instance) on. + // +optional + DedicatedHost *VPCResource `json:"dedicatedHost,omitempty"` + + // DedicatedHostGroup defines the Dedicated Host Group to use when placing a VPC Machine (Instance). + // +optional + DedicatedHostGroup *VPCResource `json:"dedicatedHostGroup"` + + // PlacementGroup defines the Placement Group to use when placing a VPC Machine (Instance). + PlacementGroup *VPCResource `json:"placementGroup,omitempty"` +} + // VPCSecurityGroupPortRange represents a range of ports, minimum to maximum. // +kubebuilder:validation:XValidation:rule="self.maximumPort >= self.minimumPort",message="maximum port must be greater than or equal to minimum port" type VPCSecurityGroupPortRange struct { diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index afca65217..cdd8efc07 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -107,6 +107,36 @@ func (in *DHCPServer) DeepCopy() *DHCPServer { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IBMCloudCatalogOffering) DeepCopyInto(out *IBMCloudCatalogOffering) { + *out = *in + if in.OfferingCRN != nil { + in, out := &in.OfferingCRN, &out.OfferingCRN + *out = new(string) + **out = **in + } + if in.PlanCRN != nil { + in, out := &in.PlanCRN, &out.PlanCRN + *out = new(string) + **out = **in + } + if in.VersionCRN != nil { + in, out := &in.VersionCRN, &out.VersionCRN + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBMCloudCatalogOffering. +func (in *IBMCloudCatalogOffering) DeepCopy() *IBMCloudCatalogOffering { + if in == nil { + return nil + } + out := new(IBMCloudCatalogOffering) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IBMCloudResourceReference) DeepCopyInto(out *IBMCloudResourceReference) { *out = *in @@ -1118,11 +1148,28 @@ func (in *IBMVPCMachineList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IBMVPCMachineSpec) DeepCopyInto(out *IBMVPCMachineSpec) { *out = *in + if in.CatalogOffering != nil { + in, out := &in.CatalogOffering, &out.CatalogOffering + *out = new(IBMCloudCatalogOffering) + (*in).DeepCopyInto(*out) + } + if in.PlacementTarget != nil { + in, out := &in.PlacementTarget, &out.PlacementTarget + *out = new(VPCMachinePlacementTarget) + (*in).DeepCopyInto(*out) + } if in.Image != nil { in, out := &in.Image, &out.Image *out = new(IBMVPCResourceReference) (*in).DeepCopyInto(*out) } + if in.LoadBalancerPoolMembers != nil { + in, out := &in.LoadBalancerPoolMembers, &out.LoadBalancerPoolMembers + *out = make([]VPCLoadBalancerBackendPoolMember, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.BootVolume != nil { in, out := &in.BootVolume, &out.BootVolume *out = new(VPCVolume) @@ -1133,7 +1180,7 @@ func (in *IBMVPCMachineSpec) DeepCopyInto(out *IBMVPCMachineSpec) { *out = new(string) **out = **in } - out.PrimaryNetworkInterface = in.PrimaryNetworkInterface + in.PrimaryNetworkInterface.DeepCopyInto(&out.PrimaryNetworkInterface) if in.SSHKeys != nil { in, out := &in.SSHKeys, &out.SSHKeys *out = make([]*IBMVPCResourceReference, len(*in)) @@ -1165,6 +1212,30 @@ func (in *IBMVPCMachineStatus) DeepCopyInto(out *IBMVPCMachineStatus) { *out = make([]v1.NodeAddress, len(*in)) copy(*out, *in) } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make(v1beta1.Conditions, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } + if in.LoadBalancerPoolMembers != nil { + in, out := &in.LoadBalancerPoolMembers, &out.LoadBalancerPoolMembers + *out = make([]VPCLoadBalancerBackendPoolMember, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IBMVPCMachineStatus. @@ -1388,6 +1459,13 @@ func (in *ImageSpec) DeepCopy() *ImageSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkInterface) DeepCopyInto(out *NetworkInterface) { *out = *in + if in.SecurityGroups != nil { + in, out := &in.SecurityGroups, &out.SecurityGroups + *out = make([]VPCResource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterface. @@ -1590,6 +1668,28 @@ func (in *VPCEndpoint) DeepCopy() *VPCEndpoint { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VPCLoadBalancerBackendPoolMember) DeepCopyInto(out *VPCLoadBalancerBackendPoolMember) { + *out = *in + in.LoadBalancer.DeepCopyInto(&out.LoadBalancer) + in.Pool.DeepCopyInto(&out.Pool) + if in.Weight != nil { + in, out := &in.Weight, &out.Weight + *out = new(int64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCLoadBalancerBackendPoolMember. +func (in *VPCLoadBalancerBackendPoolMember) DeepCopy() *VPCLoadBalancerBackendPoolMember { + if in == nil { + return nil + } + out := new(VPCLoadBalancerBackendPoolMember) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VPCLoadBalancerBackendPoolSpec) DeepCopyInto(out *VPCLoadBalancerBackendPoolSpec) { *out = *in @@ -1719,6 +1819,36 @@ 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 *VPCMachinePlacementTarget) DeepCopyInto(out *VPCMachinePlacementTarget) { + *out = *in + if in.DedicatedHost != nil { + in, out := &in.DedicatedHost, &out.DedicatedHost + *out = new(VPCResource) + (*in).DeepCopyInto(*out) + } + if in.DedicatedHostGroup != nil { + in, out := &in.DedicatedHostGroup, &out.DedicatedHostGroup + *out = new(VPCResource) + (*in).DeepCopyInto(*out) + } + if in.PlacementGroup != nil { + in, out := &in.PlacementGroup, &out.PlacementGroup + *out = new(VPCResource) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VPCMachinePlacementTarget. +func (in *VPCMachinePlacementTarget) DeepCopy() *VPCMachinePlacementTarget { + if in == nil { + return nil + } + out := new(VPCMachinePlacementTarget) + in.DeepCopyInto(out) + 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 diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml index df13f7e60..1d476a188 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml @@ -256,6 +256,31 @@ spec: format: int64 type: integer type: object + catalogOffering: + description: |- + CatalogOffering is the Catalog Offering OS image which would be installed on the instance. + An OfferingCRN or VersionCRN is required, the PlanCRN is optional. + properties: + offeringCRN: + description: |- + OfferingCRN defines the IBM Cloud Catalog Offering CRN. Using the OfferingCRN expects that the latest version of the Offering will be used. + If a specific version should be used instead, rely on VersionCRN. + type: string + planCRN: + description: PlanCRN defines the IBM Cloud Catalog Offering Plan + CRN to use for the Offering. + type: string + versionCRN: + description: VersionCRN defines the IBM Cloud Catalog Offering + Version CRN. A specific version of the Catalog Offering will + be used, as defined by this CRN. + type: string + type: object + x-kubernetes-validations: + - message: either offeringCRN or version CRN must be provided, not + both + rule: (has(self.offeringCRN) && !has(self.versionCRN)) || (!has(self.offeringCRN) + && has(self.versionCRN)) image: description: |- Image is the OS image which would be install on the instance. @@ -270,12 +295,148 @@ spec: minLength: 1 type: string type: object + loadBalancerPoolMembers: + description: LoadBalancerPoolMembers is the set of IBM Cloud VPC Load + Balancer Backend Pools the machine should be added to as a member. + items: + description: VPCLoadBalancerBackendPoolMember represents a VPC Load + Balancer Backend Pool Member. + properties: + loadBalancer: + description: LoadBalancer defines the Load Balancer the Pool + Member is for. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + pool: + description: Pool defines the Load Balancer Pool the Pool Member + should be in. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + port: + description: Port defines the Port the Load Balancer Pool Member + listens for traffic. + format: int64 + type: integer + weight: + description: Weight of the service member. Only applicable if + the pool algorithm is "weighted_round_robin". + format: int64 + type: integer + required: + - loadBalancer + - pool + - port + type: object + type: array name: description: Name of the instance. type: string + placementTarget: + description: PlacementTarget is the placement restrictions to use + for the virtual server instance. No restrictions are used when this + field is not defined. + properties: + dedicatedHost: + description: DedicatedHost defines the Dedicated Host to place + a VPC Machine (Instance) on. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + dedicatedHostGroup: + description: DedicatedHostGroup defines the Dedicated Host Group + to use when placing a VPC Machine (Instance). + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + placementGroup: + description: PlacementGroup defines the Placement Group to use + when placing a VPC Machine (Instance). + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + type: object + x-kubernetes-validations: + - message: only one of dedicatedHost, dedicatedHostGroup, or placementGroup + must be defined for machine placement + rule: (has(self.dedicatedHost) && !has(self.dedicatedHostGroup) + && !has(self.placementGroup)) || (!has(self.dedicatedHost) && + has(self.dedicatedHostGroup) && !has(self.placementGroup)) || + (!has(self.dedicatedHost) && !has(self.dedicatedHostGroup) && + has(self.placementGroup)) primaryNetworkInterface: description: PrimaryNetworkInterface is required to specify subnet. properties: + securityGroups: + description: SecurityGroups defines a set of IBM Cloud VPC Security + Groups to attach to the network interface. + items: + description: VPCResource represents a VPC resource. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + type: array subnet: description: Subnet ID of the network interface. type: string @@ -321,7 +482,8 @@ spec: description: IBMVPCMachineStatus defines the observed state of IBMVPCMachine. properties: addresses: - description: Addresses contains the GCP instance associated addresses. + description: Addresses contains the IBM Cloud instance associated + addresses. items: description: NodeAddress contains information for the node's address. properties: @@ -337,12 +499,125 @@ spec: - type type: object type: array + conditions: + description: Conditions deefines current service state of the IBMVPCMachine. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: |- + Last time the condition transitioned from one status to another. + This should be when the underlying condition changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: |- + A human readable message indicating details about the transition. + This field may be empty. + type: string + reason: + description: |- + The reason for the condition's last transition in CamelCase. + The specific API may choose whether or not this field is considered a guaranteed API. + This field may not be empty. + type: string + severity: + description: |- + Severity provides an explicit classification of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. + The Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: |- + Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources like Available, but because arbitrary conditions + can be useful (see .node.status.conditions), the ability to deconflict is important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureMessage: + description: |- + FailureMessage will be set in the event that there is a terminal problem + reconciling the Machine and will contain a more verbose string suitable + for logging and human consumption. + type: string + failureReason: + description: |- + FailureReason will be set in the event that there is a terminal problem + reconciling the Machine and will contain a succinct value suitable + for machine interpretation. + type: string instanceID: + description: InstanceID defines the IBM Cloud VPC Instance UUID. type: string instanceState: - description: InstanceStatus is the status of the GCP instance for - this machine. + description: InstanceStatus is the status of the IBM Cloud instance + for this machine. type: string + loadBalancerPoolMembers: + description: LoadBalancerPoolMembers is the status of IBM Cloud VPC + Load Balancer Backend Pools the machine is a member. + items: + description: VPCLoadBalancerBackendPoolMember represents a VPC Load + Balancer Backend Pool Member. + properties: + loadBalancer: + description: LoadBalancer defines the Load Balancer the Pool + Member is for. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + pool: + description: Pool defines the Load Balancer Pool the Pool Member + should be in. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + port: + description: Port defines the Port the Load Balancer Pool Member + listens for traffic. + format: int64 + type: integer + weight: + description: Weight of the service member. Only applicable if + the pool algorithm is "weighted_round_robin". + format: int64 + type: integer + required: + - loadBalancer + - pool + - port + type: object + type: array ready: description: Ready is true when the provider resource is ready. type: boolean diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml index 34a03f25d..4bff4f065 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml @@ -244,6 +244,31 @@ spec: format: int64 type: integer type: object + catalogOffering: + description: |- + CatalogOffering is the Catalog Offering OS image which would be installed on the instance. + An OfferingCRN or VersionCRN is required, the PlanCRN is optional. + properties: + offeringCRN: + description: |- + OfferingCRN defines the IBM Cloud Catalog Offering CRN. Using the OfferingCRN expects that the latest version of the Offering will be used. + If a specific version should be used instead, rely on VersionCRN. + type: string + planCRN: + description: PlanCRN defines the IBM Cloud Catalog Offering + Plan CRN to use for the Offering. + type: string + versionCRN: + description: VersionCRN defines the IBM Cloud Catalog + Offering Version CRN. A specific version of the Catalog + Offering will be used, as defined by this CRN. + type: string + type: object + x-kubernetes-validations: + - message: either offeringCRN or version CRN must be provided, + not both + rule: (has(self.offeringCRN) && !has(self.versionCRN)) || + (!has(self.offeringCRN) && has(self.versionCRN)) image: description: |- Image is the OS image which would be install on the instance. @@ -258,13 +283,150 @@ spec: minLength: 1 type: string type: object + loadBalancerPoolMembers: + description: LoadBalancerPoolMembers is the set of IBM Cloud + VPC Load Balancer Backend Pools the machine should be added + to as a member. + items: + description: VPCLoadBalancerBackendPoolMember represents + a VPC Load Balancer Backend Pool Member. + properties: + loadBalancer: + description: LoadBalancer defines the Load Balancer + the Pool Member is for. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + pool: + description: Pool defines the Load Balancer Pool the + Pool Member should be in. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + port: + description: Port defines the Port the Load Balancer + Pool Member listens for traffic. + format: int64 + type: integer + weight: + description: Weight of the service member. Only applicable + if the pool algorithm is "weighted_round_robin". + format: int64 + type: integer + required: + - loadBalancer + - pool + - port + type: object + type: array name: description: Name of the instance. type: string + placementTarget: + description: PlacementTarget is the placement restrictions + to use for the virtual server instance. No restrictions + are used when this field is not defined. + properties: + dedicatedHost: + description: DedicatedHost defines the Dedicated Host + to place a VPC Machine (Instance) on. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + dedicatedHostGroup: + description: DedicatedHostGroup defines the Dedicated + Host Group to use when placing a VPC Machine (Instance). + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + placementGroup: + description: PlacementGroup defines the Placement Group + to use when placing a VPC Machine (Instance). + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + type: object + x-kubernetes-validations: + - message: only one of dedicatedHost, dedicatedHostGroup, + or placementGroup must be defined for machine placement + rule: (has(self.dedicatedHost) && !has(self.dedicatedHostGroup) + && !has(self.placementGroup)) || (!has(self.dedicatedHost) + && has(self.dedicatedHostGroup) && !has(self.placementGroup)) + || (!has(self.dedicatedHost) && !has(self.dedicatedHostGroup) + && has(self.placementGroup)) primaryNetworkInterface: description: PrimaryNetworkInterface is required to specify subnet. properties: + securityGroups: + description: SecurityGroups defines a set of IBM Cloud + VPC Security Groups to attach to the network interface. + items: + description: VPCResource represents a VPC resource. + properties: + id: + description: id of the resource. + minLength: 1 + type: string + name: + description: name of the resource. + minLength: 1 + type: string + type: object + x-kubernetes-validations: + - message: an id or name must be provided + rule: has(self.id) || has(self.name) + type: array subnet: description: Subnet ID of the network interface. type: string