diff --git a/api/controlplane/v1beta1/k0s_types.go b/api/controlplane/v1beta1/k0s_types.go index e48d7bc89..efa61cf6b 100644 --- a/api/controlplane/v1beta1/k0s_types.go +++ b/api/controlplane/v1beta1/k0s_types.go @@ -39,6 +39,9 @@ const ( const ( // ControlPlaneReadyCondition documents the status of the control plane ControlPlaneReadyCondition clusterv1.ConditionType = "ControlPlaneReady" + + // ControlPlanePausedCondition documents the reconciliation of the control plane is paused. + ControlPlanePausedCondition clusterv1.ConditionType = "Paused" ) // +kubebuilder:object:root=true diff --git a/internal/controller/controlplane/k0s_controlplane_controller.go b/internal/controller/controlplane/k0s_controlplane_controller.go index 774be676c..fd7dd2240 100644 --- a/internal/controller/controlplane/k0s_controlplane_controller.go +++ b/internal/controller/controlplane/k0s_controlplane_controller.go @@ -46,6 +46,7 @@ import ( capiutil "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/annotations" "sigs.k8s.io/cluster-api/util/collections" + "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/failuredomains" "sigs.k8s.io/cluster-api/util/kubeconfig" "sigs.k8s.io/cluster-api/util/secret" @@ -170,6 +171,8 @@ func (c *K0sController) Reconcile(ctx context.Context, req ctrl.Request) (res ct if annotations.IsPaused(cluster, kcp) { log.Info("Reconciliation is paused for this object or owning cluster") + // TODO: Use paused.EnsurePausedCondition from "sigs.k8s.io/cluster-api/util/paused" when upgrading to v1.9.0. + conditions.MarkTrue(kcp, cpv1beta1.ControlPlanePausedCondition) return ctrl.Result{}, nil }