@@ -300,7 +300,7 @@ func (r *DockerMachinePoolReconciler) reconcileNormal(ctx context.Context, clust
300
300
}
301
301
302
302
// Create a DockerMachine for each instance returned by the node pool if it doesn't exist.
303
- if err := r .CreateDockerMachinesIfNotExists (ctx , dockerMachinePool , nodePoolInstancesResult ); err != nil {
303
+ if err := r .CreateDockerMachinesIfNotExists (ctx , machinePool , dockerMachinePool , nodePoolInstancesResult ); err != nil {
304
304
conditions .MarkFalse (dockerMachinePool , clusterv1 .ReadyCondition , "FailedToCreateNewMachines" , clusterv1 .ConditionSeverityWarning , err .Error ())
305
305
return ctrl.Result {}, errors .Wrap (err , "failed to create missing machines" )
306
306
}
@@ -374,7 +374,7 @@ func (r *DockerMachinePoolReconciler) DeleteDanglingDockerMachines(ctx context.C
374
374
}
375
375
376
376
// CreateDockerMachinesIfNotExists creates a DockerMachine for each instance returned by the node pool if it doesn't exist.
377
- func (r * DockerMachinePoolReconciler ) CreateDockerMachinesIfNotExists (ctx context.Context , dockerMachinePool * infraexpv1.DockerMachinePool , instances []docker.NodePoolInstance ) error {
377
+ func (r * DockerMachinePoolReconciler ) CreateDockerMachinesIfNotExists (ctx context.Context , machinePool * expv1. MachinePool , dockerMachinePool * infraexpv1.DockerMachinePool , instances []docker.NodePoolInstance ) error {
378
378
log := ctrl .LoggerFrom (ctx )
379
379
380
380
log .V (2 ).Info ("Creating missing machines" , "dockerMachinePool" , dockerMachinePool .Name , "namespace" , dockerMachinePool .Namespace , "instances" , instances )
@@ -391,11 +391,13 @@ func (r *DockerMachinePoolReconciler) CreateDockerMachinesIfNotExists(ctx contex
391
391
392
392
for _ , instance := range instances {
393
393
if _ , exists := instanceNameToDockerMachine [instance .InstanceName ]; ! exists {
394
+ labels := dockerMachinePool .Status .InfrastructureMachineSelector .MatchLabels
395
+ labels [clusterv1 .MachinePoolNameLabel ] = machinePool .Name
394
396
dockerMachine := & infrav1.DockerMachine {
395
397
ObjectMeta : metav1.ObjectMeta {
396
398
Namespace : dockerMachinePool .Namespace ,
397
399
GenerateName : fmt .Sprintf ("%s-" , dockerMachinePool .Name ),
398
- Labels : dockerMachinePool . Status . InfrastructureMachineSelector . MatchLabels ,
400
+ Labels : labels ,
399
401
Annotations : make (map [string ]string ),
400
402
// Note: This DockerMachine will be owned by the DockerMachinePool until the MachinePool controller creates its parent Machine.
401
403
},
0 commit comments