Skip to content

Commit c04dcff

Browse files
committed
Fix govmomi e2e tests
Signed-off-by: Stefan Büringer [email protected]
1 parent db71fe5 commit c04dcff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

controllers/vspherevm_controller.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ func (r vmReconciler) reconcileDelete(ctx context.Context, vmCtx *capvcontext.VM
379379
}
380380

381381
// deleteNode attempts to find and best effort delete the node corresponding to the VM
382-
// This is necessary since CAPI does not the nodeRef field on the owner Machine object
382+
// This is necessary since CAPI does not surface the nodeRef field on the owner Machine object
383383
// until the node moves to Ready state. Hence, on Machine deletion it is unable to delete
384384
// the kubernetes node corresponding to the VM.
385385
func (r vmReconciler) deleteNode(ctx context.Context, vmCtx *capvcontext.VMContext, name string) (reconcile.Result, error) {
@@ -389,6 +389,12 @@ func (r vmReconciler) deleteNode(ctx context.Context, vmCtx *capvcontext.VMConte
389389
if err != nil {
390390
return ctrl.Result{}, err
391391
}
392+
393+
// Skip deleting the Node if the cluster is being deleted.
394+
if !cluster.DeletionTimestamp.IsZero() {
395+
return ctrl.Result{}, nil
396+
}
397+
392398
clusterClient, err := r.clusterCache.GetClient(ctx, ctrlclient.ObjectKeyFromObject(cluster))
393399
if err != nil {
394400
if errors.Is(err, clustercache.ErrClusterNotConnected) {

0 commit comments

Comments
 (0)