Skip to content

Commit 68763b7

Browse files
Allow Machines in unreachable Clusters to do initial reconciliation
Signed-off-by: killianmuldoon <[email protected]>
1 parent c0fe3cf commit 68763b7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

internal/controllers/machine/machine_controller.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,6 @@ func patchMachine(ctx context.Context, patchHelper *patch.Helper, machine *clust
267267
}
268268

269269
func (r *Reconciler) reconcile(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine) (ctrl.Result, error) {
270-
if err := r.watchClusterNodes(ctx, cluster); err != nil {
271-
return ctrl.Result{}, err
272-
}
273-
274270
// If the machine is a stand-alone one, meaning not originated from a MachineDeployment, then set it as directly
275271
// owned by the Cluster (if not already present).
276272
if r.shouldAdopt(m) {

internal/controllers/machine/machine_controller_noderef.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ var (
4444
func (r *Reconciler) reconcileNode(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (ctrl.Result, error) {
4545
log := ctrl.LoggerFrom(ctx)
4646

47+
// Create a watch on the nodes in the Cluster.
48+
if err := r.watchClusterNodes(ctx, cluster); err != nil {
49+
return ctrl.Result{}, err
50+
}
51+
4752
// Check that the Machine has a valid ProviderID.
4853
if machine.Spec.ProviderID == nil || *machine.Spec.ProviderID == "" {
4954
log.Info("Waiting for infrastructure provider to report spec.providerID", machine.Spec.InfrastructureRef.Kind, klog.KRef(machine.Spec.InfrastructureRef.Namespace, machine.Spec.InfrastructureRef.Name))

0 commit comments

Comments
 (0)