@@ -143,10 +143,11 @@ func (r *AWSMachineReconciler) getObjectStoreService(scope scope.S3Scope) servic
143
143
return s3 .NewService (scope )
144
144
}
145
145
146
- // +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsmachines,verbs=get;list;watch;update;patch;delete
147
- // +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsmachines/status,verbs=get;update;patch
148
146
// +kubebuilder:rbac:groups=controlplane.cluster.x-k8s.io,resources=*,verbs=get;list;watch
149
- // +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machines;machines/status,verbs=get;list;watch
147
+ // +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsmachines,verbs=create;get;list;watch;update;patch;delete
148
+ // +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=awsmachines/status,verbs=get;update;patch
149
+ // +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machines,verbs=get;list;watch;delete
150
+ // +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machines/status,verbs=get;list;watch
150
151
// +kubebuilder:rbac:groups="",resources=secrets;,verbs=get;list;watch
151
152
// +kubebuilder:rbac:groups="",resources=namespaces,verbs=get;list;watch
152
153
// +kubebuilder:rbac:groups="",resources=events,verbs=get;list;watch;create;update;patch
@@ -450,6 +451,7 @@ func (r *AWSMachineReconciler) findInstance(machineScope *scope.MachineScope, ec
450
451
return instance , nil
451
452
}
452
453
454
+ //nolint:gocyclo
453
455
func (r * AWSMachineReconciler ) reconcileNormal (_ context.Context , machineScope * scope.MachineScope , clusterScope cloud.ClusterScoper , ec2Scope scope.EC2Scope , elbScope scope.ELBScope , objectStoreScope scope.S3Scope ) (ctrl.Result , error ) {
454
456
machineScope .Trace ("Reconciling AWSMachine" )
455
457
@@ -473,7 +475,7 @@ func (r *AWSMachineReconciler) reconcileNormal(_ context.Context, machineScope *
473
475
}
474
476
475
477
// Make sure bootstrap data is available and populated.
476
- if machineScope .Machine .Spec .Bootstrap .DataSecretName == nil {
478
+ if ! machineScope . IsMachinePoolMachine () && machineScope .Machine .Spec .Bootstrap .DataSecretName == nil {
477
479
machineScope .Info ("Bootstrap data secret reference is not yet available" )
478
480
conditions .MarkFalse (machineScope .AWSMachine , infrav1 .InstanceReadyCondition , infrav1 .WaitingForBootstrapDataReason , clusterv1 .ConditionSeverityInfo , "" )
479
481
return ctrl.Result {}, nil
@@ -488,6 +490,12 @@ func (r *AWSMachineReconciler) reconcileNormal(_ context.Context, machineScope *
488
490
conditions .MarkUnknown (machineScope .AWSMachine , infrav1 .InstanceReadyCondition , infrav1 .InstanceNotFoundReason , err .Error ())
489
491
return ctrl.Result {}, err
490
492
}
493
+ if instance == nil && machineScope .IsMachinePoolMachine () {
494
+ err = errors .New ("no instance found for machine pool" )
495
+ machineScope .Error (err , "unable to find instance" )
496
+ conditions .MarkUnknown (machineScope .AWSMachine , infrav1 .InstanceReadyCondition , infrav1 .InstanceNotFoundReason , err .Error ())
497
+ return ctrl.Result {}, err
498
+ }
491
499
492
500
// If the AWSMachine doesn't have our finalizer, add it.
493
501
if controllerutil .AddFinalizer (machineScope .AWSMachine , infrav1 .MachineFinalizer ) {
@@ -572,9 +580,11 @@ func (r *AWSMachineReconciler) reconcileNormal(_ context.Context, machineScope *
572
580
}
573
581
574
582
// reconcile the deletion of the bootstrap data secret now that we have updated instance state
575
- if deleteSecretErr := r .deleteBootstrapData (machineScope , clusterScope , objectStoreScope ); deleteSecretErr != nil {
576
- r .Log .Error (deleteSecretErr , "unable to delete secrets" )
577
- return ctrl.Result {}, deleteSecretErr
583
+ if ! machineScope .IsMachinePoolMachine () {
584
+ if deleteSecretErr := r .deleteBootstrapData (machineScope , clusterScope , objectStoreScope ); deleteSecretErr != nil {
585
+ r .Log .Error (deleteSecretErr , "unable to delete secrets" )
586
+ return ctrl.Result {}, deleteSecretErr
587
+ }
578
588
}
579
589
580
590
if instance .State == infrav1 .InstanceStateTerminated {
0 commit comments