Skip to content

Commit c2119ae

Browse files
committed
add pause condition back into lc and lm, fix tests
1 parent d389399 commit c2119ae

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

internal/controller/linodecluster_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ func (r *LinodeClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
113113
return ctrl.Result{}, fmt.Errorf("failed to create cluster scope: %w", err)
114114
}
115115

116+
isPaused, conditionChanged, err := paused.EnsurePausedCondition(ctx, clusterScope.Client, clusterScope.Cluster, clusterScope.LinodeCluster)
117+
if err != nil {
118+
return err
119+
}
120+
116121
if reconciler.IsPaused(cluster, linodeCluster) {
117122
logger.Info("linodeCluster or linked cluster is marked as paused, won't reconcile.")
118123
return ctrl.Result{}, nil

internal/controller/linodecluster_controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ var _ = Describe("cluster-lifecycle", Ordered, Label("cluster", "cluster-lifecyc
182182
// Set VPC as ready
183183
linodeVPC.Status.Ready = true
184184
linodeVPC.Labels = map[string]string{
185-
clusterv1.ClusterNameLabel: cScope.LinodeCluster.Name
185+
clusterv1.ClusterNameLabel: cScope.LinodeCluster.Name,
186186
}
187187
k8sClient.Status().Update(ctx, &linodeVPC)
188188

@@ -451,7 +451,7 @@ var _ = Describe("cluster-lifecycle-dns", Ordered, Label("cluster", "cluster-lif
451451
clusterKey := client.ObjectKeyFromObject(&linodeCluster)
452452
Expect(k8sClient.Get(ctx, clusterKey, &linodeCluster)).To(Succeed())
453453
Expect(linodeCluster.Status.Ready).To(BeTrue())
454-
Expect(linodeCluster.Status.Conditions).To(HaveLen(1))
454+
Expect(linodeCluster.Status.Conditions).To(HaveLen(2))
455455
readyCond := conditions.Get(&linodeCluster, string(clusterv1.ReadyCondition))
456456
Expect(readyCond).NotTo(BeNil())
457457

@@ -725,7 +725,7 @@ var _ = Describe("dns-override-endpoint", Ordered, Label("cluster", "dns-overrid
725725
clusterKey := client.ObjectKeyFromObject(&linodeCluster)
726726
Expect(k8sClient.Get(ctx, clusterKey, &linodeCluster)).To(Succeed())
727727
Expect(linodeCluster.Status.Ready).To(BeTrue())
728-
Expect(linodeCluster.Status.Conditions).To(HaveLen(1))
728+
Expect(linodeCluster.Status.Conditions).To(HaveLen(2))
729729
cond := conditions.Get(&linodeCluster, string(clusterv1.ReadyCondition))
730730
Expect(cond).NotTo(BeNil())
731731

internal/controller/linodemachine_controller.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ func (r *LinodeMachineReconciler) Reconcile(ctx context.Context, req ctrl.Reques
166166
return ctrl.Result{}, fmt.Errorf("failed to create machine scope: %w", err)
167167
}
168168

169+
isPaused, conditionChanged, err := paused.EnsurePausedCondition(ctx, machineScope.Client, machineScope.Cluster, machineScope.LinodeMachine)
170+
if err != nil {
171+
return err
172+
}
173+
169174
// Stop if paused
170175
if reconciler.IsPaused(machineScope.Cluster, machineScope.Machine) {
171176
log.Info("LinodeMachine or linked cluster is marked as paused, won't reconcile.")

0 commit comments

Comments
 (0)