Skip to content

Commit a39ea9a

Browse files
committed
dockermachine: set v1beta2 Paused condition
1 parent b227dbf commit a39ea9a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

test/infrastructure/docker/internal/controllers/dockermachine_controller.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import (
5050
"sigs.k8s.io/cluster-api/util/labels"
5151
clog "sigs.k8s.io/cluster-api/util/log"
5252
"sigs.k8s.io/cluster-api/util/patch"
53+
"sigs.k8s.io/cluster-api/util/paused"
5354
"sigs.k8s.io/cluster-api/util/predicates"
5455
)
5556

@@ -119,6 +120,10 @@ func (r *DockerMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
119120
return ctrl.Result{}, nil
120121
}
121122

123+
if isPaused, conditionChanged, err := paused.EnsurePausedCondition(ctx, r.Client, cluster, dockerMachine); err != nil || isPaused || conditionChanged {
124+
return ctrl.Result{}, err
125+
}
126+
122127
log = log.WithValues("Cluster", klog.KObj(cluster))
123128
ctx = ctrl.LoggerInto(ctx, log)
124129

@@ -487,7 +492,7 @@ func (r *DockerMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl
487492
err = ctrl.NewControllerManagedBy(mgr).
488493
For(&infrav1.DockerMachine{}).
489494
WithOptions(options).
490-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
495+
WithEventFilter(predicates.ResourceHasFilterLabel(mgr.GetScheme(), predicateLog, r.WatchFilterValue)).
491496
Watches(
492497
&clusterv1.Machine{},
493498
handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("DockerMachine"))),
@@ -500,7 +505,7 @@ func (r *DockerMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl
500505
&clusterv1.Cluster{},
501506
handler.EnqueueRequestsFromMapFunc(clusterToDockerMachines),
502507
builder.WithPredicates(
503-
predicates.ClusterUnpausedAndInfrastructureReady(mgr.GetScheme(), predicateLog),
508+
predicates.ClusterInfrastructureReady(mgr.GetScheme(), predicateLog),
504509
),
505510
).Complete(r)
506511
if err != nil {

0 commit comments

Comments
 (0)