From 9569cd60e39f2bef80a3a7b293b920cad4f052be Mon Sep 17 00:00:00 2001 From: Fabrizio Pandini Date: Fri, 4 Oct 2024 10:38:27 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20v1beta2=20structs=20to=20obje?= =?UTF-8?q?ct=20status=20(#11234)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add v1beta2 structs and implement new condition interface * Generated files and fix conversions * Fix tests and in place propagation for MachineDeployment and MachineSet * Address comments * More comments * Add MaxItems=32 to conditions --- api/v1beta1/cluster_types.go | 111 ++++ api/v1beta1/clusterclass_types.go | 32 ++ api/v1beta1/machine_types.go | 72 +++ api/v1beta1/machinedeployment_types.go | 44 ++ api/v1beta1/machinehealthcheck_types.go | 32 ++ api/v1beta1/machineset_types.go | 44 ++ api/v1beta1/v1beta2_condition_consts.go | 258 +++++++++ api/v1beta1/zz_generated.deepcopy.go | 322 +++++++++++ api/v1beta1/zz_generated.openapi.go | 522 +++++++++++++++++- .../api/v1beta1/kubeadmconfig_types.go | 32 ++ .../api/v1beta1/v1beta2_condition_consts.go | 33 ++ .../api/v1beta1/zz_generated.deepcopy.go | 27 + ...strap.cluster.x-k8s.io_kubeadmconfigs.yaml | 69 +++ ....cluster.x-k8s.io_clusterresourcesets.yaml | 68 +++ .../cluster.x-k8s.io_clusterclasses.yaml | 69 +++ .../crd/bases/cluster.x-k8s.io_clusters.yaml | 165 ++++++ .../cluster.x-k8s.io_machinedeployments.yaml | 120 ++++ .../cluster.x-k8s.io_machinehealthchecks.yaml | 69 +++ .../bases/cluster.x-k8s.io_machinepools.yaml | 120 ++++ .../crd/bases/cluster.x-k8s.io_machines.yaml | 106 ++++ .../bases/cluster.x-k8s.io_machinesets.yaml | 120 ++++ .../v1beta1/kubeadm_control_plane_types.go | 45 ++ .../api/v1beta1/v1beta2_condition_consts.go | 75 +++ .../api/v1beta1/zz_generated.deepcopy.go | 42 ++ ...cluster.x-k8s.io_kubeadmcontrolplanes.yaml | 88 +++ .../api/v1beta1/clusterresourceset_types.go | 31 ++ .../api/v1beta1/v1beta2_condition_consts.go | 32 ++ .../api/v1beta1/zz_generated.deepcopy.go | 28 + exp/api/v1beta1/machinepool_types.go | 44 ++ exp/api/v1beta1/v1beta2_condition_consts.go | 52 ++ exp/api/v1beta1/zz_generated.deepcopy.go | 43 ++ .../runtime-openapi-gen/vendored_openapi.go | 62 +++ .../bootstrap/kubeadm/v1alpha3/conversion.go | 6 + .../v1alpha3/zz_generated.conversion.go | 16 +- .../bootstrap/kubeadm/v1alpha4/conversion.go | 6 + .../v1alpha4/zz_generated.conversion.go | 16 +- .../kubeadm/v1alpha3/conversion.go | 2 + .../v1alpha3/zz_generated.conversion.go | 1 + .../kubeadm/v1alpha4/conversion.go | 2 + .../v1alpha4/zz_generated.conversion.go | 1 + .../core/exp/addons/v1alpha3/conversion.go | 25 +- .../v1alpha3/zz_generated.conversion.go | 40 +- .../core/exp/addons/v1alpha4/conversion.go | 25 +- .../v1alpha4/zz_generated.conversion.go | 40 +- internal/apis/core/exp/v1alpha3/conversion.go | 8 + .../exp/v1alpha3/zz_generated.conversion.go | 16 +- internal/apis/core/exp/v1alpha4/conversion.go | 8 + .../apis/core/exp/v1alpha4/conversion_test.go | 7 +- .../exp/v1alpha4/zz_generated.conversion.go | 14 +- internal/apis/core/v1alpha3/conversion.go | 29 +- .../core/v1alpha3/zz_generated.conversion.go | 37 +- internal/apis/core/v1alpha4/conversion.go | 61 +- .../apis/core/v1alpha4/conversion_test.go | 10 +- .../core/v1alpha4/zz_generated.conversion.go | 106 ++-- .../machinedeployment_sync.go | 1 + .../machinedeployment_sync_test.go | 4 + .../machinedeployment/mdutil/util.go | 1 + .../machinedeployment/mdutil/util_test.go | 51 +- .../machineset/machineset_controller.go | 2 + .../machineset/machineset_controller_test.go | 4 + .../docker/api/v1alpha3/conversion.go | 10 + .../api/v1alpha3/zz_generated.conversion.go | 32 +- .../docker/api/v1alpha4/conversion.go | 10 + .../api/v1alpha4/zz_generated.conversion.go | 32 +- .../docker/api/v1beta1/dockercluster_types.go | 32 ++ .../docker/api/v1beta1/dockermachine_types.go | 32 ++ .../api/v1beta1/v1beta2_condition_consts.go | 64 +++ .../api/v1beta1/zz_generated.deepcopy.go | 54 ++ ...cture.cluster.x-k8s.io_dockerclusters.yaml | 69 +++ ...cture.cluster.x-k8s.io_dockermachines.yaml | 69 +++ .../api/v1alpha1/inmemorycluster_types.go | 31 ++ .../api/v1alpha1/inmemorymachine_types.go | 31 ++ .../api/v1alpha1/zz_generated.deepcopy.go | 55 ++ ...ure.cluster.x-k8s.io_inmemoryclusters.yaml | 68 +++ ...ure.cluster.x-k8s.io_inmemorymachines.yaml | 68 +++ 75 files changed, 3947 insertions(+), 226 deletions(-) create mode 100644 api/v1beta1/v1beta2_condition_consts.go create mode 100644 bootstrap/kubeadm/api/v1beta1/v1beta2_condition_consts.go create mode 100644 controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go create mode 100644 exp/addons/api/v1beta1/v1beta2_condition_consts.go create mode 100644 exp/api/v1beta1/v1beta2_condition_consts.go create mode 100644 test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go diff --git a/api/v1beta1/cluster_types.go b/api/v1beta1/cluster_types.go index ccefcd69468b..d51fecb2924d 100644 --- a/api/v1beta1/cluster_types.go +++ b/api/v1beta1/cluster_types.go @@ -72,6 +72,27 @@ type ClusterSpec struct { // this feature is highly experimental, and parts of it might still be not implemented. // +optional Topology *Topology `json:"topology,omitempty"` + + // availabilityGates specifies additional conditions to include when evaluating Cluster Available condition. + // + // NOTE: this field is considered only for computing v1beta2 conditions. + // +optional + // +listType=map + // +listMapKey=conditionType + // +kubebuilder:validation:MaxItems=32 + AvailabilityGates []ClusterAvailabilityGate `json:"availabilityGates,omitempty"` +} + +// ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate. +type ClusterAvailabilityGate struct { + // conditionType refers to a positive polarity condition (status true means good) with matching type in the Cluster's condition list. + // If the conditions doesn't exist, it will be treated as unknown. + // Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates. + // +required + // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` + // +kubebuilder:validation:MaxLength=316 + // +kubebuilder:validation:MinLength=1 + ConditionType string `json:"conditionType"` } // Topology encapsulates the information of the managed resources. @@ -451,6 +472,80 @@ type ClusterStatus struct { // ObservedGeneration is the latest generation observed by the controller. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in Cluster's status with the V1Beta2 version. + // +optional + V1Beta2 *ClusterV1Beta2Status `json:"v1beta2,omitempty"` +} + +// ClusterV1Beta2Status groups all the fields that will be added or modified in Cluster with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type ClusterV1Beta2Status struct { + // conditions represents the observations of a Cluster's current state. + // Known condition types are Available, InfrastructureReady, ControlPlaneInitialized, ControlPlaneAvailable, WorkersAvailable, MachinesReady + // MachinesUpToDate, RemoteConnectionProbe, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + // Additionally, a TopologyReconciled condition will be added in case the Cluster is referencing a ClusterClass / defining a managed Topology. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // controlPlane groups all the observations about Cluster's ControlPlane current state. + // +optional + ControlPlane *ClusterControlPlaneStatus `json:"controlPlane,omitempty"` + + // workers groups all the observations about Cluster's Workers current state. + // +optional + Workers *WorkersStatus `json:"workers,omitempty"` +} + +// ClusterControlPlaneStatus groups all the observations about control plane current state. +type ClusterControlPlaneStatus struct { + // desiredReplicas is the total number of desired control plane machines in this cluster. + // +optional + DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` + + // replicas is the total number of control plane machines in this cluster. + // NOTE: replicas also includes machines still being provisioned or being deleted. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // upToDateReplicas is the number of up-to-date control plane machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true. + // +optional + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` + + // readyReplicas is the total number of ready control plane machines in this cluster. A machine is considered ready when Machine's Ready condition is true. + // +optional + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + + // availableReplicas is the total number of available control plane machines in this cluster. A machine is considered available when Machine's Available condition is true. + // +optional + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` +} + +// WorkersStatus groups all the observations about workers current state. +type WorkersStatus struct { + // desiredReplicas is the total number of desired worker machines in this cluster. + // +optional + DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` + + // replicas is the total number of worker machines in this cluster. + // NOTE: replicas also includes machines still being provisioned or being deleted. + // +optional + Replicas *int32 `json:"replicas,omitempty"` + + // upToDateReplicas is the number of up-to-date worker machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true. + // +optional + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` + + // readyReplicas is the total number of ready worker machines in this cluster. A machine is considered ready when Machine's Ready condition is true. + // +optional + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + + // availableReplicas is the total number of available worker machines in this cluster. A machine is considered available when Machine's Available condition is true. + // +optional + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` } // ANCHOR_END: ClusterStatus @@ -540,6 +635,22 @@ func (c *Cluster) SetConditions(conditions Conditions) { c.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (c *Cluster) GetV1Beta2Conditions() []metav1.Condition { + if c.Status.V1Beta2 == nil { + return nil + } + return c.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (c *Cluster) SetV1Beta2Conditions(conditions []metav1.Condition) { + if c.Status.V1Beta2 == nil && conditions != nil { + c.Status.V1Beta2 = &ClusterV1Beta2Status{} + } + c.Status.V1Beta2.Conditions = conditions +} + // GetIPFamily returns a ClusterIPFamily from the configuration provided. // // Deprecated: IPFamily is not a concept in Kubernetes. It was originally introduced in CAPI for CAPD. diff --git a/api/v1beta1/clusterclass_types.go b/api/v1beta1/clusterclass_types.go index 0ccc09795893..c72063293434 100644 --- a/api/v1beta1/clusterclass_types.go +++ b/api/v1beta1/clusterclass_types.go @@ -943,6 +943,22 @@ type ClusterClassStatus struct { // ObservedGeneration is the latest generation observed by the controller. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in ClusterClass's status with the V1Beta2 version. + // +optional + V1Beta2 *ClusterClassV1Beta2Status `json:"v1beta2,omitempty"` +} + +// ClusterClassV1Beta2Status groups all the fields that will be added or modified in ClusterClass with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type ClusterClassV1Beta2Status struct { + // conditions represents the observations of a ClusterClass's current state. + // Known condition types are VariablesReady, RefVersionsUpToDate, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // ClusterClassStatusVariable defines a variable which appears in the status of a ClusterClass. @@ -994,6 +1010,22 @@ func (c *ClusterClass) SetConditions(conditions Conditions) { c.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (c *ClusterClass) GetV1Beta2Conditions() []metav1.Condition { + if c.Status.V1Beta2 == nil { + return nil + } + return c.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (c *ClusterClass) SetV1Beta2Conditions(conditions []metav1.Condition) { + if c.Status.V1Beta2 == nil && conditions != nil { + c.Status.V1Beta2 = &ClusterClassV1Beta2Status{} + } + c.Status.V1Beta2.Conditions = conditions +} + // ANCHOR_END: ClusterClassStatus // +kubebuilder:object:root=true diff --git a/api/v1beta1/machine_types.go b/api/v1beta1/machine_types.go index 53dfabfb4cc9..8ed7c7b95662 100644 --- a/api/v1beta1/machine_types.go +++ b/api/v1beta1/machine_types.go @@ -125,6 +125,30 @@ type MachineSpec struct { // +optional FailureDomain *string `json:"failureDomain,omitempty"` + // The minimum number of seconds for which a Machine should be ready before considering it available. + // Defaults to 0 (Machine will be considered available as soon as the Machine is ready) + // NOTE: this field will be considered only for computing v1beta2 conditions. + // +optional + // TODO: This field will be added in the v1beta2 API, and act as a replacement of existing MinReadySeconds in + // MachineDeployment, MachineSet and MachinePool + // MinReadySeconds int32 `json:"minReadySeconds,omitempty"` + + // readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + // + // This field can be used e.g. by Cluster API control plane providers to extend the semantic of the + // Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates + // for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + // + // Another example are external controllers, e.g. responsible to install special software/hardware on the Machines; + // they can include the status of those components with a new condition and add this condition to ReadinessGates. + // + // NOTE: this field is considered only for computing v1beta2 conditions. + // +optional + // +listType=map + // +listMapKey=conditionType + // +kubebuilder:validation:MaxItems=32 + ReadinessGates []MachineReadinessGate `json:"readinessGates,omitempty"` + // NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. // The default value is 0, meaning that the node can be drained without any time limitations. // NOTE: NodeDrainTimeout is different from `kubectl drain --timeout` @@ -143,6 +167,18 @@ type MachineSpec struct { NodeDeletionTimeout *metav1.Duration `json:"nodeDeletionTimeout,omitempty"` } +// MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate. +type MachineReadinessGate struct { + // conditionType refers to a positive polarity condition (status true means good) with matching type in the Machine's condition list. + // If the conditions doesn't exist, it will be treated as unknown. + // Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates. + // +required + // +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$` + // +kubebuilder:validation:MaxLength=316 + // +kubebuilder:validation:MinLength=1 + ConditionType string `json:"conditionType"` +} + // ANCHOR_END: MachineSpec // ANCHOR: MachineStatus @@ -235,6 +271,26 @@ type MachineStatus struct { // Only present when the Machine has a deletionTimestamp and drain or wait for volume detach started. // +optional Deletion *MachineDeletionStatus `json:"deletion,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in Machine's status with the V1Beta2 version. + // +optional + V1Beta2 *MachineV1Beta2Status `json:"v1beta2,omitempty"` +} + +// MachineV1Beta2Status groups all the fields that will be added or modified in MachineStatus with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineV1Beta2Status struct { + // conditions represents the observations of a Machine's current state. + // Known condition types are Available, Ready, UpToDate, BootstrapConfigReady, InfrastructureReady, NodeReady, + // NodeHealthy, Deleting, Paused. + // If a MachineHealthCheck is targeting this machine, also HealthCheckSucceeded, OwnerRemediated conditions are added. + // Additionally control plane Machines controlled by KubeadmControlPlane will have following additional conditions: + // APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy, EtcdPodHealthy, EtcdMemberHealthy. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // ANCHOR_END: MachineStatus @@ -328,6 +384,22 @@ func (m *Machine) SetConditions(conditions Conditions) { m.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (m *Machine) GetV1Beta2Conditions() []metav1.Condition { + if m.Status.V1Beta2 == nil { + return nil + } + return m.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (m *Machine) SetV1Beta2Conditions(conditions []metav1.Condition) { + if m.Status.V1Beta2 == nil && conditions != nil { + m.Status.V1Beta2 = &MachineV1Beta2Status{} + } + m.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // MachineList contains a list of Machine. diff --git a/api/v1beta1/machinedeployment_types.go b/api/v1beta1/machinedeployment_types.go index bda8e7d92e15..fe4d4a198edd 100644 --- a/api/v1beta1/machinedeployment_types.go +++ b/api/v1beta1/machinedeployment_types.go @@ -298,6 +298,34 @@ type MachineDeploymentStatus struct { // Conditions defines current service state of the MachineDeployment. // +optional Conditions Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in MachineDeployment's status with the V1Beta2 version. + // +optional + V1Beta2 *MachineDeploymentV1Beta2Status `json:"v1beta2,omitempty"` +} + +// MachineDeploymentV1Beta2Status groups all the fields that will be added or modified in MachineDeployment with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineDeploymentV1Beta2Status struct { + // conditions represents the observations of a MachineDeployment's current state. + // Known condition types are Available, MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // readyReplicas is the number of ready replicas for this MachineDeployment. A machine is considered ready when Machine's Ready condition is true. + // +optional + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + + // availableReplicas is the number of available replicas for this MachineDeployment. A machine is considered available when Machine's Available condition is true. + // +optional + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + + // upToDateReplicas is the number of up-to-date replicas targeted by this deployment. A machine is considered up-to-date when Machine's UpToDate condition is true. + // +optional + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` } // ANCHOR_END: MachineDeploymentStatus @@ -388,3 +416,19 @@ func (m *MachineDeployment) GetConditions() Conditions { func (m *MachineDeployment) SetConditions(conditions Conditions) { m.Status.Conditions = conditions } + +// GetV1Beta2Conditions returns the set of conditions for this object. +func (m *MachineDeployment) GetV1Beta2Conditions() []metav1.Condition { + if m.Status.V1Beta2 == nil { + return nil + } + return m.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (m *MachineDeployment) SetV1Beta2Conditions(conditions []metav1.Condition) { + if m.Status.V1Beta2 == nil && conditions != nil { + m.Status.V1Beta2 = &MachineDeploymentV1Beta2Status{} + } + m.Status.V1Beta2.Conditions = conditions +} diff --git a/api/v1beta1/machinehealthcheck_types.go b/api/v1beta1/machinehealthcheck_types.go index 578a955238dd..e43d27854273 100644 --- a/api/v1beta1/machinehealthcheck_types.go +++ b/api/v1beta1/machinehealthcheck_types.go @@ -147,6 +147,22 @@ type MachineHealthCheckStatus struct { // Conditions defines current service state of the MachineHealthCheck. // +optional Conditions Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in MachineHealthCheck's status with the V1Beta2 version. + // +optional + V1Beta2 *MachineHealthCheckV1Beta2Status `json:"v1beta2,omitempty"` +} + +// MachineHealthCheckV1Beta2Status groups all the fields that will be added or modified in MachineHealthCheck with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineHealthCheckV1Beta2Status struct { + // conditions represents the observations of a MachineHealthCheck's current state. + // Known condition types are RemediationAllowed, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // ANCHOR_END: MachineHealthCheckStatus @@ -183,6 +199,22 @@ func (m *MachineHealthCheck) SetConditions(conditions Conditions) { m.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (m *MachineHealthCheck) GetV1Beta2Conditions() []metav1.Condition { + if m.Status.V1Beta2 == nil { + return nil + } + return m.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (m *MachineHealthCheck) SetV1Beta2Conditions(conditions []metav1.Condition) { + if m.Status.V1Beta2 == nil && conditions != nil { + m.Status.V1Beta2 = &MachineHealthCheckV1Beta2Status{} + } + m.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // MachineHealthCheckList contains a list of MachineHealthCheck. diff --git a/api/v1beta1/machineset_types.go b/api/v1beta1/machineset_types.go index f0899d48e73d..e7dc0afd4767 100644 --- a/api/v1beta1/machineset_types.go +++ b/api/v1beta1/machineset_types.go @@ -188,6 +188,34 @@ type MachineSetStatus struct { // Conditions defines current service state of the MachineSet. // +optional Conditions Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in MachineSet's status with the V1Beta2 version. + // +optional + V1Beta2 *MachineSetV1Beta2Status `json:"v1beta2,omitempty"` +} + +// MachineSetV1Beta2Status groups all the fields that will be added or modified in MachineSetStatus with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachineSetV1Beta2Status struct { + // conditions represents the observations of a MachineSet's current state. + // Known condition types are MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // readyReplicas is the number of ready replicas for this MachineSet. A machine is considered ready when Machine's Ready condition is true. + // +optional + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + + // availableReplicas is the number of available replicas for this MachineSet. A machine is considered available when Machine's Available condition is true. + // +optional + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + + // upToDateReplicas is the number of up-to-date replicas for this MachineSet. A machine is considered up-to-date when Machine's UpToDate condition is true. + // +optional + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` } // ANCHOR_END: MachineSetStatus @@ -247,6 +275,22 @@ func (m *MachineSet) SetConditions(conditions Conditions) { m.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (m *MachineSet) GetV1Beta2Conditions() []metav1.Condition { + if m.Status.V1Beta2 == nil { + return nil + } + return m.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (m *MachineSet) SetV1Beta2Conditions(conditions []metav1.Condition) { + if m.Status.V1Beta2 == nil && conditions != nil { + m.Status.V1Beta2 = &MachineSetV1Beta2Status{} + } + m.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // MachineSetList contains a list of MachineSet. diff --git a/api/v1beta1/v1beta2_condition_consts.go b/api/v1beta1/v1beta2_condition_consts.go new file mode 100644 index 000000000000..d7d92b0037db --- /dev/null +++ b/api/v1beta1/v1beta2_condition_consts.go @@ -0,0 +1,258 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +// Conditions types that are used across different objects. +const ( + // AvailableV1Beta2Condition reports if an object is available. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + AvailableV1Beta2Condition = "Available" + + // ReadyV1Beta2Condition reports if an object is ready. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + ReadyV1Beta2Condition = "Ready" + + // BootstrapConfigReadyV1Beta2Condition reports if an object's bootstrap config is ready. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + BootstrapConfigReadyV1Beta2Condition = "BootstrapConfigReady" + + // InfrastructureReadyV1Beta2Condition reports if an object's infrastructure is ready. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + InfrastructureReadyV1Beta2Condition = "InfrastructureReady" + + // MachinesReadyV1Beta2Condition surfaces detail of issues on the controlled machines, if any. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + MachinesReadyV1Beta2Condition = "MachinesReady" + + // MachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + MachinesUpToDateV1Beta2Condition = "MachinesUpToDate" + + // ScalingUpV1Beta2Condition reports if an object is scaling up. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + ScalingUpV1Beta2Condition = "ScalingUp" + + // ScalingDownV1Beta2Condition reports if an object is scaling down. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + ScalingDownV1Beta2Condition = "ScalingDown" + + // RemediatingV1Beta2Condition surfaces details about ongoing remediation of the controlled machines, if any. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + RemediatingV1Beta2Condition = "Remediating" + + // DeletingV1Beta2Condition surfaces details about progress of the object deletion workflow. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + DeletingV1Beta2Condition = "Deleting" + + // PausedV1Beta2Condition reports if reconciliation for an object or the cluster is paused. + // Note: This condition type is defined to ensure consistent naming of conditions across objects. + // Please use object specific variants of this condition which provides more details for each context where + // the same condition type exists. + PausedV1Beta2Condition = "Paused" +) + +// Conditions that will be used for the Machine object in v1Beta2 API version. +const ( + // MachineAvailableV1Beta2Condition is true if the machine is Ready for at least MinReadySeconds, as defined by the Machine's MinReadySeconds field. + MachineAvailableV1Beta2Condition = AvailableV1Beta2Condition + + // MachineReadyV1Beta2Condition is true if the Machine is not deleted, Machine's BootstrapConfigReady, InfrastructureReady, + // NodeHealthy and HealthCheckSucceeded (if present) are true; if other conditions are defined in spec.readinessGates, + // these conditions must be true as well. + MachineReadyV1Beta2Condition = ReadyV1Beta2Condition + + // MachineUpToDateV1Beta2Condition is true if the Machine spec matches the spec of the Machine's owner resource, e.g. KubeadmControlPlane or MachineDeployment. + // The Machine's owner (e.g MachineDeployment) is authoritative to set their owned Machine's UpToDate conditions based on its current spec. + MachineUpToDateV1Beta2Condition = "UpToDate" + + // MachineBootstrapConfigReadyV1Beta2Condition condition mirrors the corresponding Ready condition from the Machine's BootstrapConfig resource. + MachineBootstrapConfigReadyV1Beta2Condition = BootstrapConfigReadyV1Beta2Condition + + // MachineInfrastructureReadyV1Beta2Condition mirrors the corresponding Ready condition from the Machine's Infrastructure resource. + MachineInfrastructureReadyV1Beta2Condition = InfrastructureReadyV1Beta2Condition + + // MachineNodeHealthyV1Beta2Condition is true if the Machine's Node is ready and it does not report MemoryPressure, DiskPressure and PIDPressure. + MachineNodeHealthyV1Beta2Condition = "NodeHealthy" + + // MachineNodeReadyV1Beta2Condition is true if the Machine's Node is ready. + MachineNodeReadyV1Beta2Condition = "NodeReady" + + // MachineHealthCheckSucceededV1Beta2Condition is true if MHC instances targeting this machine report the Machine + // is healthy according to the definition of healthy present in the spec of the MachineHealthCheck object. + MachineHealthCheckSucceededV1Beta2Condition = "HealthCheckSucceeded" + + // MachineOwnerRemediatedV1Beta2Condition is only present if MHC instances targeting this machine + // determine that the controller owning this machine should perform remediation. + MachineOwnerRemediatedV1Beta2Condition = "OwnerRemediated" + + // MachineDeletingV1Beta2Condition surfaces details about progress in the machine deletion workflow. + MachineDeletingV1Beta2Condition = DeletingV1Beta2Condition + + // MachinePausedV1Beta2Condition is true if the Machine or the Cluster it belongs to are paused. + MachinePausedV1Beta2Condition = PausedV1Beta2Condition +) + +// Conditions that will be used for the MachineSet object in v1Beta2 API version. +const ( + // MachineSetMachinesReadyV1Beta2Condition surfaces detail of issues on the controlled machines, if any. + MachineSetMachinesReadyV1Beta2Condition = MachinesReadyV1Beta2Condition + + // MachineSetMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any. + MachineSetMachinesUpToDateV1Beta2Condition = MachinesUpToDateV1Beta2Condition + + // MachineSetScalingUpV1Beta2Condition is true if available replicas < desired replicas. + MachineSetScalingUpV1Beta2Condition = ScalingUpV1Beta2Condition + + // MachineSetScalingDownV1Beta2Condition is true if replicas > desired replicas. + MachineSetScalingDownV1Beta2Condition = ScalingDownV1Beta2Condition + + // MachineSetRemediatingV1Beta2Condition surfaces details about ongoing remediation of the controlled machines, if any. + MachineSetRemediatingV1Beta2Condition = RemediatingV1Beta2Condition + + // MachineSetDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. + MachineSetDeletingV1Beta2Condition = DeletingV1Beta2Condition + + // MachineSetPausedV1Beta2Condition is true if this MachineSet or the Cluster it belongs to are paused. + MachineSetPausedV1Beta2Condition = PausedV1Beta2Condition +) + +// Conditions that will be used for the MachineDeployment object in v1Beta2 API version. +const ( + // MachineDeploymentAvailableV1Beta2Condition is true if the MachineDeployment is not deleted, and it has minimum + // availability according to parameters specified in the deployment strategy, e.g. If using RollingUpgrade strategy, + // availableReplicas must be greater or equal than desired replicas - MaxUnavailable replicas. + MachineDeploymentAvailableV1Beta2Condition = AvailableV1Beta2Condition + + // MachineDeploymentMachinesReadyV1Beta2Condition surfaces detail of issues on the controlled machines, if any. + MachineDeploymentMachinesReadyV1Beta2Condition = MachinesReadyV1Beta2Condition + + // MachineDeploymentMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any. + MachineDeploymentMachinesUpToDateV1Beta2Condition = MachinesUpToDateV1Beta2Condition + + // MachineDeploymentScalingUpV1Beta2Condition is true if available replicas < desired replicas. + MachineDeploymentScalingUpV1Beta2Condition = ScalingUpV1Beta2Condition + + // MachineDeploymentScalingDownV1Beta2Condition is true if replicas > desired replicas. + MachineDeploymentScalingDownV1Beta2Condition = ScalingDownV1Beta2Condition + + // MachineDeploymentRemediatingV1Beta2Condition details about ongoing remediation of the controlled machines, if any. + MachineDeploymentRemediatingV1Beta2Condition = RemediatingV1Beta2Condition + + // MachineDeploymentDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. + MachineDeploymentDeletingV1Beta2Condition = DeletingV1Beta2Condition + + // MachineDeploymentPausedV1Beta2Condition is true if this MachineDeployment or the Cluster it belongs to are paused. + MachineDeploymentPausedV1Beta2Condition = PausedV1Beta2Condition +) + +// Conditions that will be used for the Cluster object in v1Beta2 API version. +const ( + // ClusterAvailableV1Beta2Condition is true if the Cluster's is not deleted, and RemoteConnectionProbe, InfrastructureReady, + // ControlPlaneAvailable, WorkersAvailable, TopologyReconciled (if present) conditions are true. + // If conditions are defined in spec.availabilityGates, those conditions must be true as well. + ClusterAvailableV1Beta2Condition = AvailableV1Beta2Condition + + // ClusterTopologyReconciledV1Beta2Condition is true if the topology controller is working properly. + // Note:This condition is added only if the Cluster is referencing a ClusterClass / defining a managed Topology. + ClusterTopologyReconciledV1Beta2Condition = "TopologyReconciled" + + // ClusterInfrastructureReadyV1Beta2Condition Mirror of Cluster's infrastructure Ready condition. + ClusterInfrastructureReadyV1Beta2Condition = InfrastructureReadyV1Beta2Condition + + // ClusterControlPlaneInitializedV1Beta2Condition is true when the Cluster's control plane is functional enough + // to accept requests. This information is usually used as a signal for starting all the provisioning operations + // that depends on a functional API server, but do not require a full HA control plane to exists. + ClusterControlPlaneInitializedV1Beta2Condition = "ControlPlaneInitialized" + + // ClusterControlPlaneAvailableV1Beta2Condition is a mirror of Cluster's control plane Available condition. + ClusterControlPlaneAvailableV1Beta2Condition = "ControlPlaneAvailable" + + // ClusterWorkersAvailableV1Beta2Condition is the summary of MachineDeployment and MachinePool's Available conditions. + ClusterWorkersAvailableV1Beta2Condition = "WorkersAvailable" + + // ClusterMachinesReadyV1Beta2Condition surfaces detail of issues on the controlled machines, if any. + ClusterMachinesReadyV1Beta2Condition = MachinesReadyV1Beta2Condition + + // ClusterMachinesUpToDateV1Beta2Condition surfaces details of Cluster's machines not up to date, if any. + ClusterMachinesUpToDateV1Beta2Condition = MachinesUpToDateV1Beta2Condition + + // ClusterRemoteConnectionProbeV1Beta2Condition is true when control plane can be reached; in case of connection problems. + // The condition turns to false only if the cluster cannot be reached for 50s after the first connection problem + // is detected (or whatever period is defined in the --remote-connection-grace-period flag). + ClusterRemoteConnectionProbeV1Beta2Condition = "RemoteConnectionProbe" + + // ClusterScalingUpV1Beta2Condition is true if available replicas < desired replicas. + ClusterScalingUpV1Beta2Condition = ScalingUpV1Beta2Condition + + // ClusterScalingDownV1Beta2Condition is true if replicas > desired replicas. + ClusterScalingDownV1Beta2Condition = ScalingDownV1Beta2Condition + + // ClusterRemediatingV1Beta2Condition surfaces details about ongoing remediation of the controlled machines, if any. + ClusterRemediatingV1Beta2Condition = RemediatingV1Beta2Condition + + // ClusterDeletingV1Beta2Condition surfaces details about ongoing deletion of the cluster. + ClusterDeletingV1Beta2Condition = DeletingV1Beta2Condition + + // ClusterPausedV1Beta2Condition is true if Cluster and all the resources being part of it are paused. + ClusterPausedV1Beta2Condition = PausedV1Beta2Condition +) + +// Conditions that will be used for the MachineHealthCheck object in v1Beta2 API version. +const ( + // MachineHealthCheckRemediationAllowedV1Beta2Condition surfaces whether the MachineHealthCheck is + // allowed to remediate any Machines or whether it is blocked from remediating any further. + MachineHealthCheckRemediationAllowedV1Beta2Condition = "RemediationAllowed" + + // MachineHealthCheckPausedV1Beta2Condition is true if this MachineHealthCheck or the Cluster it belongs to are paused. + MachineHealthCheckPausedV1Beta2Condition = PausedV1Beta2Condition +) + +// Conditions that will be used for the ClusterClass object in v1Beta2 API version. +const ( + // ClusterClassVariablesReadyV1Beta2Condition is true if the ClusterClass variables, including both inline and external + // variables, have been successfully reconciled and thus ready to be used to default and validate variables on Clusters using + // this ClusterClass. + ClusterClassVariablesReadyV1Beta2Condition = "VariablesReady" + + // ClusterClassRefVersionsUpToDateV1Beta2Condition documents if the references in the ClusterClass are + // up-to-date (i.e. they are using the latest apiVersion of the current Cluster API contract from + // the corresponding CRD). + ClusterClassRefVersionsUpToDateV1Beta2Condition = "RefVersionsUpToDate" + + // ClusterClassPausedV1Beta2Condition is true if this ClusterClass is paused. + ClusterClassPausedV1Beta2Condition = PausedV1Beta2Condition +) diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 94af96114a69..b08c77422b8d 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -96,6 +96,21 @@ func (in *Cluster) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterAvailabilityGate) DeepCopyInto(out *ClusterAvailabilityGate) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterAvailabilityGate. +func (in *ClusterAvailabilityGate) DeepCopy() *ClusterAvailabilityGate { + if in == nil { + return nil + } + out := new(ClusterAvailabilityGate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterClass) DeepCopyInto(out *ClusterClass) { *out = *in @@ -236,6 +251,11 @@ func (in *ClusterClassStatus) DeepCopyInto(out *ClusterClassStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(ClusterClassV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClassStatus. @@ -287,6 +307,28 @@ func (in *ClusterClassStatusVariableDefinition) DeepCopy() *ClusterClassStatusVa return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterClassV1Beta2Status) DeepCopyInto(out *ClusterClassV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterClassV1Beta2Status. +func (in *ClusterClassV1Beta2Status) DeepCopy() *ClusterClassV1Beta2Status { + if in == nil { + return nil + } + out := new(ClusterClassV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterClassVariable) DeepCopyInto(out *ClusterClassVariable) { *out = *in @@ -333,6 +375,46 @@ func (in *ClusterClassVariableMetadata) DeepCopy() *ClusterClassVariableMetadata return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterControlPlaneStatus) DeepCopyInto(out *ClusterControlPlaneStatus) { + *out = *in + if in.DesiredReplicas != nil { + in, out := &in.DesiredReplicas, &out.DesiredReplicas + *out = new(int32) + **out = **in + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + if in.UpToDateReplicas != nil { + in, out := &in.UpToDateReplicas, &out.UpToDateReplicas + *out = new(int32) + **out = **in + } + if in.ReadyReplicas != nil { + in, out := &in.ReadyReplicas, &out.ReadyReplicas + *out = new(int32) + **out = **in + } + if in.AvailableReplicas != nil { + in, out := &in.AvailableReplicas, &out.AvailableReplicas + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterControlPlaneStatus. +func (in *ClusterControlPlaneStatus) DeepCopy() *ClusterControlPlaneStatus { + if in == nil { + return nil + } + out := new(ClusterControlPlaneStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterList) DeepCopyInto(out *ClusterList) { *out = *in @@ -419,6 +501,11 @@ func (in *ClusterSpec) DeepCopyInto(out *ClusterSpec) { *out = new(Topology) (*in).DeepCopyInto(*out) } + if in.AvailabilityGates != nil { + in, out := &in.AvailabilityGates, &out.AvailabilityGates + *out = make([]ClusterAvailabilityGate, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSpec. @@ -458,6 +545,11 @@ func (in *ClusterStatus) DeepCopyInto(out *ClusterStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(ClusterV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterStatus. @@ -470,6 +562,38 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterV1Beta2Status) DeepCopyInto(out *ClusterV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ControlPlane != nil { + in, out := &in.ControlPlane, &out.ControlPlane + *out = new(ClusterControlPlaneStatus) + (*in).DeepCopyInto(*out) + } + if in.Workers != nil { + in, out := &in.Workers, &out.Workers + *out = new(WorkersStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterV1Beta2Status. +func (in *ClusterV1Beta2Status) DeepCopy() *ClusterV1Beta2Status { + if in == nil { + return nil + } + out := new(ClusterV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClusterVariable) DeepCopyInto(out *ClusterVariable) { *out = *in @@ -1231,6 +1355,11 @@ func (in *MachineDeploymentStatus) DeepCopyInto(out *MachineDeploymentStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(MachineDeploymentV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentStatus. @@ -1329,6 +1458,43 @@ func (in *MachineDeploymentTopology) DeepCopy() *MachineDeploymentTopology { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineDeploymentV1Beta2Status) DeepCopyInto(out *MachineDeploymentV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ReadyReplicas != nil { + in, out := &in.ReadyReplicas, &out.ReadyReplicas + *out = new(int32) + **out = **in + } + if in.AvailableReplicas != nil { + in, out := &in.AvailableReplicas, &out.AvailableReplicas + *out = new(int32) + **out = **in + } + if in.UpToDateReplicas != nil { + in, out := &in.UpToDateReplicas, &out.UpToDateReplicas + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineDeploymentV1Beta2Status. +func (in *MachineDeploymentV1Beta2Status) DeepCopy() *MachineDeploymentV1Beta2Status { + if in == nil { + return nil + } + out := new(MachineDeploymentV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineDeploymentVariables) DeepCopyInto(out *MachineDeploymentVariables) { *out = *in @@ -1506,6 +1672,11 @@ func (in *MachineHealthCheckStatus) DeepCopyInto(out *MachineHealthCheckStatus) (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(MachineHealthCheckV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckStatus. @@ -1539,6 +1710,28 @@ func (in *MachineHealthCheckTopology) DeepCopy() *MachineHealthCheckTopology { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineHealthCheckV1Beta2Status) DeepCopyInto(out *MachineHealthCheckV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineHealthCheckV1Beta2Status. +func (in *MachineHealthCheckV1Beta2Status) DeepCopy() *MachineHealthCheckV1Beta2Status { + if in == nil { + return nil + } + out := new(MachineHealthCheckV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineList) DeepCopyInto(out *MachineList) { *out = *in @@ -1728,6 +1921,21 @@ func (in *MachinePoolVariables) DeepCopy() *MachinePoolVariables { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineReadinessGate) DeepCopyInto(out *MachineReadinessGate) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineReadinessGate. +func (in *MachineReadinessGate) DeepCopy() *MachineReadinessGate { + if in == nil { + return nil + } + out := new(MachineReadinessGate) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineRollingUpdateDeployment) DeepCopyInto(out *MachineRollingUpdateDeployment) { *out = *in @@ -1859,6 +2067,11 @@ func (in *MachineSetStatus) DeepCopyInto(out *MachineSetStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(MachineSetV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetStatus. @@ -1871,6 +2084,43 @@ func (in *MachineSetStatus) DeepCopy() *MachineSetStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineSetV1Beta2Status) DeepCopyInto(out *MachineSetV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ReadyReplicas != nil { + in, out := &in.ReadyReplicas, &out.ReadyReplicas + *out = new(int32) + **out = **in + } + if in.AvailableReplicas != nil { + in, out := &in.AvailableReplicas, &out.AvailableReplicas + *out = new(int32) + **out = **in + } + if in.UpToDateReplicas != nil { + in, out := &in.UpToDateReplicas, &out.UpToDateReplicas + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineSetV1Beta2Status. +func (in *MachineSetV1Beta2Status) DeepCopy() *MachineSetV1Beta2Status { + if in == nil { + return nil + } + out := new(MachineSetV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = *in @@ -1891,6 +2141,11 @@ func (in *MachineSpec) DeepCopyInto(out *MachineSpec) { *out = new(string) **out = **in } + if in.ReadinessGates != nil { + in, out := &in.ReadinessGates, &out.ReadinessGates + *out = make([]MachineReadinessGate, len(*in)) + copy(*out, *in) + } if in.NodeDrainTimeout != nil { in, out := &in.NodeDrainTimeout, &out.NodeDrainTimeout *out = new(metav1.Duration) @@ -1966,6 +2221,11 @@ func (in *MachineStatus) DeepCopyInto(out *MachineStatus) { *out = new(MachineDeletionStatus) (*in).DeepCopyInto(*out) } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(MachineV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineStatus. @@ -1995,6 +2255,28 @@ func (in *MachineTemplateSpec) DeepCopy() *MachineTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachineV1Beta2Status) DeepCopyInto(out *MachineV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachineV1Beta2Status. +func (in *MachineV1Beta2Status) DeepCopy() *MachineV1Beta2Status { + if in == nil { + return nil + } + out := new(MachineV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NetworkRanges) DeepCopyInto(out *NetworkRanges) { *out = *in @@ -2305,6 +2587,46 @@ func (in *WorkersClass) DeepCopy() *WorkersClass { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkersStatus) DeepCopyInto(out *WorkersStatus) { + *out = *in + if in.DesiredReplicas != nil { + in, out := &in.DesiredReplicas, &out.DesiredReplicas + *out = new(int32) + **out = **in + } + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + if in.UpToDateReplicas != nil { + in, out := &in.UpToDateReplicas, &out.UpToDateReplicas + *out = new(int32) + **out = **in + } + if in.ReadyReplicas != nil { + in, out := &in.ReadyReplicas, &out.ReadyReplicas + *out = new(int32) + **out = **in + } + if in.AvailableReplicas != nil { + in, out := &in.AvailableReplicas, &out.AvailableReplicas + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkersStatus. +func (in *WorkersStatus) DeepCopy() *WorkersStatus { + if in == nil { + return nil + } + out := new(WorkersStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkersTopology) DeepCopyInto(out *WorkersTopology) { *out = *in diff --git a/api/v1beta1/zz_generated.openapi.go b/api/v1beta1/zz_generated.openapi.go index 11a5a0c778db..bca631f79d4f 100644 --- a/api/v1beta1/zz_generated.openapi.go +++ b/api/v1beta1/zz_generated.openapi.go @@ -31,6 +31,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/cluster-api/api/v1beta1.APIEndpoint": schema_sigsk8sio_cluster_api_api_v1beta1_APIEndpoint(ref), "sigs.k8s.io/cluster-api/api/v1beta1.Bootstrap": schema_sigsk8sio_cluster_api_api_v1beta1_Bootstrap(ref), "sigs.k8s.io/cluster-api/api/v1beta1.Cluster": schema_sigsk8sio_cluster_api_api_v1beta1_Cluster(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.ClusterAvailabilityGate": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterAvailabilityGate(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClass": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClass(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassList": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassList(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassPatch": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassPatch(ref), @@ -38,12 +39,15 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassStatus": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassStatus(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassStatusVariable": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassStatusVariable(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassStatusVariableDefinition": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassStatusVariableDefinition(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassV1Beta2Status": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassV1Beta2Status(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassVariable": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassVariable(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassVariableMetadata": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassVariableMetadata(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.ClusterControlPlaneStatus": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterControlPlaneStatus(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterList": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterList(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterNetwork": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterNetwork(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterSpec": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterSpec(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterStatus": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterStatus(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.ClusterV1Beta2Status": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterV1Beta2Status(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ClusterVariable": schema_sigsk8sio_cluster_api_api_v1beta1_ClusterVariable(ref), "sigs.k8s.io/cluster-api/api/v1beta1.Condition": schema_sigsk8sio_cluster_api_api_v1beta1_Condition(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ControlPlaneClass": schema_sigsk8sio_cluster_api_api_v1beta1_ControlPlaneClass(ref), @@ -68,6 +72,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeploymentStatus": schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentStatus(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeploymentStrategy": schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentStrategy(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeploymentTopology": schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentTopology(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeploymentV1Beta2Status": schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentV1Beta2Status(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeploymentVariables": schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentVariables(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheck": schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheck(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheckClass": schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckClass(ref), @@ -75,20 +80,24 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheckSpec": schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckSpec(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheckStatus": schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckStatus(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheckTopology": schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckTopology(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheckV1Beta2Status": schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckV1Beta2Status(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineList": schema_sigsk8sio_cluster_api_api_v1beta1_MachineList(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachinePoolClass": schema_sigsk8sio_cluster_api_api_v1beta1_MachinePoolClass(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachinePoolClassNamingStrategy": schema_sigsk8sio_cluster_api_api_v1beta1_MachinePoolClassNamingStrategy(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachinePoolClassTemplate": schema_sigsk8sio_cluster_api_api_v1beta1_MachinePoolClassTemplate(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachinePoolTopology": schema_sigsk8sio_cluster_api_api_v1beta1_MachinePoolTopology(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachinePoolVariables": schema_sigsk8sio_cluster_api_api_v1beta1_MachinePoolVariables(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.MachineReadinessGate": schema_sigsk8sio_cluster_api_api_v1beta1_MachineReadinessGate(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineRollingUpdateDeployment": schema_sigsk8sio_cluster_api_api_v1beta1_MachineRollingUpdateDeployment(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineSet": schema_sigsk8sio_cluster_api_api_v1beta1_MachineSet(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineSetList": schema_sigsk8sio_cluster_api_api_v1beta1_MachineSetList(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineSetSpec": schema_sigsk8sio_cluster_api_api_v1beta1_MachineSetSpec(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineSetStatus": schema_sigsk8sio_cluster_api_api_v1beta1_MachineSetStatus(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.MachineSetV1Beta2Status": schema_sigsk8sio_cluster_api_api_v1beta1_MachineSetV1Beta2Status(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineSpec": schema_sigsk8sio_cluster_api_api_v1beta1_MachineSpec(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineStatus": schema_sigsk8sio_cluster_api_api_v1beta1_MachineStatus(ref), "sigs.k8s.io/cluster-api/api/v1beta1.MachineTemplateSpec": schema_sigsk8sio_cluster_api_api_v1beta1_MachineTemplateSpec(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.MachineV1Beta2Status": schema_sigsk8sio_cluster_api_api_v1beta1_MachineV1Beta2Status(ref), "sigs.k8s.io/cluster-api/api/v1beta1.NetworkRanges": schema_sigsk8sio_cluster_api_api_v1beta1_NetworkRanges(ref), "sigs.k8s.io/cluster-api/api/v1beta1.ObjectMeta": schema_sigsk8sio_cluster_api_api_v1beta1_ObjectMeta(ref), "sigs.k8s.io/cluster-api/api/v1beta1.PatchDefinition": schema_sigsk8sio_cluster_api_api_v1beta1_PatchDefinition(ref), @@ -103,6 +112,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "sigs.k8s.io/cluster-api/api/v1beta1.VariableSchema": schema_sigsk8sio_cluster_api_api_v1beta1_VariableSchema(ref), "sigs.k8s.io/cluster-api/api/v1beta1.VariableSchemaMetadata": schema_sigsk8sio_cluster_api_api_v1beta1_VariableSchemaMetadata(ref), "sigs.k8s.io/cluster-api/api/v1beta1.WorkersClass": schema_sigsk8sio_cluster_api_api_v1beta1_WorkersClass(ref), + "sigs.k8s.io/cluster-api/api/v1beta1.WorkersStatus": schema_sigsk8sio_cluster_api_api_v1beta1_WorkersStatus(ref), "sigs.k8s.io/cluster-api/api/v1beta1.WorkersTopology": schema_sigsk8sio_cluster_api_api_v1beta1_WorkersTopology(ref), } } @@ -212,6 +222,28 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_Cluster(ref common.ReferenceCallba } } +func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterAvailabilityGate(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterAvailabilityGate contains the type of a Cluster condition to be used as availability gate.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditionType": { + SchemaProps: spec.SchemaProps{ + Description: "conditionType refers to a positive polarity condition (status true means good) with matching type in the Cluster's condition list. If the conditions doesn't exist, it will be treated as unknown. Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"conditionType"}, + }, + }, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClass(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -472,11 +504,17 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassStatus(ref common.Refe Format: "int64", }, }, + "v1beta2": { + SchemaProps: spec.SchemaProps{ + Description: "v1beta2 groups all the fields that will be added or modified in ClusterClass's status with the V1Beta2 version.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassV1Beta2Status"), + }, + }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassStatusVariable", "sigs.k8s.io/cluster-api/api/v1beta1.Condition"}, + "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassStatusVariable", "sigs.k8s.io/cluster-api/api/v1beta1.ClusterClassV1Beta2Status", "sigs.k8s.io/cluster-api/api/v1beta1.Condition"}, } } @@ -572,6 +610,43 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassStatusVariableDefiniti } } +func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassV1Beta2Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterClassV1Beta2Status groups all the fields that will be added or modified in ClusterClass with the V1Beta2 version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions represents the observations of a ClusterClass's current state. Known condition types are VariablesReady, RefVersionsUpToDate, Paused.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassVariable(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -663,6 +738,54 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterClassVariableMetadata(ref c } } +func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterControlPlaneStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterControlPlaneStatus groups all the observations about control plane current state.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "desiredReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "desiredReplicas is the total number of desired control plane machines in this cluster.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "replicas is the total number of control plane machines in this cluster. NOTE: replicas also includes machines still being provisioned or being deleted.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "upToDateReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "upToDateReplicas is the number of up-to-date control plane machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "readyReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "readyReplicas is the total number of ready control plane machines in this cluster. A machine is considered ready when Machine's Ready condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "availableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "availableReplicas is the total number of available control plane machines in this cluster. A machine is considered available when Machine's Available condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -798,11 +921,33 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterSpec(ref common.ReferenceCa Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.Topology"), }, }, + "availabilityGates": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "conditionType", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "availabilityGates specifies additional conditions to include when evaluating Cluster Available condition.\n\nNOTE: this field is considered only for computing v1beta2 conditions.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.ClusterAvailabilityGate"), + }, + }, + }, + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.ObjectReference", "sigs.k8s.io/cluster-api/api/v1beta1.APIEndpoint", "sigs.k8s.io/cluster-api/api/v1beta1.ClusterNetwork", "sigs.k8s.io/cluster-api/api/v1beta1.Topology"}, + "k8s.io/api/core/v1.ObjectReference", "sigs.k8s.io/cluster-api/api/v1beta1.APIEndpoint", "sigs.k8s.io/cluster-api/api/v1beta1.ClusterAvailabilityGate", "sigs.k8s.io/cluster-api/api/v1beta1.ClusterNetwork", "sigs.k8s.io/cluster-api/api/v1beta1.Topology"}, } } @@ -886,11 +1031,66 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterStatus(ref common.Reference Format: "int64", }, }, + "v1beta2": { + SchemaProps: spec.SchemaProps{ + Description: "v1beta2 groups all the fields that will be added or modified in Cluster's status with the V1Beta2 version.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.ClusterV1Beta2Status"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "sigs.k8s.io/cluster-api/api/v1beta1.ClusterV1Beta2Status", "sigs.k8s.io/cluster-api/api/v1beta1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.FailureDomainSpec"}, + } +} + +func schema_sigsk8sio_cluster_api_api_v1beta1_ClusterV1Beta2Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "ClusterV1Beta2Status groups all the fields that will be added or modified in Cluster with the V1Beta2 version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions represents the observations of a Cluster's current state. Known condition types are Available, InfrastructureReady, ControlPlaneInitialized, ControlPlaneAvailable, WorkersAvailable, MachinesReady MachinesUpToDate, RemoteConnectionProbe, ScalingUp, ScalingDown, Remediating, Deleting, Paused. Additionally, a TopologyReconciled condition will be added in case the Cluster is referencing a ClusterClass / defining a managed Topology.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + "controlPlane": { + SchemaProps: spec.SchemaProps{ + Description: "controlPlane groups all the observations about Cluster's ControlPlane current state.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.ClusterControlPlaneStatus"), + }, + }, + "workers": { + SchemaProps: spec.SchemaProps{ + Description: "workers groups all the observations about Cluster's Workers current state.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.WorkersStatus"), + }, + }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.FailureDomainSpec"}, + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.ClusterControlPlaneStatus", "sigs.k8s.io/cluster-api/api/v1beta1.WorkersStatus"}, } } @@ -2134,11 +2334,17 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentStatus(ref common }, }, }, + "v1beta2": { + SchemaProps: spec.SchemaProps{ + Description: "v1beta2 groups all the fields that will be added or modified in MachineDeployment's status with the V1Beta2 version.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.MachineDeploymentV1Beta2Status"), + }, + }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Condition"}, + "sigs.k8s.io/cluster-api/api/v1beta1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeploymentV1Beta2Status"}, } } @@ -2272,6 +2478,64 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentTopology(ref comm } } +func schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentV1Beta2Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineDeploymentV1Beta2Status groups all the fields that will be added or modified in MachineDeployment with the V1Beta2 version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions represents the observations of a MachineDeployment's current state. Known condition types are Available, MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + "readyReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "readyReplicas is the number of ready replicas for this MachineDeployment. A machine is considered ready when Machine's Ready condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "availableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "availableReplicas is the number of available replicas for this MachineDeployment. A machine is considered available when Machine's Available condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "upToDateReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "upToDateReplicas is the number of up-to-date replicas targeted by this deployment. A machine is considered up-to-date when Machine's UpToDate condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_MachineDeploymentVariables(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -2598,11 +2862,17 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckStatus(ref commo }, }, }, + "v1beta2": { + SchemaProps: spec.SchemaProps{ + Description: "v1beta2 groups all the fields that will be added or modified in MachineHealthCheck's status with the V1Beta2 version.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheckV1Beta2Status"), + }, + }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Condition"}, + "sigs.k8s.io/cluster-api/api/v1beta1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.MachineHealthCheckV1Beta2Status"}, } } @@ -2667,6 +2937,43 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckTopology(ref com } } +func schema_sigsk8sio_cluster_api_api_v1beta1_MachineHealthCheckV1Beta2Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineHealthCheckV1Beta2Status groups all the fields that will be added or modified in MachineHealthCheck with the V1Beta2 version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions represents the observations of a MachineHealthCheck's current state. Known condition types are RemediationAllowed, Paused.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_MachineList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -2979,6 +3286,28 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachinePoolVariables(ref common.Re } } +func schema_sigsk8sio_cluster_api_api_v1beta1_MachineReadinessGate(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineReadinessGate contains the type of a Machine condition to be used as a readiness gate.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditionType": { + SchemaProps: spec.SchemaProps{ + Description: "conditionType refers to a positive polarity condition (status true means good) with matching type in the Machine's condition list. If the conditions doesn't exist, it will be treated as unknown. Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"conditionType"}, + }, + }, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_MachineRollingUpdateDeployment(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -3248,11 +3577,75 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineSetStatus(ref common.Refere }, }, }, + "v1beta2": { + SchemaProps: spec.SchemaProps{ + Description: "v1beta2 groups all the fields that will be added or modified in MachineSet's status with the V1Beta2 version.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.MachineSetV1Beta2Status"), + }, + }, }, }, }, Dependencies: []string{ - "sigs.k8s.io/cluster-api/api/v1beta1.Condition"}, + "sigs.k8s.io/cluster-api/api/v1beta1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.MachineSetV1Beta2Status"}, + } +} + +func schema_sigsk8sio_cluster_api_api_v1beta1_MachineSetV1Beta2Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineSetV1Beta2Status groups all the fields that will be added or modified in MachineSetStatus with the V1Beta2 version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions represents the observations of a MachineSet's current state. Known condition types are MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + "readyReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "readyReplicas is the number of ready replicas for this MachineSet. A machine is considered ready when Machine's Ready condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "availableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "availableReplicas is the number of available replicas for this MachineSet. A machine is considered available when Machine's Available condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "upToDateReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "upToDateReplicas is the number of up-to-date replicas for this MachineSet. A machine is considered up-to-date when Machine's UpToDate condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, } } @@ -3306,6 +3699,28 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineSpec(ref common.ReferenceCa Format: "", }, }, + "readinessGates": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "conditionType", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "readinessGates specifies additional conditions to include when evaluating Machine Ready condition.\n\nThis field can be used e.g. by Cluster API control plane providers to extend the semantic of the Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc.\n\nAnother example are external controllers, e.g. responsible to install special software/hardware on the Machines; they can include the status of those components with a new condition and add this condition to ReadinessGates.\n\nNOTE: this field is considered only for computing v1beta2 conditions.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.MachineReadinessGate"), + }, + }, + }, + }, + }, "nodeDrainTimeout": { SchemaProps: spec.SchemaProps{ Description: "NodeDrainTimeout is the total amount of time that the controller will spend on draining a node. The default value is 0, meaning that the node can be drained without any time limitations. NOTE: NodeDrainTimeout is different from `kubectl drain --timeout`", @@ -3329,7 +3744,7 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineSpec(ref common.ReferenceCa }, }, Dependencies: []string{ - "k8s.io/api/core/v1.ObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "sigs.k8s.io/cluster-api/api/v1beta1.Bootstrap"}, + "k8s.io/api/core/v1.ObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "sigs.k8s.io/cluster-api/api/v1beta1.Bootstrap", "sigs.k8s.io/cluster-api/api/v1beta1.MachineReadinessGate"}, } } @@ -3442,11 +3857,17 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineStatus(ref common.Reference Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.MachineDeletionStatus"), }, }, + "v1beta2": { + SchemaProps: spec.SchemaProps{ + Description: "v1beta2 groups all the fields that will be added or modified in Machine's status with the V1Beta2 version.", + Ref: ref("sigs.k8s.io/cluster-api/api/v1beta1.MachineV1Beta2Status"), + }, + }, }, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.NodeSystemInfo", "k8s.io/api/core/v1.ObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time", "sigs.k8s.io/cluster-api/api/v1beta1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.MachineAddress", "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeletionStatus"}, + "k8s.io/api/core/v1.NodeSystemInfo", "k8s.io/api/core/v1.ObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Time", "sigs.k8s.io/cluster-api/api/v1beta1.Condition", "sigs.k8s.io/cluster-api/api/v1beta1.MachineAddress", "sigs.k8s.io/cluster-api/api/v1beta1.MachineDeletionStatus", "sigs.k8s.io/cluster-api/api/v1beta1.MachineV1Beta2Status"}, } } @@ -3479,6 +3900,43 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_MachineTemplateSpec(ref common.Ref } } +func schema_sigsk8sio_cluster_api_api_v1beta1_MachineV1Beta2Status(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MachineV1Beta2Status groups all the fields that will be added or modified in MachineStatus with the V1Beta2 version. See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "conditions": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-map-keys": []interface{}{ + "type", + }, + "x-kubernetes-list-type": "map", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "conditions represents the observations of a Machine's current state. Known condition types are Available, Ready, UpToDate, BootstrapConfigReady, InfrastructureReady, NodeReady, NodeHealthy, Deleting, Paused. If a MachineHealthCheck is targeting this machine, also HealthCheckSucceeded, OwnerRemediated conditions are added. Additionally control plane Machines controlled by KubeadmControlPlane will have following additional conditions: APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy, EtcdPodHealthy, EtcdMemberHealthy.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition"}, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_NetworkRanges(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -4032,6 +4490,54 @@ func schema_sigsk8sio_cluster_api_api_v1beta1_WorkersClass(ref common.ReferenceC } } +func schema_sigsk8sio_cluster_api_api_v1beta1_WorkersStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "WorkersStatus groups all the observations about workers current state.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "desiredReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "desiredReplicas is the total number of desired worker machines in this cluster.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "replicas is the total number of worker machines in this cluster. NOTE: replicas also includes machines still being provisioned or being deleted.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "upToDateReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "upToDateReplicas is the number of up-to-date worker machines in this cluster. A machine is considered up-to-date when Machine's UpToDate condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "readyReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "readyReplicas is the total number of ready worker machines in this cluster. A machine is considered ready when Machine's Ready condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "availableReplicas": { + SchemaProps: spec.SchemaProps{ + Description: "availableReplicas is the total number of available worker machines in this cluster. A machine is considered available when Machine's Available condition is true.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + func schema_sigsk8sio_cluster_api_api_v1beta1_WorkersTopology(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go b/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go index 90689364dae0..fae7c85c7b5e 100644 --- a/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go +++ b/bootstrap/kubeadm/api/v1beta1/kubeadmconfig_types.go @@ -441,6 +441,22 @@ type KubeadmConfigStatus struct { // Conditions defines current service state of the KubeadmConfig. // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in KubeadmConfig's status with the V1Beta2 version. + // +optional + V1Beta2 *KubeadmConfigV1Beta2Status `json:"v1beta2,omitempty"` +} + +// KubeadmConfigV1Beta2Status groups all the fields that will be added or modified in KubeadmConfig with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type KubeadmConfigV1Beta2Status struct { + // conditions represents the observations of a KubeadmConfig's current state. + // Known condition types are Ready, DataSecretAvailable, CertificatesAvailable. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // +kubebuilder:object:root=true @@ -469,6 +485,22 @@ func (c *KubeadmConfig) SetConditions(conditions clusterv1.Conditions) { c.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (c *KubeadmConfig) GetV1Beta2Conditions() []metav1.Condition { + if c.Status.V1Beta2 == nil { + return nil + } + return c.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (c *KubeadmConfig) SetV1Beta2Conditions(conditions []metav1.Condition) { + if c.Status.V1Beta2 == nil && conditions != nil { + c.Status.V1Beta2 = &KubeadmConfigV1Beta2Status{} + } + c.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // KubeadmConfigList contains a list of KubeadmConfig. diff --git a/bootstrap/kubeadm/api/v1beta1/v1beta2_condition_consts.go b/bootstrap/kubeadm/api/v1beta1/v1beta2_condition_consts.go new file mode 100644 index 000000000000..0fa17a6f25e9 --- /dev/null +++ b/bootstrap/kubeadm/api/v1beta1/v1beta2_condition_consts.go @@ -0,0 +1,33 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + +// Conditions that will be used for the KubeadmConfig object in v1Beta2 API version. +const ( + // KubeadmConfigReadyV1Beta2Condition is true if the KubeadmConfig is not deleted, + // and both DataSecretCreated, CertificatesAvailable conditions are true. + KubeadmConfigReadyV1Beta2Condition = clusterv1.ReadyV1Beta2Condition + + // CertificatesAvailableV1Beta2Condition documents that cluster certificates required + // for generating the bootstrap data secret are available. + CertificatesAvailableV1Beta2Condition = "CertificatesAvailable" + + // DataSecretAvailableV1Beta2Condition is true if the bootstrap secret is available. + DataSecretAvailableV1Beta2Condition = "DataSecretAvailable" +) diff --git a/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go b/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go index 0c4becdd21a0..3f508065e68c 100644 --- a/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go +++ b/bootstrap/kubeadm/api/v1beta1/zz_generated.deepcopy.go @@ -923,6 +923,11 @@ func (in *KubeadmConfigStatus) DeepCopyInto(out *KubeadmConfigStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(KubeadmConfigV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigStatus. @@ -1026,6 +1031,28 @@ func (in *KubeadmConfigTemplateSpec) DeepCopy() *KubeadmConfigTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmConfigV1Beta2Status) DeepCopyInto(out *KubeadmConfigV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmConfigV1Beta2Status. +func (in *KubeadmConfigV1Beta2Status) DeepCopy() *KubeadmConfigV1Beta2Status { + if in == nil { + return nil + } + out := new(KubeadmConfigV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LocalEtcd) DeepCopyInto(out *LocalEtcd) { *out = *in diff --git a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml index 07d4fbdee075..68b64ff3176a 100644 --- a/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml +++ b/bootstrap/kubeadm/config/crd/bases/bootstrap.cluster.x-k8s.io_kubeadmconfigs.yaml @@ -3765,6 +3765,75 @@ spec: description: Ready indicates the BootstrapData field is ready to be consumed type: boolean + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in KubeadmConfig's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a KubeadmConfig's current state. + Known condition types are Ready, DataSecretAvailable, CertificatesAvailable. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true diff --git a/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml b/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml index 889a31ed0739..b2f72d2a2a21 100644 --- a/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml +++ b/config/crd/bases/addons.cluster.x-k8s.io_clusterresourcesets.yaml @@ -525,6 +525,74 @@ spec: recently observed ClusterResourceSet. format: int64 type: integer + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in ClusterResourceSet's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a ClusterResourceSet's current state. + Known condition types are ResourceSetApplied, Deleting. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true diff --git a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml index 32a113536b91..97f8fbfe4331 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusterclasses.yaml @@ -2042,6 +2042,75 @@ spec: by the controller. format: int64 type: integer + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in ClusterClass's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a ClusterClass's current state. + Known condition types are VariablesReady, RefVersionsUpToDate, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object variables: description: Variables is a list of ClusterClassStatusVariable that are defined for the ClusterClass. diff --git a/config/crd/bases/cluster.x-k8s.io_clusters.yaml b/config/crd/bases/cluster.x-k8s.io_clusters.yaml index cc62b73a7dd9..f8cc44b0464d 100644 --- a/config/crd/bases/cluster.x-k8s.io_clusters.yaml +++ b/config/crd/bases/cluster.x-k8s.io_clusters.yaml @@ -749,6 +749,32 @@ spec: spec: description: ClusterSpec defines the desired state of Cluster. properties: + availabilityGates: + description: |- + availabilityGates specifies additional conditions to include when evaluating Cluster Available condition. + + NOTE: this field is considered only for computing v1beta2 conditions. + items: + description: ClusterAvailabilityGate contains the type of a Cluster + condition to be used as availability gate. + properties: + conditionType: + description: |- + conditionType refers to a positive polarity condition (status true means good) with matching type in the Cluster's condition list. + If the conditions doesn't exist, it will be treated as unknown. + Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as availability gates. + maxLength: 316 + minLength: 1 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - conditionType + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - conditionType + x-kubernetes-list-type: map clusterNetwork: description: Cluster network configuration. properties: @@ -1762,6 +1788,145 @@ spec: Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. type: string + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in Cluster's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a Cluster's current state. + Known condition types are Available, InfrastructureReady, ControlPlaneInitialized, ControlPlaneAvailable, WorkersAvailable, MachinesReady + MachinesUpToDate, RemoteConnectionProbe, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + Additionally, a TopologyReconciled condition will be added in case the Cluster is referencing a ClusterClass / defining a managed Topology. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + controlPlane: + description: controlPlane groups all the observations about Cluster's + ControlPlane current state. + properties: + availableReplicas: + description: availableReplicas is the total number of available + control plane machines in this cluster. A machine is considered + available when Machine's Available condition is true. + format: int32 + type: integer + desiredReplicas: + description: desiredReplicas is the total number of desired + control plane machines in this cluster. + format: int32 + type: integer + readyReplicas: + description: readyReplicas is the total number of ready control + plane machines in this cluster. A machine is considered + ready when Machine's Ready condition is true. + format: int32 + type: integer + replicas: + description: |- + replicas is the total number of control plane machines in this cluster. + NOTE: replicas also includes machines still being provisioned or being deleted. + format: int32 + type: integer + upToDateReplicas: + description: upToDateReplicas is the number of up-to-date + control plane machines in this cluster. A machine is considered + up-to-date when Machine's UpToDate condition is true. + format: int32 + type: integer + type: object + workers: + description: workers groups all the observations about Cluster's + Workers current state. + properties: + availableReplicas: + description: availableReplicas is the total number of available + worker machines in this cluster. A machine is considered + available when Machine's Available condition is true. + format: int32 + type: integer + desiredReplicas: + description: desiredReplicas is the total number of desired + worker machines in this cluster. + format: int32 + type: integer + readyReplicas: + description: readyReplicas is the total number of ready worker + machines in this cluster. A machine is considered ready + when Machine's Ready condition is true. + format: int32 + type: integer + replicas: + description: |- + replicas is the total number of worker machines in this cluster. + NOTE: replicas also includes machines still being provisioned or being deleted. + format: int32 + type: integer + upToDateReplicas: + description: upToDateReplicas is the number of up-to-date + worker machines in this cluster. A machine is considered + up-to-date when Machine's UpToDate condition is true. + format: int32 + type: integer + type: object + type: object type: object type: object served: true diff --git a/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml b/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml index 96b88497ba05..f71420031e22 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinedeployments.yaml @@ -1495,6 +1495,39 @@ spec: This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. type: string + readinessGates: + description: |- + readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + + This field can be used e.g. by Cluster API control plane providers to extend the semantic of the + Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates + for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + + Another example are external controllers, e.g. responsible to install special software/hardware on the Machines; + they can include the status of those components with a new condition and add this condition to ReadinessGates. + + NOTE: this field is considered only for computing v1beta2 conditions. + items: + description: MachineReadinessGate contains the type of a + Machine condition to be used as a readiness gate. + properties: + conditionType: + description: |- + conditionType refers to a positive polarity condition (status true means good) with matching type in the Machine's condition list. + If the conditions doesn't exist, it will be treated as unknown. + Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates. + maxLength: 316 + minLength: 1 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - conditionType + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - conditionType + x-kubernetes-list-type: map version: description: |- Version defines the desired Kubernetes version. @@ -1604,6 +1637,93 @@ spec: that have the desired template spec. format: int32 type: integer + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in MachineDeployment's status with the V1Beta2 version. + properties: + availableReplicas: + description: availableReplicas is the number of available replicas + for this MachineDeployment. A machine is considered available + when Machine's Available condition is true. + format: int32 + type: integer + conditions: + description: |- + conditions represents the observations of a MachineDeployment's current state. + Known condition types are Available, MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + readyReplicas: + description: readyReplicas is the number of ready replicas for + this MachineDeployment. A machine is considered ready when Machine's + Ready condition is true. + format: int32 + type: integer + upToDateReplicas: + description: upToDateReplicas is the number of up-to-date replicas + targeted by this deployment. A machine is considered up-to-date + when Machine's UpToDate condition is true. + format: int32 + type: integer + type: object type: object type: object served: true diff --git a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml index e8deecb8ed2c..0a63bf3d321e 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinehealthchecks.yaml @@ -869,6 +869,75 @@ spec: items: type: string type: array + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in MachineHealthCheck's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a MachineHealthCheck's current state. + Known condition types are RemediationAllowed, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true diff --git a/config/crd/bases/cluster.x-k8s.io_machinepools.yaml b/config/crd/bases/cluster.x-k8s.io_machinepools.yaml index 801658b64dda..725f848c0ef7 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinepools.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinepools.yaml @@ -1260,6 +1260,39 @@ spec: This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. type: string + readinessGates: + description: |- + readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + + This field can be used e.g. by Cluster API control plane providers to extend the semantic of the + Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates + for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + + Another example are external controllers, e.g. responsible to install special software/hardware on the Machines; + they can include the status of those components with a new condition and add this condition to ReadinessGates. + + NOTE: this field is considered only for computing v1beta2 conditions. + items: + description: MachineReadinessGate contains the type of a + Machine condition to be used as a readiness gate. + properties: + conditionType: + description: |- + conditionType refers to a positive polarity condition (status true means good) with matching type in the Machine's condition list. + If the conditions doesn't exist, it will be treated as unknown. + Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates. + maxLength: 316 + minLength: 1 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - conditionType + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - conditionType + x-kubernetes-list-type: map version: description: |- Version defines the desired Kubernetes version. @@ -1422,6 +1455,93 @@ spec: that still have not been created. format: int32 type: integer + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in MachinePool's status with the V1Beta2 version. + properties: + availableReplicas: + description: availableReplicas is the number of available replicas + for this MachinePool. A machine is considered available when + Machine's Available condition is true. + format: int32 + type: integer + conditions: + description: |- + conditions represents the observations of a MachinePool's current state. + Known condition types are Available, BootstrapConfigReady, InfrastructureReady, MachinesReady, MachinesUpToDate, + ScalingUp, ScalingDown, Remediating, Deleting, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + readyReplicas: + description: readyReplicas is the number of ready replicas for + this MachinePool. A machine is considered ready when Machine's + Ready condition is true. + format: int32 + type: integer + upToDateReplicas: + description: upToDateReplicas is the number of up-to-date replicas + targeted by this MachinePool. A machine is considered up-to-date + when Machine's UpToDate condition is true. + format: int32 + type: integer + type: object type: object type: object served: true diff --git a/config/crd/bases/cluster.x-k8s.io_machines.yaml b/config/crd/bases/cluster.x-k8s.io_machines.yaml index cc5aab3633ad..7424c228641f 100644 --- a/config/crd/bases/cluster.x-k8s.io_machines.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machines.yaml @@ -1026,6 +1026,39 @@ spec: This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. type: string + readinessGates: + description: |- + readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + + This field can be used e.g. by Cluster API control plane providers to extend the semantic of the + Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates + for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + + Another example are external controllers, e.g. responsible to install special software/hardware on the Machines; + they can include the status of those components with a new condition and add this condition to ReadinessGates. + + NOTE: this field is considered only for computing v1beta2 conditions. + items: + description: MachineReadinessGate contains the type of a Machine + condition to be used as a readiness gate. + properties: + conditionType: + description: |- + conditionType refers to a positive polarity condition (status true means good) with matching type in the Machine's condition list. + If the conditions doesn't exist, it will be treated as unknown. + Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates. + maxLength: 316 + minLength: 1 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - conditionType + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - conditionType + x-kubernetes-list-type: map version: description: |- Version defines the desired Kubernetes version. @@ -1291,6 +1324,79 @@ spec: Phase represents the current phase of machine actuation. E.g. Pending, Running, Terminating, Failed etc. type: string + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in Machine's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a Machine's current state. + Known condition types are Available, Ready, UpToDate, BootstrapConfigReady, InfrastructureReady, NodeReady, + NodeHealthy, Deleting, Paused. + If a MachineHealthCheck is targeting this machine, also HealthCheckSucceeded, OwnerRemediated conditions are added. + Additionally control plane Machines controlled by KubeadmControlPlane will have following additional conditions: + APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy, EtcdPodHealthy, EtcdMemberHealthy. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true diff --git a/config/crd/bases/cluster.x-k8s.io_machinesets.yaml b/config/crd/bases/cluster.x-k8s.io_machinesets.yaml index a1ddfd4ebe8e..baf357672fcb 100644 --- a/config/crd/bases/cluster.x-k8s.io_machinesets.yaml +++ b/config/crd/bases/cluster.x-k8s.io_machinesets.yaml @@ -1235,6 +1235,39 @@ spec: This field will be set by the actuators and consumed by higher level entities like autoscaler that will be interfacing with cluster-api as generic provider. type: string + readinessGates: + description: |- + readinessGates specifies additional conditions to include when evaluating Machine Ready condition. + + This field can be used e.g. by Cluster API control plane providers to extend the semantic of the + Ready condition for the Machine they control, like the kubeadm control provider adding ReadinessGates + for the APIServerPodHealthy, SchedulerPodHealthy conditions, etc. + + Another example are external controllers, e.g. responsible to install special software/hardware on the Machines; + they can include the status of those components with a new condition and add this condition to ReadinessGates. + + NOTE: this field is considered only for computing v1beta2 conditions. + items: + description: MachineReadinessGate contains the type of a + Machine condition to be used as a readiness gate. + properties: + conditionType: + description: |- + conditionType refers to a positive polarity condition (status true means good) with matching type in the Machine's condition list. + If the conditions doesn't exist, it will be treated as unknown. + Note: Both Cluster API conditions or conditions added by 3rd party controllers can be used as readiness gates. + maxLength: 316 + minLength: 1 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - conditionType + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - conditionType + x-kubernetes-list-type: map version: description: |- Version defines the desired Kubernetes version. @@ -1351,6 +1384,93 @@ spec: by clients. The string will be in the same format as the query-param syntax. More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors type: string + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in MachineSet's status with the V1Beta2 version. + properties: + availableReplicas: + description: availableReplicas is the number of available replicas + for this MachineSet. A machine is considered available when + Machine's Available condition is true. + format: int32 + type: integer + conditions: + description: |- + conditions represents the observations of a MachineSet's current state. + Known condition types are MachinesReady, MachinesUpToDate, ScalingUp, ScalingDown, Remediating, Deleting, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + readyReplicas: + description: readyReplicas is the number of ready replicas for + this MachineSet. A machine is considered ready when Machine's + Ready condition is true. + format: int32 + type: integer + upToDateReplicas: + description: upToDateReplicas is the number of up-to-date replicas + for this MachineSet. A machine is considered up-to-date when + Machine's UpToDate condition is true. + format: int32 + type: integer + type: object type: object type: object served: true diff --git a/controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go b/controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go index 88f5395a34c1..c920e0481974 100644 --- a/controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go +++ b/controlplane/kubeadm/api/v1beta1/kubeadm_control_plane_types.go @@ -306,6 +306,35 @@ type KubeadmControlPlaneStatus struct { // LastRemediation stores info about last remediation performed. // +optional LastRemediation *LastRemediationStatus `json:"lastRemediation,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in KubeadmControlPlane's status with the V1Beta2 version. + // +optional + V1Beta2 *KubeadmControlPlaneV1Beta2Status `json:"v1beta2,omitempty"` +} + +// KubeadmControlPlaneV1Beta2Status Groups all the fields that will be added or modified in KubeadmControlPlane with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type KubeadmControlPlaneV1Beta2Status struct { + // conditions represents the observations of a KubeadmControlPlane's current state. + // Known condition types are Available, CertificatesAvailable, EtcdClusterAvailable, MachinesReady, MachinesUpToDate, + // ScalingUp, ScalingDown, Remediating, Deleting, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // readyReplicas is the number of ready replicas for this KubeadmControlPlane. A machine is considered ready when Machine's Ready condition is true. + // +optional + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + + // availableReplicas is the number of available replicas targeted by this KubeadmControlPlane. A machine is considered available when Machine's Available condition is true. + // +optional + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + + // upToDateReplicas is the number of up-to-date replicas targeted by this KubeadmControlPlane. A machine is considered up-to-date when Machine's UpToDate condition is true. + // +optional + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` } // LastRemediationStatus stores info about last remediation performed. @@ -358,6 +387,22 @@ func (in *KubeadmControlPlane) SetConditions(conditions clusterv1.Conditions) { in.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (in *KubeadmControlPlane) GetV1Beta2Conditions() []metav1.Condition { + if in.Status.V1Beta2 == nil { + return nil + } + return in.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (in *KubeadmControlPlane) SetV1Beta2Conditions(conditions []metav1.Condition) { + if in.Status.V1Beta2 == nil && conditions != nil { + in.Status.V1Beta2 = &KubeadmControlPlaneV1Beta2Status{} + } + in.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // KubeadmControlPlaneList contains a list of KubeadmControlPlane. diff --git a/controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go b/controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go new file mode 100644 index 000000000000..81faa410f14a --- /dev/null +++ b/controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go @@ -0,0 +1,75 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + +// Conditions that will be used for the KubeadmControlPlane object in v1Beta2 API version. +const ( + // KubeadmControlPlaneAvailableV1Beta2Condition True if the control plane can be reached, EtcdClusterAvailable is true, + // and CertificatesAvailable is true. + KubeadmControlPlaneAvailableV1Beta2Condition = clusterv1.AvailableV1Beta2Condition + + // KubeadmControlPlaneCertificatesAvailableV1Beta2Condition True if all the cluster certificates exist. + KubeadmControlPlaneCertificatesAvailableV1Beta2Condition = "CertificatesAvailable" + + // KubeadmControlPlaneEtcdClusterAvailableV1Beta2Condition surfaces issues to the managed etcd cluster, if any. + // It is computed as aggregation of Machines's EtcdMemberHealthy (if not using an external etcd) conditions plus + // additional checks validating potential issues to etcd quorum. + KubeadmControlPlaneEtcdClusterAvailableV1Beta2Condition = "EtcdClusterAvailable" + + // KubeadmControlPlaneMachinesReadyV1Beta2Condition surfaces detail of issues on the controlled machines, if any. + // Please note this will include also APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy conditions. + // If not using an external etcd also EtcdPodHealthy, EtcdMemberHealthy conditions are included. + KubeadmControlPlaneMachinesReadyV1Beta2Condition = clusterv1.MachinesReadyV1Beta2Condition + + // KubeadmControlPlaneMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any. + KubeadmControlPlaneMachinesUpToDateV1Beta2Condition = clusterv1.MachinesUpToDateV1Beta2Condition + + // KubeadmControlPlaneScalingUpV1Beta2Condition is true if available replicas < desired replicas. + KubeadmControlPlaneScalingUpV1Beta2Condition = clusterv1.ScalingUpV1Beta2Condition + + // KubeadmControlPlaneScalingDownV1Beta2Condition is true if replicas > desired replicas. + KubeadmControlPlaneScalingDownV1Beta2Condition = clusterv1.ScalingDownV1Beta2Condition + + // KubeadmControlPlaneRemediatingV1Beta2Condition surfaces details about ongoing remediation of the controlled machines, if any. + KubeadmControlPlaneRemediatingV1Beta2Condition = clusterv1.RemediatingV1Beta2Condition + + // KubeadmControlPlaneDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. + KubeadmControlPlaneDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition + + // KubeadmControlPlanePausedV1Beta2Condition is true if this resource or the Cluster it belongs to are paused. + KubeadmControlPlanePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition +) + +// Conditions that will be used for the KubeadmControlPlane controlled machines in v1Beta2 API version. +const ( + // KubeadmControlPlaneMachineAPIServerPodHealthyV1Beta2Condition surfaces the status of the API server pod hosted on a KubeadmControlPlane controlled machine. + KubeadmControlPlaneMachineAPIServerPodHealthyV1Beta2Condition = "APIServerPodHealthy" + + // KubeadmControlPlaneMachineControllerManagerPodHealthyV1Beta2Condition surfaces the status of the controller manager pod hosted on a KubeadmControlPlane controlled machine. + KubeadmControlPlaneMachineControllerManagerPodHealthyV1Beta2Condition = "ControllerManagerPodHealthy" + + // KubeadmControlPlaneMachineSchedulerPodHealthyV1Beta2Condition surfaces the status of the scheduler pod hosted on a KubeadmControlPlane controlled machine. + KubeadmControlPlaneMachineSchedulerPodHealthyV1Beta2Condition = "SchedulerPodHealthy" + + // KubeadmControlPlaneMachineEtcdPodHealthyV1Beta2Condition surfaces the status of the etcd pod hosted on a KubeadmControlPlane controlled machine. + KubeadmControlPlaneMachineEtcdPodHealthyV1Beta2Condition = "EtcdPodHealthy" + + // KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Condition surfaces the status of the etcd member hosted on a KubeadmControlPlane controlled machine. + KubeadmControlPlaneMachineEtcdMemberHealthyV1Beta2Condition = "EtcdMemberHealthy" +) diff --git a/controlplane/kubeadm/api/v1beta1/zz_generated.deepcopy.go b/controlplane/kubeadm/api/v1beta1/zz_generated.deepcopy.go index fdef3a38dfbd..93e38aab396f 100644 --- a/controlplane/kubeadm/api/v1beta1/zz_generated.deepcopy.go +++ b/controlplane/kubeadm/api/v1beta1/zz_generated.deepcopy.go @@ -184,6 +184,11 @@ func (in *KubeadmControlPlaneStatus) DeepCopyInto(out *KubeadmControlPlaneStatus *out = new(LastRemediationStatus) (*in).DeepCopyInto(*out) } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(KubeadmControlPlaneV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmControlPlaneStatus. @@ -358,6 +363,43 @@ func (in *KubeadmControlPlaneTemplateSpec) DeepCopy() *KubeadmControlPlaneTempla return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KubeadmControlPlaneV1Beta2Status) DeepCopyInto(out *KubeadmControlPlaneV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ReadyReplicas != nil { + in, out := &in.ReadyReplicas, &out.ReadyReplicas + *out = new(int32) + **out = **in + } + if in.AvailableReplicas != nil { + in, out := &in.AvailableReplicas, &out.AvailableReplicas + *out = new(int32) + **out = **in + } + if in.UpToDateReplicas != nil { + in, out := &in.UpToDateReplicas, &out.UpToDateReplicas + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeadmControlPlaneV1Beta2Status. +func (in *KubeadmControlPlaneV1Beta2Status) DeepCopy() *KubeadmControlPlaneV1Beta2Status { + if in == nil { + return nil + } + out := new(KubeadmControlPlaneV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LastRemediationStatus) DeepCopyInto(out *LastRemediationStatus) { *out = *in diff --git a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml index cb4668d56d03..a9180b04fc8a 100644 --- a/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml +++ b/controlplane/kubeadm/config/crd/bases/controlplane.cluster.x-k8s.io_kubeadmcontrolplanes.yaml @@ -4538,6 +4538,94 @@ spec: that have the desired template spec. format: int32 type: integer + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in KubeadmControlPlane's status with the V1Beta2 version. + properties: + availableReplicas: + description: availableReplicas is the number of available replicas + targeted by this KubeadmControlPlane. A machine is considered + available when Machine's Available condition is true. + format: int32 + type: integer + conditions: + description: |- + conditions represents the observations of a KubeadmControlPlane's current state. + Known condition types are Available, CertificatesAvailable, EtcdClusterAvailable, MachinesReady, MachinesUpToDate, + ScalingUp, ScalingDown, Remediating, Deleting, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + readyReplicas: + description: readyReplicas is the number of ready replicas for + this KubeadmControlPlane. A machine is considered ready when + Machine's Ready condition is true. + format: int32 + type: integer + upToDateReplicas: + description: upToDateReplicas is the number of up-to-date replicas + targeted by this KubeadmControlPlane. A machine is considered + up-to-date when Machine's UpToDate condition is true. + format: int32 + type: integer + type: object version: description: |- Version represents the minimum Kubernetes version for the control plane machines diff --git a/exp/addons/api/v1beta1/clusterresourceset_types.go b/exp/addons/api/v1beta1/clusterresourceset_types.go index 2800bf190591..df01ec1fe040 100644 --- a/exp/addons/api/v1beta1/clusterresourceset_types.go +++ b/exp/addons/api/v1beta1/clusterresourceset_types.go @@ -101,6 +101,21 @@ type ClusterResourceSetStatus struct { // Conditions defines current state of the ClusterResourceSet. // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in ClusterResourceSet's status with the V1Beta2 version. + // +optional + V1Beta2 *ClusterResourceSetV1Beta2Status `json:"v1beta2,omitempty"` +} + +// ClusterResourceSetV1Beta2Status groups all the fields that will be added or modified in ClusterResourceSet with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type ClusterResourceSetV1Beta2Status struct { + // conditions represents the observations of a ClusterResourceSet's current state. + // Known condition types are ResourceSetApplied, Deleting. + // +optional + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty"` } // ANCHOR_END: ClusterResourceSetStatus @@ -115,6 +130,22 @@ func (m *ClusterResourceSet) SetConditions(conditions clusterv1.Conditions) { m.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (m *ClusterResourceSet) GetV1Beta2Conditions() []metav1.Condition { + if m.Status.V1Beta2 == nil { + return nil + } + return m.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (m *ClusterResourceSet) SetV1Beta2Conditions(conditions []metav1.Condition) { + if m.Status.V1Beta2 == nil && conditions != nil { + m.Status.V1Beta2 = &ClusterResourceSetV1Beta2Status{} + } + m.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // +kubebuilder:resource:path=clusterresourcesets,scope=Namespaced,categories=cluster-api // +kubebuilder:subresource:status diff --git a/exp/addons/api/v1beta1/v1beta2_condition_consts.go b/exp/addons/api/v1beta1/v1beta2_condition_consts.go new file mode 100644 index 000000000000..89fd06a33884 --- /dev/null +++ b/exp/addons/api/v1beta1/v1beta2_condition_consts.go @@ -0,0 +1,32 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + +// Conditions that will be used for the ClusterResourceSet object in v1Beta2 API version. +const ( + // ClusterResourceSetResourceSetAppliedV1Beta2Condition documents that all resources in the ClusterResourceSet object + // are applied to all matching clusters. This indicates all resources exist, and no errors during applying them to all clusters. + ClusterResourceSetResourceSetAppliedV1Beta2Condition = "ResourceSetApplied" + + // ClusterResourceSetDeletingV1Beta2Condition surfaces details about ongoing deletion of the ClusterResourceSet. + ClusterResourceSetDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition + + // ClusterResourceSetPausedV1Beta2Condition is true if this ClusterResourceSet is paused. + ClusterResourceSetPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition +) diff --git a/exp/addons/api/v1beta1/zz_generated.deepcopy.go b/exp/addons/api/v1beta1/zz_generated.deepcopy.go index eaee808480a7..f7afd3968ebc 100644 --- a/exp/addons/api/v1beta1/zz_generated.deepcopy.go +++ b/exp/addons/api/v1beta1/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1beta1 import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -199,6 +200,11 @@ func (in *ClusterResourceSetStatus) DeepCopyInto(out *ClusterResourceSetStatus) (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(ClusterResourceSetV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetStatus. @@ -211,6 +217,28 @@ func (in *ClusterResourceSetStatus) DeepCopy() *ClusterResourceSetStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClusterResourceSetV1Beta2Status) DeepCopyInto(out *ClusterResourceSetV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterResourceSetV1Beta2Status. +func (in *ClusterResourceSetV1Beta2Status) DeepCopy() *ClusterResourceSetV1Beta2Status { + if in == nil { + return nil + } + out := new(ClusterResourceSetV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceBinding) DeepCopyInto(out *ResourceBinding) { *out = *in diff --git a/exp/api/v1beta1/machinepool_types.go b/exp/api/v1beta1/machinepool_types.go index 0c7839998afa..fbe6ab440015 100644 --- a/exp/api/v1beta1/machinepool_types.go +++ b/exp/api/v1beta1/machinepool_types.go @@ -122,6 +122,34 @@ type MachinePoolStatus struct { // Conditions define the current service state of the MachinePool. // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in MachinePool's status with the V1Beta2 version. + // +optional + V1Beta2 *MachinePoolV1Beta2Status `json:"v1beta2,omitempty"` +} + +// MachinePoolV1Beta2Status groups all the fields that will be added or modified in MachinePoolStatus with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type MachinePoolV1Beta2Status struct { + // conditions represents the observations of a MachinePool's current state. + // Known condition types are Available, BootstrapConfigReady, InfrastructureReady, MachinesReady, MachinesUpToDate, + // ScalingUp, ScalingDown, Remediating, Deleting, Paused. + // +optional + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // readyReplicas is the number of ready replicas for this MachinePool. A machine is considered ready when Machine's Ready condition is true. + // +optional + ReadyReplicas *int32 `json:"readyReplicas,omitempty"` + + // availableReplicas is the number of available replicas for this MachinePool. A machine is considered available when Machine's Available condition is true. + // +optional + AvailableReplicas *int32 `json:"availableReplicas,omitempty"` + + // upToDateReplicas is the number of up-to-date replicas targeted by this MachinePool. A machine is considered up-to-date when Machine's UpToDate condition is true. + // +optional + UpToDateReplicas *int32 `json:"upToDateReplicas,omitempty"` } // ANCHOR_END: MachinePoolStatus @@ -238,6 +266,22 @@ func (m *MachinePool) SetConditions(conditions clusterv1.Conditions) { m.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (m *MachinePool) GetV1Beta2Conditions() []metav1.Condition { + if m.Status.V1Beta2 == nil { + return nil + } + return m.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (m *MachinePool) SetV1Beta2Conditions(conditions []metav1.Condition) { + if m.Status.V1Beta2 == nil && conditions != nil { + m.Status.V1Beta2 = &MachinePoolV1Beta2Status{} + } + m.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // MachinePoolList contains a list of MachinePool. diff --git a/exp/api/v1beta1/v1beta2_condition_consts.go b/exp/api/v1beta1/v1beta2_condition_consts.go new file mode 100644 index 000000000000..87a4b44a4604 --- /dev/null +++ b/exp/api/v1beta1/v1beta2_condition_consts.go @@ -0,0 +1,52 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + +// Conditions that will be used for the MachinePool object in v1Beta2 API version. +const ( + // MachinePoolAvailableV1Beta2Condition is true when InfrastructureReady and available replicas >= desired replicas. + MachinePoolAvailableV1Beta2Condition = clusterv1.AvailableV1Beta2Condition + + // MachinePoolBootstrapConfigReadyV1Beta2Condition mirrors the corresponding condition from the MachinePool's BootstrapConfig resource. + MachinePoolBootstrapConfigReadyV1Beta2Condition = clusterv1.BootstrapConfigReadyV1Beta2Condition + + // MachinePoolInfrastructureReadyV1Beta2Condition mirrors the corresponding condition from the MachinePool's Infrastructure resource. + MachinePoolInfrastructureReadyV1Beta2Condition = clusterv1.InfrastructureReadyV1Beta2Condition + + // MachinePoolMachinesReadyV1Beta2Condition surfaces detail of issues on the controlled machines, if any. + MachinePoolMachinesReadyV1Beta2Condition = clusterv1.MachinesReadyV1Beta2Condition + + // MachinePoolMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any. + MachinePoolMachinesUpToDateV1Beta2Condition = clusterv1.MachinesUpToDateV1Beta2Condition + + // MachinePoolScalingUpV1Beta2Condition is true if available replicas < desired replicas. + MachinePoolScalingUpV1Beta2Condition = clusterv1.ScalingUpV1Beta2Condition + + // MachinePoolScalingDownV1Beta2Condition is true if replicas > desired replicas. + MachinePoolScalingDownV1Beta2Condition = clusterv1.ScalingDownV1Beta2Condition + + // MachinePoolRemediatingV1Beta2Condition surfaces details about ongoing remediation of the controlled machines, if any. + MachinePoolRemediatingV1Beta2Condition = clusterv1.RemediatingV1Beta2Condition + + // MachinePoolDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines. + MachinePoolDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition + + // MachinePoolPausedV1Beta2Condition is true if this MachinePool or the Cluster it belongs to are paused. + MachinePoolPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition +) diff --git a/exp/api/v1beta1/zz_generated.deepcopy.go b/exp/api/v1beta1/zz_generated.deepcopy.go index 68cfe8fc8c3c..06bd6b0e9a9b 100644 --- a/exp/api/v1beta1/zz_generated.deepcopy.go +++ b/exp/api/v1beta1/zz_generated.deepcopy.go @@ -22,6 +22,7 @@ package v1beta1 import ( "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" @@ -147,6 +148,11 @@ func (in *MachinePoolStatus) DeepCopyInto(out *MachinePoolStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(MachinePoolV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachinePoolStatus. @@ -158,3 +164,40 @@ func (in *MachinePoolStatus) DeepCopy() *MachinePoolStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MachinePoolV1Beta2Status) DeepCopyInto(out *MachinePoolV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ReadyReplicas != nil { + in, out := &in.ReadyReplicas, &out.ReadyReplicas + *out = new(int32) + **out = **in + } + if in.AvailableReplicas != nil { + in, out := &in.AvailableReplicas, &out.AvailableReplicas + *out = new(int32) + **out = **in + } + if in.UpToDateReplicas != nil { + in, out := &in.UpToDateReplicas, &out.UpToDateReplicas + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MachinePoolV1Beta2Status. +func (in *MachinePoolV1Beta2Status) DeepCopy() *MachinePoolV1Beta2Status { + if in == nil { + return nil + } + out := new(MachinePoolV1Beta2Status) + in.DeepCopyInto(out) + return out +} diff --git a/hack/tools/runtime-openapi-gen/vendored_openapi.go b/hack/tools/runtime-openapi-gen/vendored_openapi.go index c9e5b9d325fb..0205e91be071 100644 --- a/hack/tools/runtime-openapi-gen/vendored_openapi.go +++ b/hack/tools/runtime-openapi-gen/vendored_openapi.go @@ -40,6 +40,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "k8s.io/apimachinery/pkg/apis/meta/v1.Time": schema_pkg_apis_meta_v1_Time(ref), "k8s.io/apimachinery/pkg/runtime.RawExtension": schema_k8sio_apimachinery_pkg_runtime_RawExtension(ref), "k8s.io/apimachinery/pkg/util/intstr.IntOrString": schema_apimachinery_pkg_util_intstr_IntOrString(ref), + "k8s.io/apimachinery/pkg/apis/meta/v1.Condition": schema_pkg_apis_meta_v1_Condition(ref), } } @@ -491,3 +492,64 @@ func schema_apimachinery_pkg_util_intstr_IntOrString(ref common.ReferenceCallbac }, }) } + +func schema_pkg_apis_meta_v1_Condition(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "Condition contains details for one aspect of the current state of this API Resource.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type of condition in CamelCase or in foo.example.com/CamelCase.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "status of the condition, one of True, False, Unknown.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "lastTransitionTime": { + SchemaProps: spec.SchemaProps{ + Description: "lastTransitionTime is the 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.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"), + }, + }, + "reason": { + SchemaProps: spec.SchemaProps{ + Description: "reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "message": { + SchemaProps: spec.SchemaProps{ + Description: "message is a human readable message indicating details about the transition. This may be an empty string.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"type", "status", "lastTransitionTime", "reason", "message"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + } +} diff --git a/internal/apis/bootstrap/kubeadm/v1alpha3/conversion.go b/internal/apis/bootstrap/kubeadm/v1alpha3/conversion.go index 091bca63d2de..4d02942935a3 100644 --- a/internal/apis/bootstrap/kubeadm/v1alpha3/conversion.go +++ b/internal/apis/bootstrap/kubeadm/v1alpha3/conversion.go @@ -38,6 +38,7 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { return err } MergeRestoredKubeadmConfigSpec(&dst.Spec, &restored.Spec) + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -243,3 +244,8 @@ func Convert_v1beta1_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemp // KubeadmConfigTemplateResource.metadata does not exist in kubeadm v1alpha3. return autoConvert_v1beta1_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(in, out, s) } + +func Convert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *bootstrapv1.KubeadmConfigStatus, out *KubeadmConfigStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in, out, s) +} diff --git a/internal/apis/bootstrap/kubeadm/v1alpha3/zz_generated.conversion.go b/internal/apis/bootstrap/kubeadm/v1alpha3/zz_generated.conversion.go index aa20da4f7551..8134a0dd27bf 100644 --- a/internal/apis/bootstrap/kubeadm/v1alpha3/zz_generated.conversion.go +++ b/internal/apis/bootstrap/kubeadm/v1alpha3/zz_generated.conversion.go @@ -99,11 +99,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(a.(*v1beta1.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplate)(nil), (*v1beta1.KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_KubeadmConfigTemplate_To_v1beta1_KubeadmConfigTemplate(a.(*KubeadmConfigTemplate), b.(*v1beta1.KubeadmConfigTemplate), scope) }); err != nil { @@ -219,6 +214,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(a.(*v1beta1.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.KubeadmConfigTemplateResource)(nil), (*KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_KubeadmConfigTemplateResource_To_v1alpha3_KubeadmConfigTemplateResource(a.(*v1beta1.KubeadmConfigTemplateResource), b.(*KubeadmConfigTemplateResource), scope) }); err != nil { @@ -556,14 +556,10 @@ func autoConvert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in out.FailureMessage = in.FailureMessage out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus is an autogenerated conversion function. -func Convert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in *v1beta1.KubeadmConfigStatus, out *KubeadmConfigStatus, s conversion.Scope) error { - return autoConvert_v1beta1_KubeadmConfigStatus_To_v1alpha3_KubeadmConfigStatus(in, out, s) -} - func autoConvert_v1alpha3_KubeadmConfigTemplate_To_v1beta1_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1beta1.KubeadmConfigTemplate, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha3_KubeadmConfigTemplateSpec_To_v1beta1_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/internal/apis/bootstrap/kubeadm/v1alpha4/conversion.go b/internal/apis/bootstrap/kubeadm/v1alpha4/conversion.go index 9544cb41df7b..3f9597aa6784 100644 --- a/internal/apis/bootstrap/kubeadm/v1alpha4/conversion.go +++ b/internal/apis/bootstrap/kubeadm/v1alpha4/conversion.go @@ -37,6 +37,7 @@ func (src *KubeadmConfig) ConvertTo(dstRaw conversion.Hub) error { return err } MergeRestoredKubeadmConfigSpec(&dst.Spec, &restored.Spec) + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -222,3 +223,8 @@ func Convert_v1beta1_LocalEtcd_To_v1alpha4_LocalEtcd(in *bootstrapv1.LocalEtcd, // LocalEtcd.ExtraEnvs does not exist in v1alpha4 APIs. return autoConvert_v1beta1_LocalEtcd_To_v1alpha4_LocalEtcd(in, out, s) } + +func Convert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *bootstrapv1.KubeadmConfigStatus, out *KubeadmConfigStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in, out, s) +} diff --git a/internal/apis/bootstrap/kubeadm/v1alpha4/zz_generated.conversion.go b/internal/apis/bootstrap/kubeadm/v1alpha4/zz_generated.conversion.go index 1e79a52231a3..0e1ff11cb46e 100644 --- a/internal/apis/bootstrap/kubeadm/v1alpha4/zz_generated.conversion.go +++ b/internal/apis/bootstrap/kubeadm/v1alpha4/zz_generated.conversion.go @@ -265,11 +265,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(a.(*v1beta1.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*KubeadmConfigTemplate)(nil), (*v1beta1.KubeadmConfigTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_KubeadmConfigTemplate_To_v1beta1_KubeadmConfigTemplate(a.(*KubeadmConfigTemplate), b.(*v1beta1.KubeadmConfigTemplate), scope) }); err != nil { @@ -390,6 +385,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.KubeadmConfigStatus)(nil), (*KubeadmConfigStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(a.(*v1beta1.KubeadmConfigStatus), b.(*KubeadmConfigStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.KubeadmConfigTemplateResource)(nil), (*KubeadmConfigTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_KubeadmConfigTemplateResource_To_v1alpha4_KubeadmConfigTemplateResource(a.(*v1beta1.KubeadmConfigTemplateResource), b.(*KubeadmConfigTemplateResource), scope) }); err != nil { @@ -1253,14 +1253,10 @@ func autoConvert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in out.FailureMessage = in.FailureMessage out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus is an autogenerated conversion function. -func Convert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in *v1beta1.KubeadmConfigStatus, out *KubeadmConfigStatus, s conversion.Scope) error { - return autoConvert_v1beta1_KubeadmConfigStatus_To_v1alpha4_KubeadmConfigStatus(in, out, s) -} - func autoConvert_v1alpha4_KubeadmConfigTemplate_To_v1beta1_KubeadmConfigTemplate(in *KubeadmConfigTemplate, out *v1beta1.KubeadmConfigTemplate, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha4_KubeadmConfigTemplateSpec_To_v1beta1_KubeadmConfigTemplateSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/internal/apis/controlplane/kubeadm/v1alpha3/conversion.go b/internal/apis/controlplane/kubeadm/v1alpha3/conversion.go index 67a884a4911d..278e01dbcc5f 100644 --- a/internal/apis/controlplane/kubeadm/v1alpha3/conversion.go +++ b/internal/apis/controlplane/kubeadm/v1alpha3/conversion.go @@ -54,6 +54,7 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error { bootstrapv1alpha3.MergeRestoredKubeadmConfigSpec(&dst.Spec.KubeadmConfigSpec, &restored.Spec.KubeadmConfigSpec) dst.Status.Version = restored.Status.Version + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -94,6 +95,7 @@ func Convert_v1beta1_KubeadmControlPlaneSpec_To_v1alpha3_KubeadmControlPlaneSpec func Convert_v1beta1_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus(in *controlplanev1.KubeadmControlPlaneStatus, out *KubeadmControlPlaneStatus, s apiconversion.Scope) error { // NOTE: custom conversion func is required because status.Version does not exist in v1alpha3. + // .V1Beta2 was added in v1beta1. return autoConvert_v1beta1_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPlaneStatus(in, out, s) } diff --git a/internal/apis/controlplane/kubeadm/v1alpha3/zz_generated.conversion.go b/internal/apis/controlplane/kubeadm/v1alpha3/zz_generated.conversion.go index 9dcb33c824b2..1ada5f7dbc15 100644 --- a/internal/apis/controlplane/kubeadm/v1alpha3/zz_generated.conversion.go +++ b/internal/apis/controlplane/kubeadm/v1alpha3/zz_generated.conversion.go @@ -250,6 +250,7 @@ func autoConvert_v1beta1_KubeadmControlPlaneStatus_To_v1alpha3_KubeadmControlPla out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) // WARNING: in.LastRemediation requires manual conversion: does not exist in peer-type + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } diff --git a/internal/apis/controlplane/kubeadm/v1alpha4/conversion.go b/internal/apis/controlplane/kubeadm/v1alpha4/conversion.go index 9c14902efa36..2f9c7b1add42 100644 --- a/internal/apis/controlplane/kubeadm/v1alpha4/conversion.go +++ b/internal/apis/controlplane/kubeadm/v1alpha4/conversion.go @@ -54,6 +54,7 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error { } bootstrapv1alpha4.MergeRestoredKubeadmConfigSpec(&dst.Spec.KubeadmConfigSpec, &restored.Spec.KubeadmConfigSpec) + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -211,6 +212,7 @@ func Convert_v1beta1_KubeadmControlPlaneSpec_To_v1alpha4_KubeadmControlPlaneSpec func Convert_v1beta1_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus(in *controlplanev1.KubeadmControlPlaneStatus, out *KubeadmControlPlaneStatus, scope apiconversion.Scope) error { // .LastRemediation was added in v1beta1. + // .V1Beta2 was added in v1beta1. return autoConvert_v1beta1_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPlaneStatus(in, out, scope) } diff --git a/internal/apis/controlplane/kubeadm/v1alpha4/zz_generated.conversion.go b/internal/apis/controlplane/kubeadm/v1alpha4/zz_generated.conversion.go index 4efbb1b7b795..89b9fb3b93ee 100644 --- a/internal/apis/controlplane/kubeadm/v1alpha4/zz_generated.conversion.go +++ b/internal/apis/controlplane/kubeadm/v1alpha4/zz_generated.conversion.go @@ -355,6 +355,7 @@ func autoConvert_v1beta1_KubeadmControlPlaneStatus_To_v1alpha4_KubeadmControlPla out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) // WARNING: in.LastRemediation requires manual conversion: does not exist in peer-type + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } diff --git a/internal/apis/core/exp/addons/v1alpha3/conversion.go b/internal/apis/core/exp/addons/v1alpha3/conversion.go index e7c38ca772c6..62349d365808 100644 --- a/internal/apis/core/exp/addons/v1alpha3/conversion.go +++ b/internal/apis/core/exp/addons/v1alpha3/conversion.go @@ -27,13 +27,29 @@ import ( func (src *ClusterResourceSet) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*addonsv1.ClusterResourceSet) - return Convert_v1alpha3_ClusterResourceSet_To_v1beta1_ClusterResourceSet(src, dst, nil) + if err := Convert_v1alpha3_ClusterResourceSet_To_v1beta1_ClusterResourceSet(src, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &addonsv1.ClusterResourceSet{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + dst.Status.V1Beta2 = restored.Status.V1Beta2 + + return nil } func (dst *ClusterResourceSet) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*addonsv1.ClusterResourceSet) - return Convert_v1beta1_ClusterResourceSet_To_v1alpha3_ClusterResourceSet(src, dst, nil) + if err := Convert_v1beta1_ClusterResourceSet_To_v1alpha3_ClusterResourceSet(src, dst, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion except for metadata + return utilconversion.MarshalData(src, dst) } func (src *ClusterResourceSetList) ConvertTo(dstRaw conversion.Hub) error { @@ -95,3 +111,8 @@ func Convert_v1beta1_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSe // Spec.ClusterName does not exist in ClusterResourceSetBinding v1alpha3 API. return autoConvert_v1beta1_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResourceSetBindingSpec(in, out, s) } + +func Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in *addonsv1.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1 + return autoConvert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in, out, s) +} diff --git a/internal/apis/core/exp/addons/v1alpha3/zz_generated.conversion.go b/internal/apis/core/exp/addons/v1alpha3/zz_generated.conversion.go index 78ef3a4c549c..083f03a99cf0 100644 --- a/internal/apis/core/exp/addons/v1alpha3/zz_generated.conversion.go +++ b/internal/apis/core/exp/addons/v1alpha3/zz_generated.conversion.go @@ -99,11 +99,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterResourceSetStatus)(nil), (*ClusterResourceSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(a.(*v1beta1.ClusterResourceSetStatus), b.(*ClusterResourceSetStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ResourceBinding)(nil), (*v1beta1.ResourceBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_ResourceBinding_To_v1beta1_ResourceBinding(a.(*ResourceBinding), b.(*v1beta1.ResourceBinding), scope) }); err != nil { @@ -139,6 +134,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterResourceSetStatus)(nil), (*ClusterResourceSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(a.(*v1beta1.ClusterResourceSetStatus), b.(*ClusterResourceSetStatus), scope) + }); err != nil { + return err + } return nil } @@ -260,7 +260,17 @@ func autoConvert_v1beta1_ClusterResourceSetBindingSpec_To_v1alpha3_ClusterResour func autoConvert_v1alpha3_ClusterResourceSetList_To_v1beta1_ClusterResourceSetList(in *ClusterResourceSetList, out *v1beta1.ClusterResourceSetList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1beta1.ClusterResourceSet)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta1.ClusterResourceSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha3_ClusterResourceSet_To_v1beta1_ClusterResourceSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -271,7 +281,17 @@ func Convert_v1alpha3_ClusterResourceSetList_To_v1beta1_ClusterResourceSetList(i func autoConvert_v1beta1_ClusterResourceSetList_To_v1alpha3_ClusterResourceSetList(in *v1beta1.ClusterResourceSetList, out *ClusterResourceSetList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]ClusterResourceSet)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterResourceSet, len(*in)) + for i := range *in { + if err := Convert_v1beta1_ClusterResourceSet_To_v1alpha3_ClusterResourceSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -318,14 +338,10 @@ func Convert_v1alpha3_ClusterResourceSetStatus_To_v1beta1_ClusterResourceSetStat func autoConvert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in *v1beta1.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s conversion.Scope) error { out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus is an autogenerated conversion function. -func Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in *v1beta1.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterResourceSetStatus_To_v1alpha3_ClusterResourceSetStatus(in, out, s) -} - func autoConvert_v1alpha3_ResourceBinding_To_v1beta1_ResourceBinding(in *ResourceBinding, out *v1beta1.ResourceBinding, s conversion.Scope) error { if err := Convert_v1alpha3_ResourceRef_To_v1beta1_ResourceRef(&in.ResourceRef, &out.ResourceRef, s); err != nil { return err diff --git a/internal/apis/core/exp/addons/v1alpha4/conversion.go b/internal/apis/core/exp/addons/v1alpha4/conversion.go index b1863ff4eaf6..2b5cc20ac6d9 100644 --- a/internal/apis/core/exp/addons/v1alpha4/conversion.go +++ b/internal/apis/core/exp/addons/v1alpha4/conversion.go @@ -27,13 +27,29 @@ import ( func (src *ClusterResourceSet) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*addonsv1.ClusterResourceSet) - return Convert_v1alpha4_ClusterResourceSet_To_v1beta1_ClusterResourceSet(src, dst, nil) + if err := Convert_v1alpha4_ClusterResourceSet_To_v1beta1_ClusterResourceSet(src, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &addonsv1.ClusterResourceSet{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + dst.Status.V1Beta2 = restored.Status.V1Beta2 + + return nil } func (dst *ClusterResourceSet) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*addonsv1.ClusterResourceSet) - return Convert_v1beta1_ClusterResourceSet_To_v1alpha4_ClusterResourceSet(src, dst, nil) + if err := Convert_v1beta1_ClusterResourceSet_To_v1alpha4_ClusterResourceSet(src, dst, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion except for metadata + return utilconversion.MarshalData(src, dst) } func (src *ClusterResourceSetList) ConvertTo(dstRaw conversion.Hub) error { @@ -95,3 +111,8 @@ func Convert_v1beta1_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSe // Spec.ClusterName does not exist in ClusterResourceSetBinding v1alpha4 API. return autoConvert_v1beta1_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResourceSetBindingSpec(in, out, s) } + +func Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in *addonsv1.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1 + return autoConvert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in, out, s) +} diff --git a/internal/apis/core/exp/addons/v1alpha4/zz_generated.conversion.go b/internal/apis/core/exp/addons/v1alpha4/zz_generated.conversion.go index 8830345af13f..2abcae0a89e3 100644 --- a/internal/apis/core/exp/addons/v1alpha4/zz_generated.conversion.go +++ b/internal/apis/core/exp/addons/v1alpha4/zz_generated.conversion.go @@ -99,11 +99,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterResourceSetStatus)(nil), (*ClusterResourceSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(a.(*v1beta1.ClusterResourceSetStatus), b.(*ClusterResourceSetStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ResourceBinding)(nil), (*v1beta1.ResourceBinding)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_ResourceBinding_To_v1beta1_ResourceBinding(a.(*ResourceBinding), b.(*v1beta1.ResourceBinding), scope) }); err != nil { @@ -139,6 +134,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterResourceSetStatus)(nil), (*ClusterResourceSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(a.(*v1beta1.ClusterResourceSetStatus), b.(*ClusterResourceSetStatus), scope) + }); err != nil { + return err + } return nil } @@ -260,7 +260,17 @@ func autoConvert_v1beta1_ClusterResourceSetBindingSpec_To_v1alpha4_ClusterResour func autoConvert_v1alpha4_ClusterResourceSetList_To_v1beta1_ClusterResourceSetList(in *ClusterResourceSetList, out *v1beta1.ClusterResourceSetList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1beta1.ClusterResourceSet)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta1.ClusterResourceSet, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_ClusterResourceSet_To_v1beta1_ClusterResourceSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -271,7 +281,17 @@ func Convert_v1alpha4_ClusterResourceSetList_To_v1beta1_ClusterResourceSetList(i func autoConvert_v1beta1_ClusterResourceSetList_To_v1alpha4_ClusterResourceSetList(in *v1beta1.ClusterResourceSetList, out *ClusterResourceSetList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]ClusterResourceSet)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClusterResourceSet, len(*in)) + for i := range *in { + if err := Convert_v1beta1_ClusterResourceSet_To_v1alpha4_ClusterResourceSet(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -318,14 +338,10 @@ func Convert_v1alpha4_ClusterResourceSetStatus_To_v1beta1_ClusterResourceSetStat func autoConvert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in *v1beta1.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s conversion.Scope) error { out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus is an autogenerated conversion function. -func Convert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in *v1beta1.ClusterResourceSetStatus, out *ClusterResourceSetStatus, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterResourceSetStatus_To_v1alpha4_ClusterResourceSetStatus(in, out, s) -} - func autoConvert_v1alpha4_ResourceBinding_To_v1beta1_ResourceBinding(in *ResourceBinding, out *v1beta1.ResourceBinding, s conversion.Scope) error { if err := Convert_v1alpha4_ResourceRef_To_v1beta1_ResourceRef(&in.ResourceRef, &out.ResourceRef, s); err != nil { return err diff --git a/internal/apis/core/exp/v1alpha3/conversion.go b/internal/apis/core/exp/v1alpha3/conversion.go index 1aae52b47bee..e2a80b95218b 100644 --- a/internal/apis/core/exp/v1alpha3/conversion.go +++ b/internal/apis/core/exp/v1alpha3/conversion.go @@ -72,8 +72,11 @@ func (src *MachinePool) ConvertTo(dstRaw conversion.Hub) error { if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { return err } + dst.Spec.Template.Spec.ReadinessGates = restored.Spec.Template.Spec.ReadinessGates dst.Spec.Template.Spec.NodeDeletionTimeout = restored.Spec.Template.Spec.NodeDeletionTimeout dst.Spec.Template.Spec.NodeVolumeDetachTimeout = restored.Spec.Template.Spec.NodeVolumeDetachTimeout + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -106,3 +109,8 @@ func Convert_v1alpha3_MachineTemplateSpec_To_v1beta1_MachineTemplateSpec(in *clu func Convert_v1beta1_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in *clusterv1.MachineTemplateSpec, out *clusterv1alpha3.MachineTemplateSpec, s apimachineryconversion.Scope) error { return clusterv1alpha3.Convert_v1beta1_MachineTemplateSpec_To_v1alpha3_MachineTemplateSpec(in, out, s) } + +func Convert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in *expv1.MachinePoolStatus, out *MachinePoolStatus, s apimachineryconversion.Scope) error { + // V1Beta2 was added in v1beta1 + return autoConvert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in, out, s) +} diff --git a/internal/apis/core/exp/v1alpha3/zz_generated.conversion.go b/internal/apis/core/exp/v1alpha3/zz_generated.conversion.go index 35410aaf1175..6f65b4b2f037 100644 --- a/internal/apis/core/exp/v1alpha3/zz_generated.conversion.go +++ b/internal/apis/core/exp/v1alpha3/zz_generated.conversion.go @@ -60,11 +60,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.MachinePoolStatus)(nil), (*MachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(a.(*v1beta1.MachinePoolStatus), b.(*MachinePoolStatus), scope) - }); err != nil { - return err - } if err := s.AddConversionFunc((*MachinePoolSpec)(nil), (*v1beta1.MachinePoolSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_MachinePoolSpec_To_v1beta1_MachinePoolSpec(a.(*MachinePoolSpec), b.(*v1beta1.MachinePoolSpec), scope) }); err != nil { @@ -80,6 +75,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.MachinePoolStatus)(nil), (*MachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(a.(*v1beta1.MachinePoolStatus), b.(*MachinePoolStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.MachinePool)(nil), (*MachinePool)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachinePool_To_v1alpha3_MachinePool(a.(*v1beta1.MachinePool), b.(*MachinePool), scope) }); err != nil { @@ -221,10 +221,6 @@ func autoConvert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in *v1b out.InfrastructureReady = in.InfrastructureReady out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } - -// Convert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus is an autogenerated conversion function. -func Convert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in *v1beta1.MachinePoolStatus, out *MachinePoolStatus, s conversion.Scope) error { - return autoConvert_v1beta1_MachinePoolStatus_To_v1alpha3_MachinePoolStatus(in, out, s) -} diff --git a/internal/apis/core/exp/v1alpha4/conversion.go b/internal/apis/core/exp/v1alpha4/conversion.go index 70d9bde60f00..7333658a0416 100644 --- a/internal/apis/core/exp/v1alpha4/conversion.go +++ b/internal/apis/core/exp/v1alpha4/conversion.go @@ -38,8 +38,11 @@ func (src *MachinePool) ConvertTo(dstRaw conversion.Hub) error { if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { return err } + dst.Spec.Template.Spec.ReadinessGates = restored.Spec.Template.Spec.ReadinessGates dst.Spec.Template.Spec.NodeDeletionTimeout = restored.Spec.Template.Spec.NodeDeletionTimeout dst.Spec.Template.Spec.NodeVolumeDetachTimeout = restored.Spec.Template.Spec.NodeVolumeDetachTimeout + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -71,3 +74,8 @@ func Convert_v1alpha4_MachineTemplateSpec_To_v1beta1_MachineTemplateSpec(in *clu func Convert_v1beta1_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(in *clusterv1.MachineTemplateSpec, out *clusterv1alpha4.MachineTemplateSpec, s apimachineryconversion.Scope) error { return clusterv1alpha4.Convert_v1beta1_MachineTemplateSpec_To_v1alpha4_MachineTemplateSpec(in, out, s) } + +func Convert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in *expv1.MachinePoolStatus, out *MachinePoolStatus, s apimachineryconversion.Scope) error { + // V1Beta2 was added in v1beta1 + return autoConvert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in, out, s) +} diff --git a/internal/apis/core/exp/v1alpha4/conversion_test.go b/internal/apis/core/exp/v1alpha4/conversion_test.go index ff09b35416f1..bff86035f730 100644 --- a/internal/apis/core/exp/v1alpha4/conversion_test.go +++ b/internal/apis/core/exp/v1alpha4/conversion_test.go @@ -21,8 +21,6 @@ package v1alpha4 import ( "testing" - "k8s.io/apimachinery/pkg/api/apitesting/fuzzer" - expv1 "sigs.k8s.io/cluster-api/exp/api/v1beta1" utilconversion "sigs.k8s.io/cluster-api/util/conversion" ) @@ -31,8 +29,7 @@ import ( func TestFuzzyConversion(t *testing.T) { t.Run("for MachinePool", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Hub: &expv1.MachinePool{}, - Spoke: &MachinePool{}, - FuzzerFuncs: []fuzzer.FuzzerFuncs{}, + Hub: &expv1.MachinePool{}, + Spoke: &MachinePool{}, })) } diff --git a/internal/apis/core/exp/v1alpha4/zz_generated.conversion.go b/internal/apis/core/exp/v1alpha4/zz_generated.conversion.go index 2d0dff177b01..c3a04594f280 100644 --- a/internal/apis/core/exp/v1alpha4/zz_generated.conversion.go +++ b/internal/apis/core/exp/v1alpha4/zz_generated.conversion.go @@ -75,13 +75,13 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.MachinePoolStatus)(nil), (*MachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(a.(*v1beta1.MachinePoolStatus), b.(*MachinePoolStatus), scope) + if err := s.AddConversionFunc((*corev1alpha4.MachineTemplateSpec)(nil), (*apiv1beta1.MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha4_MachineTemplateSpec_To_v1beta1_MachineTemplateSpec(a.(*corev1alpha4.MachineTemplateSpec), b.(*apiv1beta1.MachineTemplateSpec), scope) }); err != nil { return err } - if err := s.AddConversionFunc((*corev1alpha4.MachineTemplateSpec)(nil), (*apiv1beta1.MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha4_MachineTemplateSpec_To_v1beta1_MachineTemplateSpec(a.(*corev1alpha4.MachineTemplateSpec), b.(*apiv1beta1.MachineTemplateSpec), scope) + if err := s.AddConversionFunc((*v1beta1.MachinePoolStatus)(nil), (*MachinePoolStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(a.(*v1beta1.MachinePoolStatus), b.(*MachinePoolStatus), scope) }); err != nil { return err } @@ -235,10 +235,6 @@ func autoConvert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in *v1b out.InfrastructureReady = in.InfrastructureReady out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*corev1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } - -// Convert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus is an autogenerated conversion function. -func Convert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in *v1beta1.MachinePoolStatus, out *MachinePoolStatus, s conversion.Scope) error { - return autoConvert_v1beta1_MachinePoolStatus_To_v1alpha4_MachinePoolStatus(in, out, s) -} diff --git a/internal/apis/core/v1alpha3/conversion.go b/internal/apis/core/v1alpha3/conversion.go index c325b48cee21..ae90b81459c8 100644 --- a/internal/apis/core/v1alpha3/conversion.go +++ b/internal/apis/core/v1alpha3/conversion.go @@ -45,9 +45,11 @@ func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { return err } + dst.Spec.AvailabilityGates = restored.Spec.AvailabilityGates if restored.Spec.Topology != nil { dst.Spec.Topology = restored.Spec.Topology } + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -97,11 +99,14 @@ func (src *Machine) ConvertTo(dstRaw conversion.Hub) error { return err } + dst.Spec.ReadinessGates = restored.Spec.ReadinessGates dst.Spec.NodeDeletionTimeout = restored.Spec.NodeDeletionTimeout dst.Spec.NodeVolumeDetachTimeout = restored.Spec.NodeVolumeDetachTimeout dst.Status.NodeInfo = restored.Status.NodeInfo dst.Status.CertificatesExpiryDate = restored.Status.CertificatesExpiryDate dst.Status.Deletion = restored.Status.Deletion + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -143,9 +148,12 @@ func (src *MachineSet) ConvertTo(dstRaw conversion.Hub) error { if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { return err } + dst.Spec.Template.Spec.ReadinessGates = restored.Spec.Template.Spec.ReadinessGates dst.Spec.Template.Spec.NodeDeletionTimeout = restored.Spec.Template.Spec.NodeDeletionTimeout dst.Spec.Template.Spec.NodeVolumeDetachTimeout = restored.Spec.Template.Spec.NodeVolumeDetachTimeout dst.Status.Conditions = restored.Status.Conditions + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -201,10 +209,13 @@ func (src *MachineDeployment) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Strategy.Remediation = restored.Spec.Strategy.Remediation } + dst.Spec.Template.Spec.ReadinessGates = restored.Spec.Template.Spec.ReadinessGates dst.Spec.Template.Spec.NodeDeletionTimeout = restored.Spec.Template.Spec.NodeDeletionTimeout dst.Spec.Template.Spec.NodeVolumeDetachTimeout = restored.Spec.Template.Spec.NodeVolumeDetachTimeout dst.Spec.RolloutAfter = restored.Spec.RolloutAfter dst.Status.Conditions = restored.Status.Conditions + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -251,6 +262,7 @@ func (src *MachineHealthCheck) ConvertTo(dstRaw conversion.Hub) error { if restored.Spec.UnhealthyRange != nil { dst.Spec.UnhealthyRange = restored.Spec.UnhealthyRange } + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -284,14 +296,21 @@ func (dst *MachineHealthCheckList) ConvertFrom(srcRaw conversion.Hub) error { func Convert_v1beta1_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *clusterv1.MachineSetStatus, out *MachineSetStatus, _ apiconversion.Scope) error { // Status.Conditions was introduced in v1alpha4, thus requiring a custom conversion function; the values is going to be preserved in an annotation thus allowing roundtrip without loosing informations + // V1Beta2 was added in v1beta1. return autoConvert_v1beta1_MachineSetStatus_To_v1alpha3_MachineSetStatus(in, out, nil) } func Convert_v1beta1_ClusterSpec_To_v1alpha3_ClusterSpec(in *clusterv1.ClusterSpec, out *ClusterSpec, s apiconversion.Scope) error { // NOTE: custom conversion func is required because spec.Topology does not exist in v1alpha3 + // AvailabilityGates was added in v1beta1. return autoConvert_v1beta1_ClusterSpec_To_v1alpha3_ClusterSpec(in, out, s) } +func Convert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus(in *clusterv1.ClusterStatus, out *ClusterStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus(in, out, s) +} + func Convert_v1alpha3_Bootstrap_To_v1beta1_Bootstrap(in *Bootstrap, out *clusterv1.Bootstrap, s apiconversion.Scope) error { return autoConvert_v1alpha3_Bootstrap_To_v1beta1_Bootstrap(in, out, s) } @@ -304,6 +323,11 @@ func Convert_v1beta1_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(i return autoConvert_v1beta1_MachineHealthCheckSpec_To_v1alpha3_MachineHealthCheckSpec(in, out, s) } +func Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(in *clusterv1.MachineHealthCheckStatus, out *MachineHealthCheckStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(in, out, s) +} + func Convert_v1alpha3_ClusterStatus_To_v1beta1_ClusterStatus(in *ClusterStatus, out *clusterv1.ClusterStatus, s apiconversion.Scope) error { return autoConvert_v1alpha3_ClusterStatus_To_v1beta1_ClusterStatus(in, out, s) } @@ -313,11 +337,13 @@ func Convert_v1alpha3_ObjectMeta_To_v1beta1_ObjectMeta(in *ObjectMeta, out *clus } func Convert_v1beta1_MachineStatus_To_v1alpha3_MachineStatus(in *clusterv1.MachineStatus, out *MachineStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. return autoConvert_v1beta1_MachineStatus_To_v1alpha3_MachineStatus(in, out, s) } func Convert_v1beta1_MachineSpec_To_v1alpha3_MachineSpec(in *clusterv1.MachineSpec, out *MachineSpec, s apiconversion.Scope) error { - // spec.nodeDeletionTimeout has been added with v1beta1. + // spec.nodeDeletionTimeout was added in v1beta1. + // ReadinessGates was added in v1beta1. return autoConvert_v1beta1_MachineSpec_To_v1alpha3_MachineSpec(in, out, s) } @@ -327,6 +353,7 @@ func Convert_v1beta1_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(in func Convert_v1beta1_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in *clusterv1.MachineDeploymentStatus, out *MachineDeploymentStatus, s apiconversion.Scope) error { // Status.Conditions was introduced in v1alpha4, thus requiring a custom conversion function; the values is going to be preserved in an annotation thus allowing roundtrip without loosing informations + // V1Beta2 was added in v1beta1. return autoConvert_v1beta1_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentStatus(in, out, s) } diff --git a/internal/apis/core/v1alpha3/zz_generated.conversion.go b/internal/apis/core/v1alpha3/zz_generated.conversion.go index ec286c3c42fb..23d631ab59e9 100644 --- a/internal/apis/core/v1alpha3/zz_generated.conversion.go +++ b/internal/apis/core/v1alpha3/zz_generated.conversion.go @@ -90,11 +90,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus(a.(*v1beta1.ClusterStatus), b.(*ClusterStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*Condition)(nil), (*v1beta1.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_Condition_To_v1beta1_Condition(a.(*Condition), b.(*v1beta1.Condition), scope) }); err != nil { @@ -200,11 +195,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.MachineHealthCheckStatus)(nil), (*MachineHealthCheckStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(a.(*v1beta1.MachineHealthCheckStatus), b.(*MachineHealthCheckStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*MachineList)(nil), (*v1beta1.MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_MachineList_To_v1beta1_MachineList(a.(*MachineList), b.(*v1beta1.MachineList), scope) }); err != nil { @@ -315,6 +305,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus(a.(*v1beta1.ClusterStatus), b.(*ClusterStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.MachineDeploymentSpec)(nil), (*MachineDeploymentSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachineDeploymentSpec_To_v1alpha3_MachineDeploymentSpec(a.(*v1beta1.MachineDeploymentSpec), b.(*MachineDeploymentSpec), scope) }); err != nil { @@ -335,6 +330,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.MachineHealthCheckStatus)(nil), (*MachineHealthCheckStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(a.(*v1beta1.MachineHealthCheckStatus), b.(*MachineHealthCheckStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.MachineRollingUpdateDeployment)(nil), (*MachineRollingUpdateDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachineRollingUpdateDeployment_To_v1alpha3_MachineRollingUpdateDeployment(a.(*v1beta1.MachineRollingUpdateDeployment), b.(*MachineRollingUpdateDeployment), scope) }); err != nil { @@ -528,6 +528,7 @@ func autoConvert_v1beta1_ClusterSpec_To_v1alpha3_ClusterSpec(in *v1beta1.Cluster out.ControlPlaneRef = (*v1.ObjectReference)(unsafe.Pointer(in.ControlPlaneRef)) out.InfrastructureRef = (*v1.ObjectReference)(unsafe.Pointer(in.InfrastructureRef)) // WARNING: in.Topology requires manual conversion: does not exist in peer-type + // WARNING: in.AvailabilityGates requires manual conversion: does not exist in peer-type return nil } @@ -553,14 +554,10 @@ func autoConvert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus(in *v1beta1.Clu out.ControlPlaneReady = in.ControlPlaneReady out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) out.ObservedGeneration = in.ObservedGeneration + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus(in *v1beta1.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterStatus_To_v1alpha3_ClusterStatus(in, out, s) -} - func autoConvert_v1alpha3_Condition_To_v1beta1_Condition(in *Condition, out *v1beta1.Condition, s conversion.Scope) error { out.Type = v1beta1.ConditionType(in.Type) out.Status = v1.ConditionStatus(in.Status) @@ -820,6 +817,7 @@ func autoConvert_v1beta1_MachineDeploymentStatus_To_v1alpha3_MachineDeploymentSt out.UnavailableReplicas = in.UnavailableReplicas out.Phase = in.Phase // WARNING: in.Conditions requires manual conversion: does not exist in peer-type + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } @@ -979,14 +977,10 @@ func autoConvert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheck out.ObservedGeneration = in.ObservedGeneration out.Targets = *(*[]string)(unsafe.Pointer(&in.Targets)) out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus is an autogenerated conversion function. -func Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(in *v1beta1.MachineHealthCheckStatus, out *MachineHealthCheckStatus, s conversion.Scope) error { - return autoConvert_v1beta1_MachineHealthCheckStatus_To_v1alpha3_MachineHealthCheckStatus(in, out, s) -} - func autoConvert_v1alpha3_MachineList_To_v1beta1_MachineList(in *MachineList, out *v1beta1.MachineList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { @@ -1177,6 +1171,7 @@ func autoConvert_v1beta1_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *v1bet out.FailureReason = (*errors.MachineSetStatusError)(unsafe.Pointer(in.FailureReason)) out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) // WARNING: in.Conditions requires manual conversion: does not exist in peer-type + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } @@ -1207,6 +1202,7 @@ func autoConvert_v1beta1_MachineSpec_To_v1alpha3_MachineSpec(in *v1beta1.Machine out.Version = (*string)(unsafe.Pointer(in.Version)) out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) + // WARNING: in.ReadinessGates requires manual conversion: does not exist in peer-type out.NodeDrainTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) // WARNING: in.NodeVolumeDetachTimeout requires manual conversion: does not exist in peer-type // WARNING: in.NodeDeletionTimeout requires manual conversion: does not exist in peer-type @@ -1242,6 +1238,7 @@ func autoConvert_v1beta1_MachineStatus_To_v1alpha3_MachineStatus(in *v1beta1.Mac out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) // WARNING: in.Deletion requires manual conversion: does not exist in peer-type + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } diff --git a/internal/apis/core/v1alpha4/conversion.go b/internal/apis/core/v1alpha4/conversion.go index 8043349a9678..cd69ca35d2ba 100644 --- a/internal/apis/core/v1alpha4/conversion.go +++ b/internal/apis/core/v1alpha4/conversion.go @@ -37,6 +37,7 @@ func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { return err } + dst.Spec.AvailabilityGates = restored.Spec.AvailabilityGates if restored.Spec.Topology != nil { if dst.Spec.Topology == nil { dst.Spec.Topology = &clusterv1.Topology{} @@ -78,6 +79,7 @@ func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Topology.Workers.MachinePools = restored.Spec.Topology.Workers.MachinePools } } + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -141,7 +143,6 @@ func (src *ClusterClass) ConvertTo(dstRaw conversion.Hub) error { dst.Spec.Workers.MachineDeployments[i].MinReadySeconds = restored.Spec.Workers.MachineDeployments[i].MinReadySeconds dst.Spec.Workers.MachineDeployments[i].Strategy = restored.Spec.Workers.MachineDeployments[i].Strategy } - dst.Status = restored.Status return nil @@ -187,10 +188,13 @@ func (src *Machine) ConvertTo(dstRaw conversion.Hub) error { return err } + dst.Spec.ReadinessGates = restored.Spec.ReadinessGates dst.Spec.NodeDeletionTimeout = restored.Spec.NodeDeletionTimeout dst.Status.CertificatesExpiryDate = restored.Status.CertificatesExpiryDate dst.Spec.NodeVolumeDetachTimeout = restored.Spec.NodeVolumeDetachTimeout dst.Status.Deletion = restored.Status.Deletion + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -234,8 +238,11 @@ func (src *MachineSet) ConvertTo(dstRaw conversion.Hub) error { return err } + dst.Spec.Template.Spec.ReadinessGates = restored.Spec.Template.Spec.ReadinessGates dst.Spec.Template.Spec.NodeDeletionTimeout = restored.Spec.Template.Spec.NodeDeletionTimeout dst.Spec.Template.Spec.NodeVolumeDetachTimeout = restored.Spec.Template.Spec.NodeVolumeDetachTimeout + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -275,6 +282,7 @@ func (src *MachineDeployment) ConvertTo(dstRaw conversion.Hub) error { return err } + dst.Spec.Template.Spec.ReadinessGates = restored.Spec.Template.Spec.ReadinessGates dst.Spec.Template.Spec.NodeDeletionTimeout = restored.Spec.Template.Spec.NodeDeletionTimeout dst.Spec.Template.Spec.NodeVolumeDetachTimeout = restored.Spec.Template.Spec.NodeVolumeDetachTimeout dst.Spec.RolloutAfter = restored.Spec.RolloutAfter @@ -285,6 +293,8 @@ func (src *MachineDeployment) ConvertTo(dstRaw conversion.Hub) error { } dst.Spec.Strategy.Remediation = restored.Spec.Strategy.Remediation } + dst.Status.V1Beta2 = restored.Status.V1Beta2 + return nil } @@ -314,13 +324,29 @@ func (dst *MachineDeploymentList) ConvertFrom(srcRaw conversion.Hub) error { func (src *MachineHealthCheck) ConvertTo(dstRaw conversion.Hub) error { dst := dstRaw.(*clusterv1.MachineHealthCheck) - return Convert_v1alpha4_MachineHealthCheck_To_v1beta1_MachineHealthCheck(src, dst, nil) + if err := Convert_v1alpha4_MachineHealthCheck_To_v1beta1_MachineHealthCheck(src, dst, nil); err != nil { + return err + } + + // Manually restore data. + restored := &clusterv1.MachineHealthCheck{} + if ok, err := utilconversion.UnmarshalData(src, restored); err != nil || !ok { + return err + } + dst.Status.V1Beta2 = restored.Status.V1Beta2 + + return nil } func (dst *MachineHealthCheck) ConvertFrom(srcRaw conversion.Hub) error { src := srcRaw.(*clusterv1.MachineHealthCheck) - return Convert_v1beta1_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(src, dst, nil) + if err := Convert_v1beta1_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(src, dst, nil); err != nil { + return err + } + + // Preserve Hub data on down-conversion except for metadata + return utilconversion.MarshalData(src, dst) } func (src *MachineHealthCheckList) ConvertTo(dstRaw conversion.Hub) error { @@ -346,7 +372,8 @@ func Convert_v1beta1_ClusterClassSpec_To_v1alpha4_ClusterClassSpec(in *clusterv1 } func Convert_v1beta1_MachineSpec_To_v1alpha4_MachineSpec(in *clusterv1.MachineSpec, out *MachineSpec, s apiconversion.Scope) error { - // spec.nodeDeletionTimeout has been added with v1beta1. + // spec.nodeDeletionTimeout was added in v1beta1. + // ReadinessGates was added in v1beta1. return autoConvert_v1beta1_MachineSpec_To_v1alpha4_MachineSpec(in, out, s) } @@ -354,6 +381,16 @@ func Convert_v1beta1_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec(in return autoConvert_v1beta1_MachineDeploymentSpec_To_v1alpha4_MachineDeploymentSpec(in, out, s) } +func Convert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec(in *clusterv1.ClusterSpec, out *ClusterSpec, s apiconversion.Scope) error { + // AvailabilityGates was added in v1beta1. + return autoConvert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec(in, out, s) +} + +func Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in *clusterv1.ClusterStatus, out *ClusterStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in, out, s) +} + func Convert_v1beta1_Topology_To_v1alpha4_Topology(in *clusterv1.Topology, out *Topology, s apiconversion.Scope) error { // spec.topology.variables has been added with v1beta1. return autoConvert_v1beta1_Topology_To_v1alpha4_Topology(in, out, s) @@ -382,6 +419,7 @@ func Convert_v1beta1_ControlPlaneTopology_To_v1alpha4_ControlPlaneTopology(in *c func Convert_v1beta1_MachineStatus_To_v1alpha4_MachineStatus(in *clusterv1.MachineStatus, out *MachineStatus, s apiconversion.Scope) error { // MachineStatus.CertificatesExpiryDate has been added in v1beta1. + // V1Beta2 was added in v1beta1. return autoConvert_v1beta1_MachineStatus_To_v1alpha4_MachineStatus(in, out, s) } @@ -407,3 +445,18 @@ func Convert_v1beta1_MachineDeploymentStrategy_To_v1alpha4_MachineDeploymentStra func Convert_v1beta1_MachineSetSpec_To_v1alpha4_MachineSetSpec(in *clusterv1.MachineSetSpec, out *MachineSetSpec, s apiconversion.Scope) error { return autoConvert_v1beta1_MachineSetSpec_To_v1alpha4_MachineSetSpec(in, out, s) } + +func Convert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(in *clusterv1.MachineDeploymentStatus, out *MachineDeploymentStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(in, out, s) +} + +func Convert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus(in *clusterv1.MachineSetStatus, out *MachineSetStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus(in, out, s) +} + +func Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(in *clusterv1.MachineHealthCheckStatus, out *MachineHealthCheckStatus, s apiconversion.Scope) error { + // V1Beta2 was added in v1beta1. + return autoConvert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(in, out, s) +} diff --git a/internal/apis/core/v1alpha4/conversion_test.go b/internal/apis/core/v1alpha4/conversion_test.go index 2b74481dc99e..59a659454ab2 100644 --- a/internal/apis/core/v1alpha4/conversion_test.go +++ b/internal/apis/core/v1alpha4/conversion_test.go @@ -53,13 +53,15 @@ func TestFuzzyConversion(t *testing.T) { })) t.Run("for MachineSet", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Hub: &clusterv1.MachineSet{}, - Spoke: &MachineSet{}, + Hub: &clusterv1.MachineSet{}, + Spoke: &MachineSet{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{}, })) t.Run("for MachineDeployment", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ - Hub: &clusterv1.MachineDeployment{}, - Spoke: &MachineDeployment{}, + Hub: &clusterv1.MachineDeployment{}, + Spoke: &MachineDeployment{}, + FuzzerFuncs: []fuzzer.FuzzerFuncs{}, })) t.Run("for MachineHealthCheck", utilconversion.FuzzTestFunc(utilconversion.FuzzTestFuncInput{ diff --git a/internal/apis/core/v1alpha4/zz_generated.conversion.go b/internal/apis/core/v1alpha4/zz_generated.conversion.go index 4b504ce878c8..14df0dfc9112 100644 --- a/internal/apis/core/v1alpha4/zz_generated.conversion.go +++ b/internal/apis/core/v1alpha4/zz_generated.conversion.go @@ -115,21 +115,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterSpec)(nil), (*ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec(a.(*v1beta1.ClusterSpec), b.(*ClusterSpec), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*ClusterStatus)(nil), (*v1beta1.ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(a.(*ClusterStatus), b.(*v1beta1.ClusterStatus), scope) }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(a.(*v1beta1.ClusterStatus), b.(*ClusterStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*Condition)(nil), (*v1beta1.Condition)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_Condition_To_v1beta1_Condition(a.(*Condition), b.(*v1beta1.Condition), scope) }); err != nil { @@ -235,11 +225,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.MachineDeploymentStatus)(nil), (*MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(a.(*v1beta1.MachineDeploymentStatus), b.(*MachineDeploymentStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*MachineDeploymentStrategy)(nil), (*v1beta1.MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_MachineDeploymentStrategy_To_v1beta1_MachineDeploymentStrategy(a.(*MachineDeploymentStrategy), b.(*v1beta1.MachineDeploymentStrategy), scope) }); err != nil { @@ -285,11 +270,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.MachineHealthCheckStatus)(nil), (*MachineHealthCheckStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(a.(*v1beta1.MachineHealthCheckStatus), b.(*MachineHealthCheckStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*MachineList)(nil), (*v1beta1.MachineList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_MachineList_To_v1beta1_MachineList(a.(*MachineList), b.(*v1beta1.MachineList), scope) }); err != nil { @@ -340,11 +320,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.MachineSetStatus)(nil), (*MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus(a.(*v1beta1.MachineSetStatus), b.(*MachineSetStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*MachineSpec)(nil), (*v1beta1.MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_MachineSpec_To_v1beta1_MachineSpec(a.(*MachineSpec), b.(*v1beta1.MachineSpec), scope) }); err != nil { @@ -420,6 +395,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.ClusterSpec)(nil), (*ClusterSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec(a.(*v1beta1.ClusterSpec), b.(*ClusterSpec), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta1.ClusterStatus)(nil), (*ClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(a.(*v1beta1.ClusterStatus), b.(*ClusterStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.ControlPlaneClass)(nil), (*ControlPlaneClass)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_ControlPlaneClass_To_v1alpha4_ControlPlaneClass(a.(*v1beta1.ControlPlaneClass), b.(*ControlPlaneClass), scope) }); err != nil { @@ -440,6 +425,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.MachineDeploymentStatus)(nil), (*MachineDeploymentStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(a.(*v1beta1.MachineDeploymentStatus), b.(*MachineDeploymentStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.MachineDeploymentStrategy)(nil), (*MachineDeploymentStrategy)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachineDeploymentStrategy_To_v1alpha4_MachineDeploymentStrategy(a.(*v1beta1.MachineDeploymentStrategy), b.(*MachineDeploymentStrategy), scope) }); err != nil { @@ -450,11 +440,21 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.MachineHealthCheckStatus)(nil), (*MachineHealthCheckStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(a.(*v1beta1.MachineHealthCheckStatus), b.(*MachineHealthCheckStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.MachineSetSpec)(nil), (*MachineSetSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachineSetSpec_To_v1alpha4_MachineSetSpec(a.(*v1beta1.MachineSetSpec), b.(*MachineSetSpec), scope) }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.MachineSetStatus)(nil), (*MachineSetStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus(a.(*v1beta1.MachineSetStatus), b.(*MachineSetStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.MachineSpec)(nil), (*MachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_MachineSpec_To_v1alpha4_MachineSpec(a.(*v1beta1.MachineSpec), b.(*MachineSpec), scope) }); err != nil { @@ -766,14 +766,10 @@ func autoConvert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec(in *v1beta1.Cluster } else { out.Topology = nil } + // WARNING: in.AvailabilityGates requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec is an autogenerated conversion function. -func Convert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec(in *v1beta1.ClusterSpec, out *ClusterSpec, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterSpec_To_v1alpha4_ClusterSpec(in, out, s) -} - func autoConvert_v1alpha4_ClusterStatus_To_v1beta1_ClusterStatus(in *ClusterStatus, out *v1beta1.ClusterStatus, s conversion.Scope) error { out.FailureDomains = *(*v1beta1.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) out.FailureReason = (*errors.ClusterStatusError)(unsafe.Pointer(in.FailureReason)) @@ -800,14 +796,10 @@ func autoConvert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in *v1beta1.Clu out.ControlPlaneReady = in.ControlPlaneReady out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) out.ObservedGeneration = in.ObservedGeneration + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in *v1beta1.ClusterStatus, out *ClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_ClusterStatus_To_v1alpha4_ClusterStatus(in, out, s) -} - func autoConvert_v1alpha4_Condition_To_v1beta1_Condition(in *Condition, out *v1beta1.Condition, s conversion.Scope) error { out.Type = v1beta1.ConditionType(in.Type) out.Status = v1.ConditionStatus(in.Status) @@ -1211,14 +1203,10 @@ func autoConvert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentSt out.UnavailableReplicas = in.UnavailableReplicas out.Phase = in.Phase out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus is an autogenerated conversion function. -func Convert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(in *v1beta1.MachineDeploymentStatus, out *MachineDeploymentStatus, s conversion.Scope) error { - return autoConvert_v1beta1_MachineDeploymentStatus_To_v1alpha4_MachineDeploymentStatus(in, out, s) -} - func autoConvert_v1alpha4_MachineDeploymentStrategy_To_v1beta1_MachineDeploymentStrategy(in *MachineDeploymentStrategy, out *v1beta1.MachineDeploymentStrategy, s conversion.Scope) error { out.Type = v1beta1.MachineDeploymentStrategyType(in.Type) out.RollingUpdate = (*v1beta1.MachineRollingUpdateDeployment)(unsafe.Pointer(in.RollingUpdate)) @@ -1304,7 +1292,17 @@ func Convert_v1beta1_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(in *v1bet func autoConvert_v1alpha4_MachineHealthCheckList_To_v1beta1_MachineHealthCheckList(in *MachineHealthCheckList, out *v1beta1.MachineHealthCheckList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1beta1.MachineHealthCheck)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta1.MachineHealthCheck, len(*in)) + for i := range *in { + if err := Convert_v1alpha4_MachineHealthCheck_To_v1beta1_MachineHealthCheck(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -1315,7 +1313,17 @@ func Convert_v1alpha4_MachineHealthCheckList_To_v1beta1_MachineHealthCheckList(i func autoConvert_v1beta1_MachineHealthCheckList_To_v1alpha4_MachineHealthCheckList(in *v1beta1.MachineHealthCheckList, out *MachineHealthCheckList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]MachineHealthCheck)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MachineHealthCheck, len(*in)) + for i := range *in { + if err := Convert_v1beta1_MachineHealthCheck_To_v1alpha4_MachineHealthCheck(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -1378,14 +1386,10 @@ func autoConvert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheck out.ObservedGeneration = in.ObservedGeneration out.Targets = *(*[]string)(unsafe.Pointer(&in.Targets)) out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus is an autogenerated conversion function. -func Convert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(in *v1beta1.MachineHealthCheckStatus, out *MachineHealthCheckStatus, s conversion.Scope) error { - return autoConvert_v1beta1_MachineHealthCheckStatus_To_v1alpha4_MachineHealthCheckStatus(in, out, s) -} - func autoConvert_v1alpha4_MachineList_To_v1beta1_MachineList(in *MachineList, out *v1beta1.MachineList, s conversion.Scope) error { out.ListMeta = in.ListMeta if in.Items != nil { @@ -1583,14 +1587,10 @@ func autoConvert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus(in *v1bet out.FailureReason = (*errors.MachineSetStatusError)(unsafe.Pointer(in.FailureReason)) out.FailureMessage = (*string)(unsafe.Pointer(in.FailureMessage)) out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus is an autogenerated conversion function. -func Convert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus(in *v1beta1.MachineSetStatus, out *MachineSetStatus, s conversion.Scope) error { - return autoConvert_v1beta1_MachineSetStatus_To_v1alpha4_MachineSetStatus(in, out, s) -} - func autoConvert_v1alpha4_MachineSpec_To_v1beta1_MachineSpec(in *MachineSpec, out *v1beta1.MachineSpec, s conversion.Scope) error { out.ClusterName = in.ClusterName if err := Convert_v1alpha4_Bootstrap_To_v1beta1_Bootstrap(&in.Bootstrap, &out.Bootstrap, s); err != nil { @@ -1618,6 +1618,7 @@ func autoConvert_v1beta1_MachineSpec_To_v1alpha4_MachineSpec(in *v1beta1.Machine out.Version = (*string)(unsafe.Pointer(in.Version)) out.ProviderID = (*string)(unsafe.Pointer(in.ProviderID)) out.FailureDomain = (*string)(unsafe.Pointer(in.FailureDomain)) + // WARNING: in.ReadinessGates requires manual conversion: does not exist in peer-type out.NodeDrainTimeout = (*metav1.Duration)(unsafe.Pointer(in.NodeDrainTimeout)) // WARNING: in.NodeVolumeDetachTimeout requires manual conversion: does not exist in peer-type // WARNING: in.NodeDeletionTimeout requires manual conversion: does not exist in peer-type @@ -1654,6 +1655,7 @@ func autoConvert_v1beta1_MachineStatus_To_v1alpha4_MachineStatus(in *v1beta1.Mac out.ObservedGeneration = in.ObservedGeneration out.Conditions = *(*Conditions)(unsafe.Pointer(&in.Conditions)) // WARNING: in.Deletion requires manual conversion: does not exist in peer-type + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } diff --git a/internal/controllers/machinedeployment/machinedeployment_sync.go b/internal/controllers/machinedeployment/machinedeployment_sync.go index 8f4fb8cc50a0..df1288eaac4d 100644 --- a/internal/controllers/machinedeployment/machinedeployment_sync.go +++ b/internal/controllers/machinedeployment/machinedeployment_sync.go @@ -324,6 +324,7 @@ func (r *Reconciler) computeDesiredMachineSet(ctx context.Context, deployment *c } else { desiredMS.Spec.DeletePolicy = "" } + desiredMS.Spec.Template.Spec.ReadinessGates = deployment.Spec.Template.Spec.ReadinessGates desiredMS.Spec.Template.Spec.NodeDrainTimeout = deployment.Spec.Template.Spec.NodeDrainTimeout desiredMS.Spec.Template.Spec.NodeDeletionTimeout = deployment.Spec.Template.Spec.NodeDeletionTimeout desiredMS.Spec.Template.Spec.NodeVolumeDetachTimeout = deployment.Spec.Template.Spec.NodeVolumeDetachTimeout diff --git a/internal/controllers/machinedeployment/machinedeployment_sync_test.go b/internal/controllers/machinedeployment/machinedeployment_sync_test.go index 9169f1882e40..3904fb676894 100644 --- a/internal/controllers/machinedeployment/machinedeployment_sync_test.go +++ b/internal/controllers/machinedeployment/machinedeployment_sync_test.go @@ -582,6 +582,7 @@ func TestComputeDesiredMachineSet(t *testing.T) { Bootstrap: clusterv1.Bootstrap{ ConfigRef: &bootstrapRef, }, + ReadinessGates: []clusterv1.MachineReadinessGate{{ConditionType: "foo"}}, NodeDrainTimeout: duration10s, NodeVolumeDetachTimeout: duration10s, NodeDeletionTimeout: duration10s, @@ -649,6 +650,7 @@ func TestComputeDesiredMachineSet(t *testing.T) { "ms-label-2": "ms-value-2", } existingMS.Spec.Template.Annotations = nil + existingMS.Spec.Template.Spec.ReadinessGates = []clusterv1.MachineReadinessGate{{ConditionType: "bar"}} existingMS.Spec.Template.Spec.NodeDrainTimeout = duration5s existingMS.Spec.Template.Spec.NodeDeletionTimeout = duration5s existingMS.Spec.Template.Spec.NodeVolumeDetachTimeout = duration5s @@ -688,6 +690,7 @@ func TestComputeDesiredMachineSet(t *testing.T) { "ms-label-2": "ms-value-2", } existingMS.Spec.Template.Annotations = nil + existingMS.Spec.Template.Spec.ReadinessGates = []clusterv1.MachineReadinessGate{{ConditionType: "bar"}} existingMS.Spec.Template.Spec.NodeDrainTimeout = duration5s existingMS.Spec.Template.Spec.NodeDeletionTimeout = duration5s existingMS.Spec.Template.Spec.NodeVolumeDetachTimeout = duration5s @@ -741,6 +744,7 @@ func TestComputeDesiredMachineSet(t *testing.T) { "ms-label-2": "ms-value-2", } existingMS.Spec.Template.Annotations = nil + existingMS.Spec.Template.Spec.ReadinessGates = []clusterv1.MachineReadinessGate{{ConditionType: "bar"}} existingMS.Spec.Template.Spec.NodeDrainTimeout = duration5s existingMS.Spec.Template.Spec.NodeDeletionTimeout = duration5s existingMS.Spec.Template.Spec.NodeVolumeDetachTimeout = duration5s diff --git a/internal/controllers/machinedeployment/mdutil/util.go b/internal/controllers/machinedeployment/mdutil/util.go index eb6c1c6ce4a0..6080fd87cfb0 100644 --- a/internal/controllers/machinedeployment/mdutil/util.go +++ b/internal/controllers/machinedeployment/mdutil/util.go @@ -390,6 +390,7 @@ func MachineTemplateDeepCopyRolloutFields(template *clusterv1.MachineTemplateSpe templateCopy.Annotations = nil // Drop node timeout values + templateCopy.Spec.ReadinessGates = nil templateCopy.Spec.NodeDrainTimeout = nil templateCopy.Spec.NodeDeletionTimeout = nil templateCopy.Spec.NodeVolumeDetachTimeout = nil diff --git a/internal/controllers/machinedeployment/mdutil/util_test.go b/internal/controllers/machinedeployment/mdutil/util_test.go index 375302cf6314..e178c47e35af 100644 --- a/internal/controllers/machinedeployment/mdutil/util_test.go +++ b/internal/controllers/machinedeployment/mdutil/util_test.go @@ -216,6 +216,7 @@ func TestEqualMachineTemplate(t *testing.T) { machineTemplateWithDifferentAnnotations.Annotations = map[string]string{"a2": "v2"} machineTemplateWithDifferentInPlaceMutableSpecFields := machineTemplate.DeepCopy() + machineTemplateWithDifferentInPlaceMutableSpecFields.Spec.ReadinessGates = []clusterv1.MachineReadinessGate{{ConditionType: "foo"}} machineTemplateWithDifferentInPlaceMutableSpecFields.Spec.NodeDrainTimeout = &metav1.Duration{Duration: 20 * time.Second} machineTemplateWithDifferentInPlaceMutableSpecFields.Spec.NodeDeletionTimeout = &metav1.Duration{Duration: 20 * time.Second} machineTemplateWithDifferentInPlaceMutableSpecFields.Spec.NodeVolumeDetachTimeout = &metav1.Duration{Duration: 20 * time.Second} @@ -302,7 +303,7 @@ func TestEqualMachineTemplate(t *testing.T) { + ClusterName: "cluster2", Bootstrap: {ConfigRef: &{Kind: "BootstrapConfig", Namespace: "default", Name: "bootstrap1", APIVersion: "bootstrap.cluster.x-k8s.io", ...}}, InfrastructureRef: {Kind: "InfrastructureMachine", Namespace: "default", Name: "infra1", APIVersion: "infrastructure.cluster.x-k8s.io", ...}, - ... // 6 identical fields + ... // 7 identical fields }, }`, Diff2: `&v1beta1.MachineTemplateSpec{ @@ -312,7 +313,7 @@ func TestEqualMachineTemplate(t *testing.T) { + ClusterName: "cluster1", Bootstrap: {ConfigRef: &{Kind: "BootstrapConfig", Namespace: "default", Name: "bootstrap1", APIVersion: "bootstrap.cluster.x-k8s.io", ...}}, InfrastructureRef: {Kind: "InfrastructureMachine", Namespace: "default", Name: "infra1", APIVersion: "infrastructure.cluster.x-k8s.io", ...}, - ... // 6 identical fields + ... // 7 identical fields }, }`, }, @@ -331,7 +332,7 @@ func TestEqualMachineTemplate(t *testing.T) { + Version: &"v1.26.0", ProviderID: nil, FailureDomain: &"failure-domain1", - ... // 3 identical fields + ... // 4 identical fields }, }`, Diff2: `&v1beta1.MachineTemplateSpec{ @@ -344,7 +345,7 @@ func TestEqualMachineTemplate(t *testing.T) { + Version: &"v1.25.0", ProviderID: nil, FailureDomain: &"failure-domain1", - ... // 3 identical fields + ... // 4 identical fields }, }`, }, @@ -357,26 +358,26 @@ func TestEqualMachineTemplate(t *testing.T) { ObjectMeta: {}, Spec: v1beta1.MachineSpec{ ... // 3 identical fields - Version: &"v1.25.0", - ProviderID: nil, -- FailureDomain: &"failure-domain1", -+ FailureDomain: &"failure-domain2", - NodeDrainTimeout: nil, - NodeVolumeDetachTimeout: nil, - NodeDeletionTimeout: nil, + Version: &"v1.25.0", + ProviderID: nil, +- FailureDomain: &"failure-domain1", ++ FailureDomain: &"failure-domain2", + ReadinessGates: nil, + NodeDrainTimeout: nil, + ... // 2 identical fields }, }`, Diff2: `&v1beta1.MachineTemplateSpec{ ObjectMeta: {}, Spec: v1beta1.MachineSpec{ ... // 3 identical fields - Version: &"v1.25.0", - ProviderID: nil, -- FailureDomain: &"failure-domain2", -+ FailureDomain: &"failure-domain1", - NodeDrainTimeout: nil, - NodeVolumeDetachTimeout: nil, - NodeDeletionTimeout: nil, + Version: &"v1.25.0", + ProviderID: nil, +- FailureDomain: &"failure-domain2", ++ FailureDomain: &"failure-domain1", + ReadinessGates: nil, + NodeDrainTimeout: nil, + ... // 2 identical fields }, }`, }, @@ -401,7 +402,7 @@ func TestEqualMachineTemplate(t *testing.T) { }, Version: &"v1.25.0", ProviderID: nil, - ... // 4 identical fields + ... // 5 identical fields }, }`, Diff2: `&v1beta1.MachineTemplateSpec{ @@ -420,7 +421,7 @@ func TestEqualMachineTemplate(t *testing.T) { }, Version: &"v1.25.0", ProviderID: nil, - ... // 4 identical fields + ... // 5 identical fields }, }`, }, @@ -441,7 +442,7 @@ func TestEqualMachineTemplate(t *testing.T) { }, InfrastructureRef: {Kind: "InfrastructureMachine", Namespace: "default", Name: "infra1", APIVersion: "infrastructure.cluster.x-k8s.io", ...}, Version: &"v1.25.0", - ... // 5 identical fields + ... // 6 identical fields }, }`, Diff2: `&v1beta1.MachineTemplateSpec{ @@ -456,7 +457,7 @@ func TestEqualMachineTemplate(t *testing.T) { }, InfrastructureRef: {Kind: "InfrastructureMachine", Namespace: "default", Name: "infra1", APIVersion: "infrastructure.cluster.x-k8s.io", ...}, Version: &"v1.25.0", - ... // 5 identical fields + ... // 6 identical fields }, }`, }, @@ -483,7 +484,7 @@ func TestEqualMachineTemplate(t *testing.T) { }, InfrastructureRef: {Kind: "InfrastructureMachine", Namespace: "default", Name: "infra1", APIVersion: "infrastructure.cluster.x-k8s.io", ...}, Version: &"v1.25.0", - ... // 5 identical fields + ... // 6 identical fields }, }`, Diff2: `&v1beta1.MachineTemplateSpec{ @@ -504,7 +505,7 @@ func TestEqualMachineTemplate(t *testing.T) { }, InfrastructureRef: {Kind: "InfrastructureMachine", Namespace: "default", Name: "infra1", APIVersion: "infrastructure.cluster.x-k8s.io", ...}, Version: &"v1.25.0", - ... // 5 identical fields + ... // 6 identical fields }, }`, }, @@ -627,7 +628,7 @@ func TestFindNewMachineSet(t *testing.T) { }, Version: nil, ProviderID: nil, - ... // 4 identical fields + ... // 5 identical fields }, }`, oldMS.Name), }, diff --git a/internal/controllers/machineset/machineset_controller.go b/internal/controllers/machineset/machineset_controller.go index 45ec61b303ed..a3407e3cadc0 100644 --- a/internal/controllers/machineset/machineset_controller.go +++ b/internal/controllers/machineset/machineset_controller.go @@ -424,6 +424,7 @@ func (r *Reconciler) syncMachines(ctx context.Context, machineSet *clusterv1.Mac } // Set all other in-place mutable fields that impact the ability to tear down existing machines. + m.Spec.ReadinessGates = machineSet.Spec.Template.Spec.ReadinessGates m.Spec.NodeDrainTimeout = machineSet.Spec.Template.Spec.NodeDrainTimeout m.Spec.NodeDeletionTimeout = machineSet.Spec.Template.Spec.NodeDeletionTimeout m.Spec.NodeVolumeDetachTimeout = machineSet.Spec.Template.Spec.NodeVolumeDetachTimeout @@ -725,6 +726,7 @@ func (r *Reconciler) computeDesiredMachine(machineSet *clusterv1.MachineSet, exi desiredMachine.Annotations = machineAnnotationsFromMachineSet(machineSet) // Set all other in-place mutable fields. + desiredMachine.Spec.ReadinessGates = machineSet.Spec.Template.Spec.ReadinessGates desiredMachine.Spec.NodeDrainTimeout = machineSet.Spec.Template.Spec.NodeDrainTimeout desiredMachine.Spec.NodeDeletionTimeout = machineSet.Spec.Template.Spec.NodeDeletionTimeout desiredMachine.Spec.NodeVolumeDetachTimeout = machineSet.Spec.Template.Spec.NodeVolumeDetachTimeout diff --git a/internal/controllers/machineset/machineset_controller_test.go b/internal/controllers/machineset/machineset_controller_test.go index c9791cf31da1..449d09a0e954 100644 --- a/internal/controllers/machineset/machineset_controller_test.go +++ b/internal/controllers/machineset/machineset_controller_test.go @@ -1341,6 +1341,8 @@ func TestMachineSetReconciler_syncMachines(t *testing.T) { "modified-annotation": "modified-value-2", // Modify the value of the annotation // Drop "dropped-annotation" } + readinessGates := []clusterv1.MachineReadinessGate{{ConditionType: "foo"}} + ms.Spec.Template.Spec.ReadinessGates = readinessGates ms.Spec.Template.Spec.NodeDrainTimeout = duration10s ms.Spec.Template.Spec.NodeDeletionTimeout = duration10s ms.Spec.Template.Spec.NodeVolumeDetachTimeout = duration10s @@ -1367,6 +1369,8 @@ func TestMachineSetReconciler_syncMachines(t *testing.T) { Not(BeNil()), HaveValue(Equal(*ms.Spec.Template.Spec.NodeVolumeDetachTimeout)), )) + // Verify readiness gates. + g.Expect(updatedInPlaceMutatingMachine.Spec.ReadinessGates).Should(Equal(readinessGates)) }, timeout).Should(Succeed()) // Verify in-place mutable fields are updated on InfrastructureMachine diff --git a/test/infrastructure/docker/api/v1alpha3/conversion.go b/test/infrastructure/docker/api/v1alpha3/conversion.go index 2ada393d3874..5954daf40284 100644 --- a/test/infrastructure/docker/api/v1alpha3/conversion.go +++ b/test/infrastructure/docker/api/v1alpha3/conversion.go @@ -48,6 +48,7 @@ func (src *DockerCluster) ConvertTo(dstRaw conversion.Hub) error { if restored.Spec.LoadBalancer.CustomHAProxyConfigTemplateRef != nil { dst.Spec.LoadBalancer.CustomHAProxyConfigTemplateRef = restored.Spec.LoadBalancer.CustomHAProxyConfigTemplateRef } + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -95,6 +96,7 @@ func (src *DockerMachine) ConvertTo(dstRaw conversion.Hub) error { if restored.Spec.BootstrapTimeout != nil { dst.Spec.BootstrapTimeout = restored.Spec.BootstrapTimeout } + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -187,3 +189,11 @@ func Convert_v1beta1_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(in *infrav1 // NOTE: custom conversion func is required because spec.bootstrapTimeout has been added in v1beta1. return autoConvert_v1beta1_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(in, out, s) } + +func Convert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in *infrav1.DockerClusterStatus, out *DockerClusterStatus, s apiconversion.Scope) error { + return autoConvert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in, out, s) +} + +func Convert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in *infrav1.DockerMachineStatus, out *DockerMachineStatus, s apiconversion.Scope) error { + return autoConvert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in, out, s) +} diff --git a/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go b/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go index a8e6f4ce294c..94fd211338d4 100644 --- a/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go +++ b/test/infrastructure/docker/api/v1alpha3/zz_generated.conversion.go @@ -78,11 +78,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.DockerClusterStatus)(nil), (*DockerClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(a.(*v1beta1.DockerClusterStatus), b.(*DockerClusterStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*DockerMachine)(nil), (*v1beta1.DockerMachine)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_DockerMachine_To_v1beta1_DockerMachine(a.(*DockerMachine), b.(*v1beta1.DockerMachine), scope) }); err != nil { @@ -113,11 +108,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.DockerMachineStatus)(nil), (*DockerMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(a.(*v1beta1.DockerMachineStatus), b.(*DockerMachineStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*DockerMachineTemplate)(nil), (*v1beta1.DockerMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha3_DockerMachineTemplate_To_v1beta1_DockerMachineTemplate(a.(*DockerMachineTemplate), b.(*v1beta1.DockerMachineTemplate), scope) }); err != nil { @@ -168,11 +158,21 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.DockerClusterStatus)(nil), (*DockerClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(a.(*v1beta1.DockerClusterStatus), b.(*DockerClusterStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.DockerMachineSpec)(nil), (*DockerMachineSpec)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_DockerMachineSpec_To_v1alpha3_DockerMachineSpec(a.(*v1beta1.DockerMachineSpec), b.(*DockerMachineSpec), scope) }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.DockerMachineStatus)(nil), (*DockerMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(a.(*v1beta1.DockerMachineStatus), b.(*DockerMachineStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.DockerMachineTemplateResource)(nil), (*DockerMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_DockerMachineTemplateResource_To_v1alpha3_DockerMachineTemplateResource(a.(*v1beta1.DockerMachineTemplateResource), b.(*DockerMachineTemplateResource), scope) }); err != nil { @@ -315,14 +315,10 @@ func autoConvert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in out.Ready = in.Ready out.FailureDomains = *(*corev1alpha3.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) out.Conditions = *(*corev1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in *v1beta1.DockerClusterStatus, out *DockerClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_DockerClusterStatus_To_v1alpha3_DockerClusterStatus(in, out, s) -} - func autoConvert_v1alpha3_DockerMachine_To_v1beta1_DockerMachine(in *DockerMachine, out *v1beta1.DockerMachine, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha3_DockerMachineSpec_To_v1beta1_DockerMachineSpec(&in.Spec, &out.Spec, s); err != nil { @@ -439,14 +435,10 @@ func autoConvert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in out.LoadBalancerConfigured = in.LoadBalancerConfigured out.Addresses = *(*[]corev1alpha3.MachineAddress)(unsafe.Pointer(&in.Addresses)) out.Conditions = *(*corev1alpha3.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus is an autogenerated conversion function. -func Convert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in *v1beta1.DockerMachineStatus, out *DockerMachineStatus, s conversion.Scope) error { - return autoConvert_v1beta1_DockerMachineStatus_To_v1alpha3_DockerMachineStatus(in, out, s) -} - func autoConvert_v1alpha3_DockerMachineTemplate_To_v1beta1_DockerMachineTemplate(in *DockerMachineTemplate, out *v1beta1.DockerMachineTemplate, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha3_DockerMachineTemplateSpec_To_v1beta1_DockerMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/test/infrastructure/docker/api/v1alpha4/conversion.go b/test/infrastructure/docker/api/v1alpha4/conversion.go index 6c7dc8507cd9..66f0b8edab98 100644 --- a/test/infrastructure/docker/api/v1alpha4/conversion.go +++ b/test/infrastructure/docker/api/v1alpha4/conversion.go @@ -40,6 +40,7 @@ func (src *DockerCluster) ConvertTo(dstRaw conversion.Hub) error { if restored.Spec.LoadBalancer.CustomHAProxyConfigTemplateRef != nil { dst.Spec.LoadBalancer.CustomHAProxyConfigTemplateRef = restored.Spec.LoadBalancer.CustomHAProxyConfigTemplateRef } + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -135,6 +136,7 @@ func (src *DockerMachine) ConvertTo(dstRaw conversion.Hub) error { if restored.Spec.BootstrapTimeout != nil { dst.Spec.BootstrapTimeout = restored.Spec.BootstrapTimeout } + dst.Status.V1Beta2 = restored.Status.V1Beta2 return nil } @@ -228,3 +230,11 @@ func Convert_v1beta1_DockerLoadBalancer_To_v1alpha4_DockerLoadBalancer(in *infra func Convert_v1beta1_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in *infrav1.DockerMachineSpec, out *DockerMachineSpec, s apiconversion.Scope) error { return autoConvert_v1beta1_DockerMachineSpec_To_v1alpha4_DockerMachineSpec(in, out, s) } + +func Convert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in *infrav1.DockerClusterStatus, out *DockerClusterStatus, s apiconversion.Scope) error { + return autoConvert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in, out, s) +} + +func Convert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in *infrav1.DockerMachineStatus, out *DockerMachineStatus, s apiconversion.Scope) error { + return autoConvert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in, out, s) +} diff --git a/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go b/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go index 2da19c0eb318..53c41052e8fd 100644 --- a/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go +++ b/test/infrastructure/docker/api/v1alpha4/zz_generated.conversion.go @@ -83,11 +83,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.DockerClusterStatus)(nil), (*DockerClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(a.(*v1beta1.DockerClusterStatus), b.(*DockerClusterStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*DockerClusterTemplate)(nil), (*v1beta1.DockerClusterTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_DockerClusterTemplate_To_v1beta1_DockerClusterTemplate(a.(*DockerClusterTemplate), b.(*v1beta1.DockerClusterTemplate), scope) }); err != nil { @@ -158,11 +153,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.DockerMachineStatus)(nil), (*DockerMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(a.(*v1beta1.DockerMachineStatus), b.(*DockerMachineStatus), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*DockerMachineTemplate)(nil), (*v1beta1.DockerMachineTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha4_DockerMachineTemplate_To_v1beta1_DockerMachineTemplate(a.(*DockerMachineTemplate), b.(*v1beta1.DockerMachineTemplate), scope) }); err != nil { @@ -218,6 +208,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.DockerClusterStatus)(nil), (*DockerClusterStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(a.(*v1beta1.DockerClusterStatus), b.(*DockerClusterStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.DockerClusterTemplateResource)(nil), (*DockerClusterTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_DockerClusterTemplateResource_To_v1alpha4_DockerClusterTemplateResource(a.(*v1beta1.DockerClusterTemplateResource), b.(*DockerClusterTemplateResource), scope) }); err != nil { @@ -233,6 +228,11 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*v1beta1.DockerMachineStatus)(nil), (*DockerMachineStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(a.(*v1beta1.DockerMachineStatus), b.(*DockerMachineStatus), scope) + }); err != nil { + return err + } if err := s.AddConversionFunc((*v1beta1.DockerMachineTemplateResource)(nil), (*DockerMachineTemplateResource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_DockerMachineTemplateResource_To_v1alpha4_DockerMachineTemplateResource(a.(*v1beta1.DockerMachineTemplateResource), b.(*DockerMachineTemplateResource), scope) }); err != nil { @@ -385,14 +385,10 @@ func autoConvert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in out.Ready = in.Ready out.FailureDomains = *(*corev1alpha4.FailureDomains)(unsafe.Pointer(&in.FailureDomains)) out.Conditions = *(*corev1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus is an autogenerated conversion function. -func Convert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in *v1beta1.DockerClusterStatus, out *DockerClusterStatus, s conversion.Scope) error { - return autoConvert_v1beta1_DockerClusterStatus_To_v1alpha4_DockerClusterStatus(in, out, s) -} - func autoConvert_v1alpha4_DockerClusterTemplate_To_v1beta1_DockerClusterTemplate(in *DockerClusterTemplate, out *v1beta1.DockerClusterTemplate, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha4_DockerClusterTemplateSpec_To_v1beta1_DockerClusterTemplateSpec(&in.Spec, &out.Spec, s); err != nil { @@ -641,14 +637,10 @@ func autoConvert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in out.LoadBalancerConfigured = in.LoadBalancerConfigured out.Addresses = *(*[]corev1alpha4.MachineAddress)(unsafe.Pointer(&in.Addresses)) out.Conditions = *(*corev1alpha4.Conditions)(unsafe.Pointer(&in.Conditions)) + // WARNING: in.V1Beta2 requires manual conversion: does not exist in peer-type return nil } -// Convert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus is an autogenerated conversion function. -func Convert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in *v1beta1.DockerMachineStatus, out *DockerMachineStatus, s conversion.Scope) error { - return autoConvert_v1beta1_DockerMachineStatus_To_v1alpha4_DockerMachineStatus(in, out, s) -} - func autoConvert_v1alpha4_DockerMachineTemplate_To_v1beta1_DockerMachineTemplate(in *DockerMachineTemplate, out *v1beta1.DockerMachineTemplate, s conversion.Scope) error { out.ObjectMeta = in.ObjectMeta if err := Convert_v1alpha4_DockerMachineTemplateSpec_To_v1beta1_DockerMachineTemplateSpec(&in.Spec, &out.Spec, s); err != nil { diff --git a/test/infrastructure/docker/api/v1beta1/dockercluster_types.go b/test/infrastructure/docker/api/v1beta1/dockercluster_types.go index dd14f9184ce5..34dd32868c32 100644 --- a/test/infrastructure/docker/api/v1beta1/dockercluster_types.go +++ b/test/infrastructure/docker/api/v1beta1/dockercluster_types.go @@ -95,6 +95,22 @@ type DockerClusterStatus struct { // Conditions defines current service state of the DockerCluster. // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in DockerCluster's's status with the V1Beta2 version. + // +optional + V1Beta2 *DockerClusterV1Beta2Status `json:"v1beta2,omitempty"` +} + +// DockerClusterV1Beta2Status groups all the fields that will be added or modified in DockerCluster with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type DockerClusterV1Beta2Status struct { + // conditions represents the observations of a DockerCluster's current state. + // Known condition types are Ready, LoadBalancerAvailable, Deleting, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // APIEndpoint represents a reachable Kubernetes API endpoint. @@ -133,6 +149,22 @@ func (c *DockerCluster) SetConditions(conditions clusterv1.Conditions) { c.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (c *DockerCluster) GetV1Beta2Conditions() []metav1.Condition { + if c.Status.V1Beta2 == nil { + return nil + } + return c.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (c *DockerCluster) SetV1Beta2Conditions(conditions []metav1.Condition) { + if c.Status.V1Beta2 == nil && conditions != nil { + c.Status.V1Beta2 = &DockerClusterV1Beta2Status{} + } + c.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // DockerClusterList contains a list of DockerCluster. diff --git a/test/infrastructure/docker/api/v1beta1/dockermachine_types.go b/test/infrastructure/docker/api/v1beta1/dockermachine_types.go index 59b56e3bdfca..552cc089b80b 100644 --- a/test/infrastructure/docker/api/v1beta1/dockermachine_types.go +++ b/test/infrastructure/docker/api/v1beta1/dockermachine_types.go @@ -97,6 +97,22 @@ type DockerMachineStatus struct { // Conditions defines current service state of the DockerMachine. // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in DockerMachine's status with the V1Beta2 version. + // +optional + V1Beta2 *DockerMachineV1Beta2Status `json:"v1beta2,omitempty"` +} + +// DockerMachineV1Beta2Status groups all the fields that will be added or modified in DockerMachine with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type DockerMachineV1Beta2Status struct { + // conditions represents the observations of a DockerMachine's current state. + // Known condition types are Ready, ContainerProvisioned, BootstrapExecSucceeded, Deleting, Paused. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // +kubebuilder:resource:path=dockermachines,scope=Namespaced,categories=cluster-api @@ -128,6 +144,22 @@ func (c *DockerMachine) SetConditions(conditions clusterv1.Conditions) { c.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (c *DockerMachine) GetV1Beta2Conditions() []metav1.Condition { + if c.Status.V1Beta2 == nil { + return nil + } + return c.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (c *DockerMachine) SetV1Beta2Conditions(conditions []metav1.Condition) { + if c.Status.V1Beta2 == nil && conditions != nil { + c.Status.V1Beta2 = &DockerMachineV1Beta2Status{} + } + c.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // DockerMachineList contains a list of DockerMachine. diff --git a/test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go b/test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go new file mode 100644 index 000000000000..974e8cb6a787 --- /dev/null +++ b/test/infrastructure/docker/api/v1beta1/v1beta2_condition_consts.go @@ -0,0 +1,64 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + +// Conditions that will be used for the DockerCluster object in v1Beta2 API version. +const ( + // DockerClusterReadyV1Beta2Condition is true if the DockerCluster is not deleted, + // and LoadBalancerAvailable condition is true. + DockerClusterReadyV1Beta2Condition = clusterv1.ReadyV1Beta2Condition + + // DockerClusterLoadBalancerAvailableV1Beta2Condition documents the availability of the container that implements the cluster load balancer. + DockerClusterLoadBalancerAvailableV1Beta2Condition clusterv1.ConditionType = "LoadBalancerAvailable" + + // DockerClusterDeletingV1Beta2Condition surfaces details about ongoing deletion of the DockerCluster. + DockerClusterDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition + + // DockerClusterPausedV1Beta2Condition is true if this DockerCluster or the Cluster it belongs to are paused. + DockerClusterPausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition +) + +// Conditions that will be used for the DockerMachine object in v1Beta2 API version. +const ( + // DockerMachineReadyV1Beta2Condition is true if the DockerMachine is not deleted, + // and both BootstrapExecSucceeded and ContainerProvisioned conditions are true. + DockerMachineReadyV1Beta2Condition = clusterv1.ReadyV1Beta2Condition + + // DockerMachineContainerProvisionedV1Beta2Condition documents the status of the provisioning of the container + // generated by a DockerMachine. + // + // NOTE as a difference from other providers, container provisioning and bootstrap are directly managed + // by the DockerMachine controller (not by cloud-init). + DockerMachineContainerProvisionedV1Beta2Condition clusterv1.ConditionType = "ContainerProvisioned" + + // DockerMachineBootstrapExecSucceededV1Beta2Condition provides an observation of the DockerMachine bootstrap process. + // It is set based on successful execution of bootstrap commands and on the existence of + // the /run/cluster-api/bootstrap-success.complete file. + // The condition gets generated after ContainerProvisionedCondition is True. + // + // NOTE as a difference from other providers, container provisioning and bootstrap are directly managed + // by the DockerMachine controller (not by cloud-init). + DockerMachineBootstrapExecSucceededV1Beta2Condition clusterv1.ConditionType = "BootstrapExecSucceeded" + + // DockerMachineDeletingV1Beta2Condition surfaces details about ongoing deletion of the DockerMachine. + DockerMachineDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition + + // DockerMachinePausedV1Beta2Condition is true if this DockerMachine or the Cluster it belongs to are paused. + DockerMachinePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition +) diff --git a/test/infrastructure/docker/api/v1beta1/zz_generated.deepcopy.go b/test/infrastructure/docker/api/v1beta1/zz_generated.deepcopy.go index 0b6a6efa9f41..ffe139d26cda 100644 --- a/test/infrastructure/docker/api/v1beta1/zz_generated.deepcopy.go +++ b/test/infrastructure/docker/api/v1beta1/zz_generated.deepcopy.go @@ -142,6 +142,11 @@ func (in *DockerClusterStatus) DeepCopyInto(out *DockerClusterStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(DockerClusterV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerClusterStatus. @@ -245,6 +250,28 @@ func (in *DockerClusterTemplateSpec) DeepCopy() *DockerClusterTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerClusterV1Beta2Status) DeepCopyInto(out *DockerClusterV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerClusterV1Beta2Status. +func (in *DockerClusterV1Beta2Status) DeepCopy() *DockerClusterV1Beta2Status { + if in == nil { + return nil + } + out := new(DockerClusterV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DockerLoadBalancer) DeepCopyInto(out *DockerLoadBalancer) { *out = *in @@ -375,6 +402,11 @@ func (in *DockerMachineStatus) DeepCopyInto(out *DockerMachineStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(DockerMachineV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineStatus. @@ -478,6 +510,28 @@ func (in *DockerMachineTemplateSpec) DeepCopy() *DockerMachineTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DockerMachineV1Beta2Status) DeepCopyInto(out *DockerMachineV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]metav1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DockerMachineV1Beta2Status. +func (in *DockerMachineV1Beta2Status) DeepCopy() *DockerMachineV1Beta2Status { + if in == nil { + return nil + } + out := new(DockerMachineV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ImageMeta) DeepCopyInto(out *ImageMeta) { *out = *in diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml index 944eaeff6ef6..dae31c85af27 100644 --- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml +++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockerclusters.yaml @@ -514,6 +514,75 @@ spec: description: Ready denotes that the docker cluster (infrastructure) is ready. type: boolean + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in DockerCluster's's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a DockerCluster's current state. + Known condition types are Ready, LoadBalancerAvailable, Deleting, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true diff --git a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml index 8c7378d0f573..376b25a5784f 100644 --- a/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml +++ b/test/infrastructure/docker/config/crd/bases/infrastructure.cluster.x-k8s.io_dockermachines.yaml @@ -506,6 +506,75 @@ spec: description: Ready denotes that the machine (docker container) is ready type: boolean + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in DockerMachine's status with the V1Beta2 version. + properties: + conditions: + description: |- + conditions represents the observations of a DockerMachine's current state. + Known condition types are Ready, ContainerProvisioned, BootstrapExecSucceeded, Deleting, Paused. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true diff --git a/test/infrastructure/inmemory/api/v1alpha1/inmemorycluster_types.go b/test/infrastructure/inmemory/api/v1alpha1/inmemorycluster_types.go index 90d8a0ab091b..4d5a5b8d173f 100644 --- a/test/infrastructure/inmemory/api/v1alpha1/inmemorycluster_types.go +++ b/test/infrastructure/inmemory/api/v1alpha1/inmemorycluster_types.go @@ -48,6 +48,21 @@ type InMemoryClusterStatus struct { // Conditions defines current service state of the InMemoryCluster. // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in InMemoryCluster's status with the V1Beta2 version. + // +optional + V1Beta2 *InMemoryClusterV1Beta2Status `json:"v1beta2,omitempty"` +} + +// InMemoryClusterV1Beta2Status groups all the fields that will be added or modified in InMemoryCluster with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type InMemoryClusterV1Beta2Status struct { + // conditions represents the observations of a InMemoryCluster's current state. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // APIEndpoint represents a reachable Kubernetes API endpoint. @@ -86,6 +101,22 @@ func (c *InMemoryCluster) SetConditions(conditions clusterv1.Conditions) { c.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (c *InMemoryCluster) GetV1Beta2Conditions() []metav1.Condition { + if c.Status.V1Beta2 == nil { + return nil + } + return c.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (c *InMemoryCluster) SetV1Beta2Conditions(conditions []metav1.Condition) { + if c.Status.V1Beta2 == nil && conditions != nil { + c.Status.V1Beta2 = &InMemoryClusterV1Beta2Status{} + } + c.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // InMemoryClusterList contains a list of InMemoryCluster. diff --git a/test/infrastructure/inmemory/api/v1alpha1/inmemorymachine_types.go b/test/infrastructure/inmemory/api/v1alpha1/inmemorymachine_types.go index ad60f404cd74..0e2ec89244c3 100644 --- a/test/infrastructure/inmemory/api/v1alpha1/inmemorymachine_types.go +++ b/test/infrastructure/inmemory/api/v1alpha1/inmemorymachine_types.go @@ -146,6 +146,21 @@ type InMemoryMachineStatus struct { // Conditions defines current service state of the InMemoryMachine. // +optional Conditions clusterv1.Conditions `json:"conditions,omitempty"` + + // v1beta2 groups all the fields that will be added or modified in InMemoryMachine's status with the V1Beta2 version. + // +optional + V1Beta2 *InMemoryMachineV1Beta2Status `json:"v1beta2,omitempty"` +} + +// InMemoryMachineV1Beta2Status groups all the fields that will be added or modified in InMemoryMachine with the V1Beta2 version. +// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context. +type InMemoryMachineV1Beta2Status struct { + // conditions represents the observations of a InMemoryMachine's current state. + // +optional + // +listType=map + // +listMapKey=type + // +kubebuilder:validation:MaxItems=32 + Conditions []metav1.Condition `json:"conditions,omitempty"` } // +kubebuilder:resource:path=inmemorymachines,scope=Namespaced,categories=cluster-api @@ -177,6 +192,22 @@ func (c *InMemoryMachine) SetConditions(conditions clusterv1.Conditions) { c.Status.Conditions = conditions } +// GetV1Beta2Conditions returns the set of conditions for this object. +func (c *InMemoryMachine) GetV1Beta2Conditions() []metav1.Condition { + if c.Status.V1Beta2 == nil { + return nil + } + return c.Status.V1Beta2.Conditions +} + +// SetV1Beta2Conditions sets conditions for an API object. +func (c *InMemoryMachine) SetV1Beta2Conditions(conditions []metav1.Condition) { + if c.Status.V1Beta2 == nil && conditions != nil { + c.Status.V1Beta2 = &InMemoryMachineV1Beta2Status{} + } + c.Status.V1Beta2.Conditions = conditions +} + // +kubebuilder:object:root=true // InMemoryMachineList contains a list of InMemoryMachine. diff --git a/test/infrastructure/inmemory/api/v1alpha1/zz_generated.deepcopy.go b/test/infrastructure/inmemory/api/v1alpha1/zz_generated.deepcopy.go index 02c5a02ad0a1..27aae13443d0 100644 --- a/test/infrastructure/inmemory/api/v1alpha1/zz_generated.deepcopy.go +++ b/test/infrastructure/inmemory/api/v1alpha1/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1alpha1 import ( + "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "sigs.k8s.io/cluster-api/api/v1beta1" ) @@ -157,6 +158,11 @@ func (in *InMemoryClusterStatus) DeepCopyInto(out *InMemoryClusterStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(InMemoryClusterV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryClusterStatus. @@ -260,6 +266,28 @@ func (in *InMemoryClusterTemplateSpec) DeepCopy() *InMemoryClusterTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InMemoryClusterV1Beta2Status) DeepCopyInto(out *InMemoryClusterV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryClusterV1Beta2Status. +func (in *InMemoryClusterV1Beta2Status) DeepCopy() *InMemoryClusterV1Beta2Status { + if in == nil { + return nil + } + out := new(InMemoryClusterV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InMemoryEtcdBehaviour) DeepCopyInto(out *InMemoryEtcdBehaviour) { *out = *in @@ -405,6 +433,11 @@ func (in *InMemoryMachineStatus) DeepCopyInto(out *InMemoryMachineStatus) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + if in.V1Beta2 != nil { + in, out := &in.V1Beta2, &out.V1Beta2 + *out = new(InMemoryMachineV1Beta2Status) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryMachineStatus. @@ -508,6 +541,28 @@ func (in *InMemoryMachineTemplateSpec) DeepCopy() *InMemoryMachineTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *InMemoryMachineV1Beta2Status) DeepCopyInto(out *InMemoryMachineV1Beta2Status) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InMemoryMachineV1Beta2Status. +func (in *InMemoryMachineV1Beta2Status) DeepCopy() *InMemoryMachineV1Beta2Status { + if in == nil { + return nil + } + out := new(InMemoryMachineV1Beta2Status) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *InMemoryNodeBehaviour) DeepCopyInto(out *InMemoryNodeBehaviour) { *out = *in diff --git a/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemoryclusters.yaml b/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemoryclusters.yaml index c2f5b343d221..b8fae7fdf223 100644 --- a/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemoryclusters.yaml +++ b/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemoryclusters.yaml @@ -119,6 +119,74 @@ spec: description: Ready denotes that the in-memory cluster (infrastructure) is ready. type: boolean + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in InMemoryCluster's status with the V1Beta2 version. + properties: + conditions: + description: conditions represents the observations of a InMemoryCluster's + current state. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true diff --git a/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemorymachines.yaml b/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemorymachines.yaml index 10ac09a960fe..cd96333e3be6 100644 --- a/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemorymachines.yaml +++ b/test/infrastructure/inmemory/config/crd/bases/infrastructure.cluster.x-k8s.io_inmemorymachines.yaml @@ -216,6 +216,74 @@ spec: ready: description: Ready denotes that the machine is ready type: boolean + v1beta2: + description: v1beta2 groups all the fields that will be added or modified + in InMemoryMachine's status with the V1Beta2 version. + properties: + conditions: + description: conditions represents the observations of a InMemoryMachine's + current state. + items: + description: Condition contains details for one aspect of the + current state of this API Resource. + properties: + lastTransitionTime: + description: |- + lastTransitionTime is the 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: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer + reason: + description: |- + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, + Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + maxItems: 32 + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + type: object type: object type: object served: true