Skip to content

Commit 610b27c

Browse files
authored
Merge pull request #7719 from killianmuldoon/pr-reconcile-uncontactable-machines
🌱 Allow Machines in unreachable Clusters to do initial reconciliation
2 parents 11d3494 + 68763b7 commit 610b27c

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
@@ -272,10 +272,6 @@ func patchMachine(ctx context.Context, patchHelper *patch.Helper, machine *clust
272272
}
273273

274274
func (r *Reconciler) reconcile(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine) (ctrl.Result, error) {
275-
if err := r.watchClusterNodes(ctx, cluster); err != nil {
276-
return ctrl.Result{}, err
277-
}
278-
279275
// If the machine is a stand-alone one, meaning not originated from a MachineDeployment, then set it as directly
280276
// owned by the Cluster (if not already present).
281277
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
@@ -47,6 +47,11 @@ var (
4747
func (r *Reconciler) reconcileNode(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (ctrl.Result, error) {
4848
log := ctrl.LoggerFrom(ctx)
4949

50+
// Create a watch on the nodes in the Cluster.
51+
if err := r.watchClusterNodes(ctx, cluster); err != nil {
52+
return ctrl.Result{}, err
53+
}
54+
5055
// Check that the Machine has a valid ProviderID.
5156
if machine.Spec.ProviderID == nil || *machine.Spec.ProviderID == "" {
5257
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)