diff --git a/api/controlplane/v1beta1/k0s_types.go b/api/controlplane/v1beta1/k0s_types.go index 77f1812c0..f84342832 100644 --- a/api/controlplane/v1beta1/k0s_types.go +++ b/api/controlplane/v1beta1/k0s_types.go @@ -44,6 +44,9 @@ const ( // and more specifically it tracks that the system is in between having deleted an unhealthy machine // and recreating its replacement. RemediationInProgressAnnotation = "controlplane.cluster.x-k8s.io/remediation-in-progress" + + // 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 b4a413926..dad25e934 100644 --- a/internal/controller/controlplane/k0s_controlplane_controller.go +++ b/internal/controller/controlplane/k0s_controlplane_controller.go @@ -47,6 +47,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" @@ -169,8 +170,10 @@ func (c *K0sController) Reconcile(ctx context.Context, req ctrl.Request) (res ct log = log.WithValues("cluster", cluster.Name) + // TODO: Use paused.EnsurePausedCondition from "sigs.k8s.io/cluster-api/util/paused" when upgrading to v1.9.0. if annotations.IsPaused(cluster, kcp) { log.Info("Reconciliation is paused for this object or owning cluster") + conditions.MarkTrue(kcp, cpv1beta1.ControlPlanePausedCondition) return ctrl.Result{}, nil }