@@ -309,6 +309,22 @@ func patchMachineSet(ctx context.Context, patchHelper *patch.Helper, machineSet
309
309
return patchHelper .Patch (ctx , machineSet , options ... )
310
310
}
311
311
312
+ func (r * Reconciler ) getOwningMachineDeployment (ctx context.Context , s * scope ) (ctrl.Result , error ) {
313
+ if ! isDeploymentChild (s .machineSet ) {
314
+ // If the MachineSet is not in a MachineDeployment, return immediately.
315
+ return ctrl.Result {}, nil
316
+ }
317
+
318
+ // Otherwise get the owning MachineDeployment
319
+ var err error
320
+ s .owningMachineDeployment , err = r .getOwnerMachineDeployment (ctx , s .machineSet )
321
+ if err != nil {
322
+ return ctrl.Result {}, err
323
+ }
324
+
325
+ return ctrl.Result {}, nil
326
+ }
327
+
312
328
func (r * Reconciler ) reconcileMachineSetOwnerAndLabels (_ context.Context , s * scope ) (ctrl.Result , error ) {
313
329
// Reconcile and retrieve the Cluster object.
314
330
if s .machineSet .Labels == nil {
@@ -342,22 +358,6 @@ func (r *Reconciler) reconcileMachineSetOwnerAndLabels(_ context.Context, s *sco
342
358
return ctrl.Result {}, nil
343
359
}
344
360
345
- func (r * Reconciler ) getOwningMachineDeployment (ctx context.Context , s * scope ) (ctrl.Result , error ) {
346
- if ! isDeploymentChild (s .machineSet ) {
347
- // If the MachineSet is not in a MachineDeployment, return immediately.
348
- return ctrl.Result {}, nil
349
- }
350
-
351
- // Otherwise get the owning MachineDeployment
352
- var err error
353
- s .owningMachineDeployment , err = r .getOwnerMachineDeployment (ctx , s .machineSet )
354
- if err != nil {
355
- return ctrl.Result {}, err
356
- }
357
-
358
- return ctrl.Result {}, nil
359
- }
360
-
361
361
func (r * Reconciler ) reconcileInfrastructure (ctx context.Context , s * scope ) (ctrl.Result , error ) {
362
362
// Make sure to reconcile the external infrastructure reference.
363
363
var err error
0 commit comments