diff --git a/api/v1alpha1/ionoscloudcluster_types.go b/api/v1alpha1/ionoscloudcluster_types.go index 08183ffa..8f3c27b3 100644 --- a/api/v1alpha1/ionoscloudcluster_types.go +++ b/api/v1alpha1/ionoscloudcluster_types.go @@ -53,6 +53,10 @@ type IonosCloudClusterSpec struct { // CredentialsRef is a reference to the secret containing the credentials to access the IONOS Cloud API. //+kubebuilder:validation:XValidation:rule="has(self.name) && self.name != ''",message="credentialsRef.name must be provided" CredentialsRef corev1.LocalObjectReference `json:"credentialsRef"` + + // LoadBalancerProviderRef is a reference to the load balancer provider configuration. + // An empty loadBalancerProviderRef field is allowed and means to disable any load balancer logic. + LoadBalancerProviderRef *corev1.LocalObjectReference `json:"loadBalancerProviderRef,omitempty"` } // IonosCloudClusterStatus defines the observed state of IonosCloudCluster. diff --git a/api/v1alpha1/ionoscloudcluster_types_test.go b/api/v1alpha1/ionoscloudcluster_types_test.go index 7bab6cf0..a0e3ad8e 100644 --- a/api/v1alpha1/ionoscloudcluster_types_test.go +++ b/api/v1alpha1/ionoscloudcluster_types_test.go @@ -58,6 +58,9 @@ func defaultCluster() *IonosCloudCluster { }, Location: "de/txl", CredentialsRef: corev1.LocalObjectReference{Name: "secret-name"}, + LoadBalancerProviderRef: &corev1.LocalObjectReference{ + Name: "fake-lb-provider", + }, }, } } diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 2dce7758..75adbd9c 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1alpha1 import ( + "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" @@ -46,7 +47,7 @@ func (in *IonosCloudCluster) DeepCopyInto(out *IonosCloudCluster) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) in.Status.DeepCopyInto(&out.Status) } @@ -105,6 +106,11 @@ func (in *IonosCloudClusterSpec) DeepCopyInto(out *IonosCloudClusterSpec) { *out = *in out.ControlPlaneEndpoint = in.ControlPlaneEndpoint out.CredentialsRef = in.CredentialsRef + if in.LoadBalancerProviderRef != nil { + in, out := &in.LoadBalancerProviderRef, &out.LoadBalancerProviderRef + *out = new(v1.LocalObjectReference) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IonosCloudClusterSpec. @@ -156,7 +162,7 @@ func (in *IonosCloudClusterTemplate) DeepCopyInto(out *IonosCloudClusterTemplate *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IonosCloudClusterTemplate. @@ -212,7 +218,7 @@ func (in *IonosCloudClusterTemplateList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IonosCloudClusterTemplateResource) DeepCopyInto(out *IonosCloudClusterTemplateResource) { *out = *in - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IonosCloudClusterTemplateResource. @@ -228,7 +234,7 @@ func (in *IonosCloudClusterTemplateResource) DeepCopy() *IonosCloudClusterTempla // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IonosCloudClusterTemplateSpec) DeepCopyInto(out *IonosCloudClusterTemplateSpec) { *out = *in - out.Template = in.Template + in.Template.DeepCopyInto(&out.Template) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IonosCloudClusterTemplateSpec. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclusters.yaml index ede97de7..ec4be741 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclusters.yaml @@ -96,6 +96,19 @@ spec: x-kubernetes-validations: - message: credentialsRef.name must be provided rule: has(self.name) && self.name != '' + loadBalancerProviderRef: + description: |- + LoadBalancerProviderRef is a reference to the load balancer provider configuration. + An empty loadBalancerProviderRef field is allowed and means to disable any load balancer logic. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic location: description: Location is the location where the data centers should be located. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclustertemplates.yaml index 542cc7b0..a5f4453a 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclustertemplates.yaml @@ -88,6 +88,19 @@ spec: x-kubernetes-validations: - message: credentialsRef.name must be provided rule: has(self.name) && self.name != '' + loadBalancerProviderRef: + description: |- + LoadBalancerProviderRef is a reference to the load balancer provider configuration. + An empty loadBalancerProviderRef field is allowed and means to disable any load balancer logic. + properties: + name: + description: |- + Name of the referent. + More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid? + type: string + type: object + x-kubernetes-map-type: atomic location: description: Location is the location where the data centers should be located.