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 20f08e2 commit fadf9a1
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 @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit fadf9a1

Please sign in to comment.