From bd67555536a3a6ef69ea2c45ce1dcb7d1dfc9b54 Mon Sep 17 00:00:00 2001 From: Hans Rakers Date: Thu, 11 Jul 2024 08:04:25 +0200 Subject: [PATCH] fix(api): ready should not be required as a status field --- api/v1beta3/cloudstackaffinitygroup_types.go | 3 +- api/v1beta3/cloudstackcluster_types.go | 3 +- api/v1beta3/cloudstackfailuredomain_types.go | 9 +++--- .../cloudstackisolatednetwork_types.go | 1 + api/v1beta3/cloudstackmachine_types.go | 31 ++++++++++--------- .../cloudstackmachinestatechecker_types.go | 1 + .../cloudstackmachinetemplate_types.go | 2 +- ...ter.x-k8s.io_cloudstackaffinitygroups.yaml | 2 -- ...e.cluster.x-k8s.io_cloudstackclusters.yaml | 2 -- ...ter.x-k8s.io_cloudstackfailuredomains.yaml | 2 -- ...r.x-k8s.io_cloudstackisolatednetworks.yaml | 2 -- ...e.cluster.x-k8s.io_cloudstackmachines.yaml | 2 -- ...k8s.io_cloudstackmachinestatecheckers.yaml | 2 -- ...ster.x-k8s.io_cloudstackmachineowners.yaml | 19 +++++++----- 14 files changed, 40 insertions(+), 41 deletions(-) diff --git a/api/v1beta3/cloudstackaffinitygroup_types.go b/api/v1beta3/cloudstackaffinitygroup_types.go index bbb1fd2f..961f2e85 100644 --- a/api/v1beta3/cloudstackaffinitygroup_types.go +++ b/api/v1beta3/cloudstackaffinitygroup_types.go @@ -36,13 +36,14 @@ type CloudStackAffinityGroupSpec struct { ID string `json:"id,omitempty"` // FailureDomainName -- the name of the FailureDomain the machine is placed in. - // +optional + //+optional FailureDomainName string `json:"failureDomainName,omitempty"` } // CloudStackAffinityGroupStatus defines the observed state of CloudStackAffinityGroup type CloudStackAffinityGroupStatus struct { // Reflects the readiness of the CS Affinity Group. + //+optional Ready bool `json:"ready"` } diff --git a/api/v1beta3/cloudstackcluster_types.go b/api/v1beta3/cloudstackcluster_types.go index 1b47ff89..309caefd 100644 --- a/api/v1beta3/cloudstackcluster_types.go +++ b/api/v1beta3/cloudstackcluster_types.go @@ -40,10 +40,11 @@ type CloudStackClusterSpec struct { type CloudStackClusterStatus struct { // CAPI recognizes failure domains as a method to spread machines. // CAPC sets failure domains to indicate functioning CloudStackFailureDomains. - // +optional + //+optional FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"` // Reflects the readiness of the CS cluster. + //+optional Ready bool `json:"ready"` } diff --git a/api/v1beta3/cloudstackfailuredomain_types.go b/api/v1beta3/cloudstackfailuredomain_types.go index 9b03610b..be3f5e48 100644 --- a/api/v1beta3/cloudstackfailuredomain_types.go +++ b/api/v1beta3/cloudstackfailuredomain_types.go @@ -44,11 +44,11 @@ const ( type Network struct { // Cloudstack Network ID the cluster is built in. - // +optional + //+optional ID string `json:"id,omitempty"` // Cloudstack Network Type the cluster is built in. - // +optional + //+optional Type string `json:"type,omitempty"` // Cloudstack Network Name the cluster is built in. @@ -82,11 +82,11 @@ type CloudStackFailureDomainSpec struct { Zone CloudStackZoneSpec `json:"zone"` // CloudStack account. - // +optional + //+optional Account string `json:"account,omitempty"` // CloudStack domain. - // +optional + //+optional Domain string `json:"domain,omitempty"` // Apache CloudStack Endpoint secret reference. @@ -96,6 +96,7 @@ type CloudStackFailureDomainSpec struct { // CloudStackFailureDomainStatus defines the observed state of CloudStackFailureDomain type CloudStackFailureDomainStatus struct { // Reflects the readiness of the CloudStack Failure Domain. + //+optional Ready bool `json:"ready"` } diff --git a/api/v1beta3/cloudstackisolatednetwork_types.go b/api/v1beta3/cloudstackisolatednetwork_types.go index 5ff17317..1e5db27d 100644 --- a/api/v1beta3/cloudstackisolatednetwork_types.go +++ b/api/v1beta3/cloudstackisolatednetwork_types.go @@ -54,6 +54,7 @@ type CloudStackIsolatedNetworkStatus struct { LBRuleID string `json:"loadBalancerRuleID,omitempty"` // Ready indicates the readiness of this provider resource. + //+optional Ready bool `json:"ready"` } diff --git a/api/v1beta3/cloudstackmachine_types.go b/api/v1beta3/cloudstackmachine_types.go index db981b50..4a43c087 100644 --- a/api/v1beta3/cloudstackmachine_types.go +++ b/api/v1beta3/cloudstackmachine_types.go @@ -54,42 +54,42 @@ type CloudStackMachineSpec struct { Template CloudStackResourceIdentifier `json:"template"` // CloudStack disk offering to use. - // +optional + //+optional DiskOffering *CloudStackResourceDiskOffering `json:"diskOffering,omitempty"` // CloudStack ssh key to use. - // +optional + //+optional SSHKey string `json:"sshKey"` // Optional details map for deployVirtualMachine Details map[string]string `json:"details,omitempty"` // Optional affinitygroupids for deployVirtualMachine - // +optional + //+optional AffinityGroupIDs []string `json:"affinityGroupIDs,omitempty"` // Mutually exclusive parameter with AffinityGroupIDs. // Defaults to `no`. Can be `pro` or `anti`. Will create an affinity group per machine set. - // +optional + //+optional Affinity string `json:"affinity,omitempty"` // Mutually exclusive parameter with AffinityGroupIDs. // Is a reference to a CloudStack affinity group CRD. - // +optional + //+optional AffinityGroupRef *corev1.ObjectReference `json:"cloudstackAffinityRef,omitempty"` // The CS specific unique identifier. Of the form: fmt.Sprintf("cloudstack:///%s", CS Machine ID) - // +optional + //+optional ProviderID *string `json:"providerID,omitempty"` // FailureDomainName -- the name of the FailureDomain the machine is placed in. - // +optional + //+optional FailureDomainName string `json:"failureDomainName,omitempty"` // UncompressedUserData specifies whether the user data is gzip-compressed. // cloud-init has built-in support for gzip-compressed user data, ignition does not // - // +optional + //+optional UncompressedUserData *bool `json:"uncompressedUserData,omitempty"` } @@ -99,18 +99,18 @@ func (c *CloudStackMachine) CompressUserdata() bool { type CloudStackResourceIdentifier struct { // Cloudstack resource ID. - // +optional + //+optional ID string `json:"id,omitempty"` // Cloudstack resource Name - // +optional + //+optional Name string `json:"name,omitempty"` } type CloudStackResourceDiskOffering struct { CloudStackResourceIdentifier `json:",inline"` // Desired disk size. Used if disk offering is customizable as indicated by the ACS field 'Custom Disk Size'. - // +optional + //+optional CustomSize int64 `json:"customSizeInGB"` // mount point the data disk uses to mount. The actual partition, mkfs and mount are done by cloud-init generated by kubeadmConfig. MountPath string `json:"mountPath"` @@ -128,22 +128,23 @@ type CloudStackMachineStatus struct { Addresses []corev1.NodeAddress `json:"addresses,omitempty"` // InstanceState is the state of the CloudStack instance for this machine. - // +optional + //+optional InstanceState string `json:"instanceState,omitempty"` // InstanceStateLastUpdated is the time the instance state was last updated. - // +optional + //+optional InstanceStateLastUpdated metav1.Time `json:"instanceStateLastUpdated,omitempty"` // Ready indicates the readiness of the provider resource. + //+optional Ready bool `json:"ready"` // Status indicates the status of the provider resource. - // +optional + //+optional Status *string `json:"status,omitempty"` // Reason indicates the reason of status failure - // +optional + //+optional Reason *string `json:"reason,omitempty"` } diff --git a/api/v1beta3/cloudstackmachinestatechecker_types.go b/api/v1beta3/cloudstackmachinestatechecker_types.go index 196f277c..b47641c8 100644 --- a/api/v1beta3/cloudstackmachinestatechecker_types.go +++ b/api/v1beta3/cloudstackmachinestatechecker_types.go @@ -27,6 +27,7 @@ type CloudStackMachineStateCheckerSpec struct { // CloudStackMachineStateCheckerStatus defines the observed state of CloudStackMachineStateChecker type CloudStackMachineStateCheckerStatus struct { // Reflects the readiness of the Machine State Checker. + //+optional Ready bool `json:"ready"` } diff --git a/api/v1beta3/cloudstackmachinetemplate_types.go b/api/v1beta3/cloudstackmachinetemplate_types.go index 16b54fb1..25e76319 100644 --- a/api/v1beta3/cloudstackmachinetemplate_types.go +++ b/api/v1beta3/cloudstackmachinetemplate_types.go @@ -25,7 +25,7 @@ import ( type CloudStackMachineTemplateResource struct { // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional + //+optional ObjectMeta clusterv1.ObjectMeta `json:"metadata,omitempty"` // Spec is the specification of a desired behavior of the machine diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackaffinitygroups.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackaffinitygroups.yaml index 36966377..ee6a4b54 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackaffinitygroups.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackaffinitygroups.yaml @@ -176,8 +176,6 @@ spec: ready: description: Reflects the readiness of the CS Affinity Group. type: boolean - required: - - ready type: object type: object served: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackclusters.yaml index ec722cac..26ef8b09 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackclusters.yaml @@ -465,8 +465,6 @@ spec: ready: description: Reflects the readiness of the CS cluster. type: boolean - required: - - ready type: object type: object served: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackfailuredomains.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackfailuredomains.yaml index 793b7348..5d59fa92 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackfailuredomains.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackfailuredomains.yaml @@ -208,8 +208,6 @@ spec: ready: description: Reflects the readiness of the CloudStack Failure Domain. type: boolean - required: - - ready type: object required: - spec diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackisolatednetworks.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackisolatednetworks.yaml index e984e1f6..7fa68b52 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackisolatednetworks.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackisolatednetworks.yaml @@ -233,8 +233,6 @@ spec: ready: description: Ready indicates the readiness of this provider resource. type: boolean - required: - - ready type: object type: object served: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachines.yaml index fdf0ea4f..746d5512 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachines.yaml @@ -736,8 +736,6 @@ spec: status: description: Status indicates the status of the provider resource. type: string - required: - - ready type: object type: object served: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachinestatecheckers.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachinestatecheckers.yaml index 1e286f9e..38d6dd47 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachinestatecheckers.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_cloudstackmachinestatecheckers.yaml @@ -141,8 +141,6 @@ spec: ready: description: Reflects the readiness of the Machine State Checker. type: boolean - required: - - ready type: object type: object served: true diff --git a/test/fakes/fakes.infrastructure.cluster.x-k8s.io_cloudstackmachineowners.yaml b/test/fakes/fakes.infrastructure.cluster.x-k8s.io_cloudstackmachineowners.yaml index 619fd48a..f8a7c46e 100644 --- a/test/fakes/fakes.infrastructure.cluster.x-k8s.io_cloudstackmachineowners.yaml +++ b/test/fakes/fakes.infrastructure.cluster.x-k8s.io_cloudstackmachineowners.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.12.0 + controller-gen.kubebuilder.io/version: v0.14.0 name: cloudstackmachineowners.fakes.infrastructure.cluster.x-k8s.io spec: group: fakes.infrastructure.cluster.x-k8s.io @@ -21,14 +21,19 @@ spec: (machineset, etcdadmcluster, kubeadmcontrolplane) properties: apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources type: string kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds type: string metadata: type: object