Skip to content

Commit eff01b2

Browse files
authored
Don't return the error if pooled machines were deleted (#1187)
Signed-off-by: Alexey Makhov <[email protected]> Signed-off-by: makhov <[email protected]>
1 parent 75d807b commit eff01b2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

internal/controller/infrastructure/cluster_controller.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ func (r *ClusterController) Reconcile(ctx context.Context, req ctrl.Request) (re
5151
}
5252

5353
// Nothing really to do, except put the cluster in a ready state
54-
c.Status.Ready = true
55-
if err := r.Status().Update(ctx, c); err != nil {
56-
log.Error(err, "Failed to update RemoteCluster status")
57-
return ctrl.Result{}, err
54+
if c.ObjectMeta.DeletionTimestamp.IsZero() {
55+
c.Status.Ready = true
56+
if err := r.Status().Update(ctx, c); err != nil {
57+
log.Error(err, "Failed to update RemoteCluster status")
58+
return ctrl.Result{}, err
59+
}
5860
}
5961

6062
return ctrl.Result{}, nil

internal/controller/infrastructure/remote_machine_controller.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ func (r *RemoteMachineController) returnMachineToPool(ctx context.Context, rm *i
357357
return fmt.Errorf("failed to list pooled machines: %w", err)
358358
}
359359
if len(pooledMachines.Items) == 0 {
360+
if !rm.DeletionTimestamp.IsZero() {
361+
return nil
362+
}
360363
return fmt.Errorf("no pooled machines found for pool %s", pool)
361364
}
362365

0 commit comments

Comments
 (0)