@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
- package controllers
17
+ package machinepool
18
18
19
19
import (
20
20
"context"
@@ -53,7 +53,7 @@ import (
53
53
"sigs.k8s.io/cluster-api/util/predicates"
54
54
)
55
55
56
- func (r * MachinePoolReconciler ) reconcilePhase (mp * expv1.MachinePool ) {
56
+ func (r * Reconciler ) reconcilePhase (mp * expv1.MachinePool ) {
57
57
// Set the phase to "pending" if nil.
58
58
if mp .Status .Phase == "" {
59
59
mp .Status .SetTypedPhase (expv1 .MachinePoolPhasePending )
@@ -108,7 +108,7 @@ func (r *MachinePoolReconciler) reconcilePhase(mp *expv1.MachinePool) {
108
108
}
109
109
110
110
// reconcileExternal handles generic unstructured objects referenced by a MachinePool.
111
- func (r * MachinePoolReconciler ) reconcileExternal (ctx context.Context , m * expv1.MachinePool , ref * corev1.ObjectReference ) (external.ReconcileOutput , error ) {
111
+ func (r * Reconciler ) reconcileExternal (ctx context.Context , m * expv1.MachinePool , ref * corev1.ObjectReference ) (external.ReconcileOutput , error ) {
112
112
log := ctrl .LoggerFrom (ctx )
113
113
114
114
if err := utilconversion .UpdateReferenceAPIContract (ctx , r .Client , ref ); err != nil {
@@ -185,7 +185,7 @@ func (r *MachinePoolReconciler) reconcileExternal(ctx context.Context, m *expv1.
185
185
}
186
186
187
187
// reconcileBootstrap reconciles the Spec.Bootstrap.ConfigRef object on a MachinePool.
188
- func (r * MachinePoolReconciler ) reconcileBootstrap (ctx context.Context , s * scope ) (ctrl.Result , error ) {
188
+ func (r * Reconciler ) reconcileBootstrap (ctx context.Context , s * scope ) (ctrl.Result , error ) {
189
189
log := ctrl .LoggerFrom (ctx )
190
190
m := s .machinePool
191
191
// Call generic external reconciler if we have an external reference.
@@ -264,7 +264,7 @@ func (r *MachinePoolReconciler) reconcileBootstrap(ctx context.Context, s *scope
264
264
}
265
265
266
266
// reconcileInfrastructure reconciles the Spec.InfrastructureRef object on a MachinePool.
267
- func (r * MachinePoolReconciler ) reconcileInfrastructure (ctx context.Context , s * scope ) (ctrl.Result , error ) {
267
+ func (r * Reconciler ) reconcileInfrastructure (ctx context.Context , s * scope ) (ctrl.Result , error ) {
268
268
log := ctrl .LoggerFrom (ctx )
269
269
cluster := s .cluster
270
270
mp := s .machinePool
@@ -374,7 +374,7 @@ func (r *MachinePoolReconciler) reconcileInfrastructure(ctx context.Context, s *
374
374
// infrastructure is created accordingly.
375
375
// Note: When supported by the cloud provider implementation of the MachinePool, machines will provide a means to interact
376
376
// with the corresponding infrastructure (e.g. delete a specific machine in case MachineHealthCheck detects it is unhealthy).
377
- func (r * MachinePoolReconciler ) reconcileMachines (ctx context.Context , s * scope , infraMachinePool * unstructured.Unstructured ) error {
377
+ func (r * Reconciler ) reconcileMachines (ctx context.Context , s * scope , infraMachinePool * unstructured.Unstructured ) error {
378
378
log := ctrl .LoggerFrom (ctx )
379
379
mp := s .machinePool
380
380
@@ -431,7 +431,7 @@ func (r *MachinePoolReconciler) reconcileMachines(ctx context.Context, s *scope,
431
431
}
432
432
433
433
// createOrUpdateMachines creates a MachinePool Machine for each infraMachine if it doesn't already exist and sets the owner reference and infraRef.
434
- func (r * MachinePoolReconciler ) createOrUpdateMachines (ctx context.Context , s * scope , machines []clusterv1.Machine , infraMachines []unstructured.Unstructured ) error {
434
+ func (r * Reconciler ) createOrUpdateMachines (ctx context.Context , s * scope , machines []clusterv1.Machine , infraMachines []unstructured.Unstructured ) error {
435
435
log := ctrl .LoggerFrom (ctx )
436
436
437
437
// Construct a set of names of infraMachines that already have a Machine.
@@ -490,7 +490,7 @@ func (r *MachinePoolReconciler) createOrUpdateMachines(ctx context.Context, s *s
490
490
491
491
// computeDesiredMachine constructs the desired Machine for an infraMachine.
492
492
// If the Machine exists, it ensures the Machine always owned by the MachinePool.
493
- func (r * MachinePoolReconciler ) computeDesiredMachine (mp * expv1.MachinePool , infraMachine * unstructured.Unstructured , existingMachine * clusterv1.Machine , existingNode * corev1.Node ) * clusterv1.Machine {
493
+ func (r * Reconciler ) computeDesiredMachine (mp * expv1.MachinePool , infraMachine * unstructured.Unstructured , existingMachine * clusterv1.Machine , existingNode * corev1.Node ) * clusterv1.Machine {
494
494
infraRef := corev1.ObjectReference {
495
495
APIVersion : infraMachine .GetAPIVersion (),
496
496
Kind : infraMachine .GetKind (),
@@ -546,7 +546,7 @@ func (r *MachinePoolReconciler) computeDesiredMachine(mp *expv1.MachinePool, inf
546
546
547
547
// infraMachineToMachinePoolMapper is a mapper function that maps an InfraMachine to the MachinePool that owns it.
548
548
// This is used to trigger an update of the MachinePool when a InfraMachine is changed.
549
- func (r * MachinePoolReconciler ) infraMachineToMachinePoolMapper (ctx context.Context , o client.Object ) []ctrl.Request {
549
+ func (r * Reconciler ) infraMachineToMachinePoolMapper (ctx context.Context , o client.Object ) []ctrl.Request {
550
550
log := ctrl .LoggerFrom (ctx )
551
551
552
552
if labels .IsMachinePoolOwned (o ) {
@@ -570,7 +570,7 @@ func (r *MachinePoolReconciler) infraMachineToMachinePoolMapper(ctx context.Cont
570
570
return nil
571
571
}
572
572
573
- func (r * MachinePoolReconciler ) waitForMachineCreation (ctx context.Context , machineList []clusterv1.Machine ) error {
573
+ func (r * Reconciler ) waitForMachineCreation (ctx context.Context , machineList []clusterv1.Machine ) error {
574
574
_ = ctrl .LoggerFrom (ctx )
575
575
576
576
// waitForCacheUpdateTimeout is the amount of time allowed to wait for desired state.
@@ -602,7 +602,7 @@ func (r *MachinePoolReconciler) waitForMachineCreation(ctx context.Context, mach
602
602
return nil
603
603
}
604
604
605
- func (r * MachinePoolReconciler ) getNodeRefMap (ctx context.Context , c client.Client ) (map [string ]* corev1.Node , error ) {
605
+ func (r * Reconciler ) getNodeRefMap (ctx context.Context , c client.Client ) (map [string ]* corev1.Node , error ) {
606
606
log := ctrl .LoggerFrom (ctx )
607
607
nodeRefsMap := make (map [string ]* corev1.Node )
608
608
nodeList := corev1.NodeList {}
0 commit comments