Skip to content

Commit

Permalink
Add paused state as condition
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Pedriza <[email protected]>
  • Loading branch information
AdrianPedriza committed Dec 17, 2024
1 parent 0a411d1 commit f62c0f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/controlplane/v1beta1/k0s_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -171,6 +172,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
}

Expand Down

0 comments on commit f62c0f1

Please sign in to comment.