diff --git a/api/v1alpha1/ionoscloudcluster_types.go b/api/v1alpha1/ionoscloudcluster_types.go index 4f8f2f8..28d26a1 100644 --- a/api/v1alpha1/ionoscloudcluster_types.go +++ b/api/v1alpha1/ionoscloudcluster_types.go @@ -85,10 +85,12 @@ type IONOSCloudClusterSpec struct { Location Location `json:"location"` // +kubebuilder:validation:MinLength=1 - IdentityName string `json:"identityName"` + IdentityName string `json:"identityName"` + // +optional ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` - Lans []IONOSLanSpec `json:"lans,omitempty"` - LoadBalancer IONOSLoadBalancerSpec `json:"loadBalancer,omitempty"` + // +optional + Lans []IONOSLanSpec `json:"lans,omitempty"` + LoadBalancer IONOSLoadBalancerSpec `json:"loadBalancer,omitempty"` // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="DataCenterID is immutable" DataCenterID string `json:"dataCenterID,omitempty"` diff --git a/api/v1alpha1/ionoscloudclustertemplate_types.go b/api/v1alpha1/ionoscloudclustertemplate_types.go index 0cccc08..4d91cdc 100644 --- a/api/v1alpha1/ionoscloudclustertemplate_types.go +++ b/api/v1alpha1/ionoscloudclustertemplate_types.go @@ -26,12 +26,7 @@ type IONOSCloudClusterTemplateSpec struct { } type IONOSCloudClusterTemplateResource struct { - Spec IONOSCloudClusterTemplateClusterSpec `json:"spec"` -} - -type IONOSCloudClusterTemplateClusterSpec struct { - // +kubebuilder:validation:MinLength=1 - IdentityName string `json:"identityName"` + Spec IONOSCloudClusterSpec `json:"spec"` } // +kubebuilder:object:root=true diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 10030f1..f38bb87 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -26,6 +26,30 @@ import ( "sigs.k8s.io/cluster-api/api/v1beta1" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IONOSCloudBaseClusterSpec) DeepCopyInto(out *IONOSCloudBaseClusterSpec) { + *out = *in + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.Lans != nil { + in, out := &in.Lans, &out.Lans + *out = make([]IONOSLanSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + out.LoadBalancer = in.LoadBalancer +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IONOSCloudBaseClusterSpec. +func (in *IONOSCloudBaseClusterSpec) DeepCopy() *IONOSCloudBaseClusterSpec { + if in == nil { + return nil + } + out := new(IONOSCloudBaseClusterSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IONOSCloudCluster) DeepCopyInto(out *IONOSCloudCluster) { *out = *in @@ -184,15 +208,7 @@ func (in *IONOSCloudClusterList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IONOSCloudClusterSpec) DeepCopyInto(out *IONOSCloudClusterSpec) { *out = *in - out.ControlPlaneEndpoint = in.ControlPlaneEndpoint - if in.Lans != nil { - in, out := &in.Lans, &out.Lans - *out = make([]IONOSLanSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - out.LoadBalancer = in.LoadBalancer + in.IONOSCloudBaseClusterSpec.DeepCopyInto(&out.IONOSCloudBaseClusterSpec) if in.PublicLanID != nil { in, out := &in.PublicLanID, &out.PublicLanID *out = new(int32) @@ -247,7 +263,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. @@ -268,21 +284,6 @@ func (in *IONOSCloudClusterTemplate) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *IONOSCloudClusterTemplateClusterSpec) DeepCopyInto(out *IONOSCloudClusterTemplateClusterSpec) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IONOSCloudClusterTemplateClusterSpec. -func (in *IONOSCloudClusterTemplateClusterSpec) DeepCopy() *IONOSCloudClusterTemplateClusterSpec { - if in == nil { - return nil - } - out := new(IONOSCloudClusterTemplateClusterSpec) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IONOSCloudClusterTemplateList) DeepCopyInto(out *IONOSCloudClusterTemplateList) { *out = *in @@ -318,7 +319,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. @@ -334,7 +335,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 229f850..2bd16ec 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclusters.yaml @@ -130,7 +130,6 @@ spec: - message: PublicLanID is immutable rule: self == oldSelf required: - - controlPlaneEndpoint - identityName - location type: object 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 f5a6bc8..07d3887 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ionoscloudclustertemplates.yaml @@ -39,13 +39,120 @@ spec: template: properties: spec: + description: IONOSCloudClusterSpec defines the desired state of + IONOSCloudCluster properties: + controlPlaneEndpoint: + description: APIEndpoint represents a reachable Kubernetes + API endpoint. + properties: + host: + description: The hostname on which the API server is serving. + type: string + port: + description: The port on which the API server is serving. + format: int32 + type: integer + required: + - host + - port + type: object + dataCenterID: + type: string + x-kubernetes-validations: + - message: DataCenterID is immutable + rule: self == oldSelf identityName: minLength: 1 type: string + internetLanID: + format: int32 + type: integer + x-kubernetes-validations: + - message: InternetLanID is immutable + rule: self == oldSelf + lans: + items: + properties: + lanID: + format: int32 + type: integer + name: + type: string + public: + type: boolean + required: + - name + - public + type: object + type: array + loadBalancer: + properties: + id: + type: string + listenerLanRef: + properties: + name: + type: string + required: + - name + type: object + targetLanRef: + properties: + name: + type: string + required: + - name + type: object + required: + - listenerLanRef + - targetLanRef + type: object + loadBalancerID: + type: string + x-kubernetes-validations: + - message: LoadBalancerID is immutable + rule: self == oldSelf + location: + enum: + - es/vlt + - fr/par + - de/txl + - de/fra + - gb-lhr + - us-ewr + - us-las + type: string + x-kubernetes-validations: + - message: Location is immutable + rule: self == oldSelf + privateLanID: + format: int32 + type: integer + x-kubernetes-validations: + - message: PrivateLanID is immutable + rule: self == oldSelf + publicLanID: + format: int32 + type: integer + x-kubernetes-validations: + - message: PublicLanID is immutable + rule: self == oldSelf required: - identityName + - location type: object + x-kubernetes-validations: + - message: DataCenterID is required once set + rule: '!has(oldSelf.dataCenterID) || has(self.dataCenterID)' + - message: LoadBalancerID is required once set + rule: '!has(oldSelf.loadBalancerID) || has(self.loadBalancerID)' + - message: PublicLanID is required once set + rule: '!has(oldSelf.publicLanID) || has(self.publicLanID)' + - message: InternetLanID is required once set + rule: '!has(oldSelf.internetLanID) || has(self.internetLanID)' + - message: PrivateLanID is required once set + rule: '!has(oldSelf.privateLanID) || has(self.privateLanID)' required: - spec type: object