cmd/k8s-operator: remove times requeues in proxy deletion path.

Our reconcile loop gets triggered again when the StatefulSet object
finally disappears (in addition to when its deletion starts, as indicated
by DeletionTimestamp != 0). So, we don't need to queue additional
reconciliations to proceed with the remainder of the cleanup, that
happens organically.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2022-12-13 13:32:05 -08:00
committed by Dave Anderson
parent c0fcab01ac
commit 8ccd707218
2 changed files with 7 additions and 6 deletions

View File

@@ -229,14 +229,15 @@ func (a *ServiceReconciler) cleanupIfRequired(ctx context.Context, svc *corev1.S
}
if sts != nil {
if !sts.GetDeletionTimestamp().IsZero() {
// Deletion in progress, check again later.
return reconcile.Result{RequeueAfter: time.Second}, nil
// Deletion in progress, check again later. We'll get another
// notification when the deletion is complete.
return reconcile.Result{}, nil
}
err := a.DeleteAllOf(ctx, &appsv1.StatefulSet{}, client.InNamespace(a.operatorNamespace), client.MatchingLabels(ml), client.PropagationPolicy(metav1.DeletePropagationForeground))
if err != nil {
return reconcile.Result{}, fmt.Errorf("deleting statefulset: %w", err)
}
return reconcile.Result{RequeueAfter: time.Second}, nil
return reconcile.Result{}, nil
}
id, _, err := a.getDeviceInfo(ctx, svc)