Skip to content

Commit 5e4caa9

Browse files
committed
fix: use vsphereMachine instead of machine for fd
This commit changes the failureDomain check from using capi machine to vsphereMachine. The vsphereMachine object has immediate access to the failure domain struct, which resolves an issue where virtual machines are not placed within vm-host groups in a timely manner causing misplacement in the topology.
1 parent 3cf591f commit 5e4caa9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

controllers/vspherevm_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,10 @@ func (r vmReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.R
234234
}
235235

236236
var vsphereFailureDomain *infrav1.VSphereFailureDomain
237-
if failureDomain := machine.Spec.FailureDomain; failureDomain != "" {
237+
if failureDomain := vsphereMachine.Spec.FailureDomain; failureDomain != nil && *failureDomain != "" {
238238
vsphereDeploymentZone := &infrav1.VSphereDeploymentZone{}
239-
if err := r.Client.Get(ctx, apitypes.NamespacedName{Name: failureDomain}, vsphereDeploymentZone); err != nil {
240-
return reconcile.Result{}, errors.Wrapf(err, "failed to get VSphereDeploymentZone %s", failureDomain)
239+
if err := r.Client.Get(ctx, apitypes.NamespacedName{Name: *failureDomain}, vsphereDeploymentZone); err != nil {
240+
return reconcile.Result{}, errors.Wrapf(err, "failed to get VSphereDeploymentZone %s", *failureDomain)
241241
}
242242

243243
vsphereFailureDomain = &infrav1.VSphereFailureDomain{}

0 commit comments

Comments
 (0)