Skip to content

Commit d767dd7

Browse files
authored
Check providerID instead of node label in creation flow (#1050)
1 parent a4d1d4a commit d767dd7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/util/provider/machinecontroller/machine.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,8 @@ func (c *controller) triggerCreationFlow(ctx context.Context, createMachineReque
539539
// Either VM is not found
540540
// or GetMachineStatus() call is not implemented
541541
// In this case, invoke a CreateMachine() call
542-
if _, present := machine.Labels[v1alpha1.NodeLabelKey]; !present {
543-
// If node label is not present
542+
if machine.Spec.ProviderID == "" {
543+
// If no providerID is present
544544
klog.V(2).Infof("Creating a VM for machine %q, please wait!", machine.Name)
545545
klog.V(2).Infof("The machine creation is triggered with timeout of %s", c.getEffectiveCreationTimeout(createMachineRequest.Machine).Duration)
546546
createMachineResponse, err := c.driver.CreateMachine(ctx, createMachineRequest)
@@ -612,8 +612,9 @@ func (c *controller) triggerCreationFlow(ctx context.Context, createMachineReque
612612
}
613613
uninitializedMachine = true
614614
} else {
615-
// if node label present that means there must be a backing VM ,without need of GetMachineStatus() call
615+
// if .spec.ProviderID is present that means there must be a backing VM, without need of GetMachineStatus() call
616616
nodeName = machine.Labels[v1alpha1.NodeLabelKey]
617+
providerID = machine.Spec.ProviderID
617618
}
618619

619620
case codes.Uninitialized:

0 commit comments

Comments
 (0)