Skip to content

Commit

Permalink
Reorder VSphereDeploymentZone reconcile to fix deletion
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <[email protected]>
  • Loading branch information
killianmuldoon committed Sep 15, 2023
1 parent c154905 commit c6be22c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/vspheredeploymentzone_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ func (r vsphereDeploymentZoneReconciler) Reconcile(ctx context.Context, request
failureDomain := &infrav1.VSphereFailureDomain{}
failureDomainKey := client.ObjectKey{Name: vsphereDeploymentZone.Spec.FailureDomain}
if err := r.Client.Get(ctx, failureDomainKey, failureDomain); err != nil {
if apierrors.IsNotFound(err) {
// If the VSphereFailureDomain is not found and the VSphereDeploymentZone is not deleting
// do not reconcile. If the VSphereDeploymentZone is in deletion allow reconcile to continue
// to cleanup.
if apierrors.IsNotFound(err) && !vsphereDeploymentZone.DeletionTimestamp.IsZero() {
logr.V(4).Info("Failure Domain not found, won't reconcile", "key", failureDomainKey)
return reconcile.Result{}, nil
}
Expand Down

0 comments on commit c6be22c

Please sign in to comment.