@@ -390,27 +390,29 @@ func (r *DockerMachinePoolReconciler) CreateDockerMachinesIfNotExists(ctx contex
390
390
}
391
391
392
392
for _ , instance := range instances {
393
- if _ , exists := instanceNameToDockerMachine [instance .InstanceName ]; ! exists {
394
- labels := dockerMachinePool .Status .InfrastructureMachineSelector .MatchLabels
395
- labels [clusterv1 .MachinePoolNameLabel ] = machinePool .Name
396
- dockerMachine := & infrav1.DockerMachine {
397
- ObjectMeta : metav1.ObjectMeta {
398
- Namespace : dockerMachinePool .Namespace ,
399
- GenerateName : fmt .Sprintf ("%s-" , dockerMachinePool .Name ),
400
- Labels : labels ,
401
- Annotations : make (map [string ]string ),
402
- // Note: This DockerMachine will be owned by the DockerMachinePool until the MachinePool controller creates its parent Machine.
403
- },
404
- Spec : infrav1.DockerMachineSpec {
405
- InstanceName : instance .InstanceName ,
406
- },
407
- }
393
+ if _ , exists := instanceNameToDockerMachine [instance .InstanceName ]; exists {
394
+ continue
395
+ }
408
396
409
- log .V (2 ).Info ("Instance name for dockerMachine is" , "instanceName" , instance .InstanceName , "dockerMachine" , dockerMachine .Name )
397
+ labels := dockerMachinePool .Status .InfrastructureMachineSelector .MatchLabels
398
+ labels [clusterv1 .MachinePoolNameLabel ] = machinePool .Name
399
+ dockerMachine := & infrav1.DockerMachine {
400
+ ObjectMeta : metav1.ObjectMeta {
401
+ Namespace : dockerMachinePool .Namespace ,
402
+ GenerateName : fmt .Sprintf ("%s-" , dockerMachinePool .Name ),
403
+ Labels : labels ,
404
+ Annotations : make (map [string ]string ),
405
+ // Note: This DockerMachine will be owned by the DockerMachinePool until the MachinePool controller creates its parent Machine.
406
+ },
407
+ Spec : infrav1.DockerMachineSpec {
408
+ InstanceName : instance .InstanceName ,
409
+ },
410
+ }
410
411
411
- if err := r .Client .Create (ctx , dockerMachine ); err != nil {
412
- return errors .Wrap (err , "failed to create dockerMachine" )
413
- }
412
+ log .V (2 ).Info ("Instance name for dockerMachine is" , "instanceName" , instance .InstanceName , "dockerMachine" , dockerMachine .Name )
413
+
414
+ if err := r .Client .Create (ctx , dockerMachine ); err != nil {
415
+ return errors .Wrap (err , "failed to create dockerMachine" )
414
416
}
415
417
}
416
418
0 commit comments