Skip to content

Commit

Permalink
Allow Machines in unreachable Clusters to do initial reconciliation
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <kmuldoon@vmware.com>
  • Loading branch information
killianmuldoon committed Jan 25, 2023
1 parent c0fe3cf commit 68763b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 0 additions & 4 deletions internal/controllers/machine/machine_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,6 @@ func patchMachine(ctx context.Context, patchHelper *patch.Helper, machine *clust
}

func (r *Reconciler) reconcile(ctx context.Context, cluster *clusterv1.Cluster, m *clusterv1.Machine) (ctrl.Result, error) {
if err := r.watchClusterNodes(ctx, cluster); err != nil {
return ctrl.Result{}, err
}

// If the machine is a stand-alone one, meaning not originated from a MachineDeployment, then set it as directly
// owned by the Cluster (if not already present).
if r.shouldAdopt(m) {
Expand Down
5 changes: 5 additions & 0 deletions internal/controllers/machine/machine_controller_noderef.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ var (
func (r *Reconciler) reconcileNode(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) (ctrl.Result, error) {
log := ctrl.LoggerFrom(ctx)

// Create a watch on the nodes in the Cluster.
if err := r.watchClusterNodes(ctx, cluster); err != nil {
return ctrl.Result{}, err
}

// Check that the Machine has a valid ProviderID.
if machine.Spec.ProviderID == nil || *machine.Spec.ProviderID == "" {
log.Info("Waiting for infrastructure provider to report spec.providerID", machine.Spec.InfrastructureRef.Kind, klog.KRef(machine.Spec.InfrastructureRef.Namespace, machine.Spec.InfrastructureRef.Name))
Expand Down

0 comments on commit 68763b7

Please sign in to comment.