Skip to content

Commit

Permalink
Add v1beta2 OwnerRemediated condition to KCP
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Oct 16, 2024
1 parent ff13a64 commit 57d81ed
Show file tree
Hide file tree
Showing 3 changed files with 260 additions and 29 deletions.
62 changes: 61 additions & 1 deletion controlplane/kubeadm/api/v1beta1/v1beta2_condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,100 @@ package v1beta1

import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

// Conditions that will be used for the KubeadmControlPlane object in v1Beta2 API version.
// KubeadmControlPlane's Available condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlaneAvailableV1Beta2Condition True if the control plane can be reached, EtcdClusterAvailable is true,
// and CertificatesAvailable is true.
KubeadmControlPlaneAvailableV1Beta2Condition = clusterv1.AvailableV1Beta2Condition
)

// KubeadmControlPlane's CertificatesAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlaneCertificatesAvailableV1Beta2Condition True if all the cluster certificates exist.
KubeadmControlPlaneCertificatesAvailableV1Beta2Condition = "CertificatesAvailable"

// KubeadmControlPlaneCertificatesInternalErrorV1Beta2Reason surfaces unexpected failures when reconciling cluster certificates.
KubeadmControlPlaneCertificatesInternalErrorV1Beta2Reason = clusterv1.InternalErrorV1Beta2Reason

// KubeadmControlPlaneCertificatesAvailableV1Beta2Reason surfaces when cluster certificates are available,
// no matter if those certificates have been provided by the user or generated by KubeadmControlPlane itself.
// Cluster certificates includes: certificates authorities for ca, sa, front-proxy, etcd, and if external etcd is used,
// also the apiserver-etcd-client client certificate.
KubeadmControlPlaneCertificatesAvailableV1Beta2Reason = clusterv1.AvailableV1Beta2Condition
)

// KubeadmControlPlane's EtcdClusterAvailable condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// 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"
)

// KubeadmControlPlane's MachinesReady condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// 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
)

// KubeadmControlPlane's MachinesUpToDate condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlaneMachinesUpToDateV1Beta2Condition surfaces details of controlled machines not up to date, if any.
KubeadmControlPlaneMachinesUpToDateV1Beta2Condition = clusterv1.MachinesUpToDateV1Beta2Condition
)

// KubeadmControlPlane's ScalingUp condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlaneScalingUpV1Beta2Condition is true if available replicas < desired replicas.
KubeadmControlPlaneScalingUpV1Beta2Condition = clusterv1.ScalingUpV1Beta2Condition
)

// KubeadmControlPlane's ScalingDown condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlaneScalingDownV1Beta2Condition is true if replicas > desired replicas.
KubeadmControlPlaneScalingDownV1Beta2Condition = clusterv1.ScalingDownV1Beta2Condition
)

// KubeadmControlPlane's Remediating condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlaneRemediatingV1Beta2Condition surfaces details about ongoing remediation of the controlled machines, if any.
KubeadmControlPlaneRemediatingV1Beta2Condition = clusterv1.RemediatingV1Beta2Condition
)

// Reasons that will be used for the OwnerRemediated condition set by MachineHealthCheck on KubeadmControlPlane controlled machines
// being remediated in v1Beta2 API version.
const (
// KubeadmControlPlaneMachineRemediationInternalErrorV1Beta2Reason surfaces unexpected failures while remediation a control plane machine.
KubeadmControlPlaneMachineRemediationInternalErrorV1Beta2Reason = clusterv1.InternalErrorV1Beta2Reason

// KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason surfaces when remediation of a control plane machine can't be completed.
KubeadmControlPlaneMachineCannotBeRemediatedV1Beta2Reason = "CannotRemediate"

// KubeadmControlPlaneMachineRemediationDeferredV1Beta2Reason surfaces when remediation of a control plane machine must be deferred.
KubeadmControlPlaneMachineRemediationDeferredV1Beta2Reason = "RemediationDeferred"

// KubeadmControlPlaneMachineRemediationDoneV1Beta2Reason surfaces when remediation of a control plane machine has been completed.
// Note: After an unhealthy machine is deleted, a new one is created by the KubeadmControlPlaneMachine as part of the
// regular reconcile loop that ensures the correct number of replicas exist; KubeadmControlPlaneMachine waits for
// the new machine to exists before removing the controlplane.cluster.x-k8s.io/remediation-in-progress annotation.
// This is part of a series of safeguards to ensure that operation are performed sequentially on control plane machines.
KubeadmControlPlaneMachineRemediationDoneV1Beta2Reason = "MachineDeleted"

// KubeadmControlPlaneMachineRemediationDInternalErrorV1Beta2Reason surfaces unexpected failures when remediating
// a KubeadmControlPlane controlled machine.
KubeadmControlPlaneMachineRemediationDInternalErrorV1Beta2Reason = clusterv1.InternalErrorV1Beta2Reason
)

// KubeadmControlPlane's Deleting condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlaneDeletingV1Beta2Condition surfaces details about ongoing deletion of the controlled machines.
KubeadmControlPlaneDeletingV1Beta2Condition = clusterv1.DeletingV1Beta2Condition
)

// KubeadmControlPlane's Paused condition and corresponding reasons that will be used in v1Beta2 API version.
const (
// KubeadmControlPlanePausedV1Beta2Condition is true if this resource or the Cluster it belongs to are paused.
KubeadmControlPlanePausedV1Beta2Condition = clusterv1.PausedV1Beta2Condition
)
Expand Down
Loading

0 comments on commit 57d81ed

Please sign in to comment.