Skip to content

Commit

Permalink
Mark Machine healthy condition as unknown if we can't list wl nodes
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer buringerst@vmware.com
  • Loading branch information
sbueringer committed Dec 12, 2023
1 parent 164e35f commit ec91fbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions api/v1beta1/condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ const (

// NodeConditionsFailedReason (Severity=Warning) documents a node is not in a healthy state due to the failed state of at least 1 Kubelet condition.
NodeConditionsFailedReason = "NodeConditionsFailed"

// NodeInspectionFailedReason documents a failure in inspecting the node.
// This reason is used when the Machine controller is unable to list Nodes to find
// the corresponding Node for a Machine by ProviderID.
NodeInspectionFailedReason = "NodeInspectionFailed"
)

// Conditions and condition Reasons for the MachineHealthCheck object.
Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/machine/machine_controller_noderef.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ func (r *Reconciler) reconcileNode(ctx context.Context, s *scope) (ctrl.Result,
// No need to requeue here. Nodes emit an event that triggers reconciliation.
return ctrl.Result{}, nil
}
log.Error(err, "Failed to retrieve Node by ProviderID")
r.recorder.Event(machine, corev1.EventTypeWarning, "Failed to retrieve Node by ProviderID", err.Error())
conditions.MarkUnknown(machine, clusterv1.MachineNodeHealthyCondition, clusterv1.NodeInspectionFailedReason, "Failed to get the Node for this Machine by ProviderID")
return ctrl.Result{}, err
}

Expand Down

0 comments on commit ec91fbc

Please sign in to comment.