Skip to content

Commit 553215f

Browse files
committed
Lint
1 parent 6ee4d9d commit 553215f

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

test/infrastructure/docker/exp/internal/controllers/dockermachinepool_controller.go

+21-19
Original file line numberDiff line numberDiff line change
@@ -390,27 +390,29 @@ func (r *DockerMachinePoolReconciler) CreateDockerMachinesIfNotExists(ctx contex
390390
}
391391

392392
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+
}
408396

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+
}
410411

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")
414416
}
415417
}
416418

0 commit comments

Comments
 (0)