Skip to content

Commit

Permalink
Use internal error reason more consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziopandini committed Oct 18, 2024
1 parent b03a2d2 commit 14a36f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions api/v1beta1/machine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,12 @@ const (
// MachineWaitingForMinReadySecondsV1Beta2Reason surfaces when a machine is ready for less than MinReadySeconds (and thus not yet available).
MachineWaitingForMinReadySecondsV1Beta2Reason = "WaitingForMinReadySeconds"

// MachineReadyNotYetReportedV1Beta2Reason surfaces when a machine ready is not reported yet.
// Note: this should never happen and it is a signal of some internal error.
MachineReadyNotYetReportedV1Beta2Reason = "ReadyNotYetReported"

// MachineAvailableV1Beta2Reason surfaces when a machine is ready for at least MinReadySeconds.
// Note: MinReadySeconds is assumed 0 until it will be implemented in v1beta2 API.
MachineAvailableV1Beta2Reason = AvailableV1Beta2Condition

// MachineAvailableInternalErrorV1Beta2Reason surfaces unexpected error when computing the Available condition.
MachineAvailableInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
)

// Machine's Ready condition and corresponding reasons that will be used in v1Beta2 API version.
Expand All @@ -115,9 +114,8 @@ const (
// these conditions must be true as well.
MachineReadyV1Beta2Condition = ReadyV1Beta2Condition

// MachineErrorComputingReadyV1Beta2Reason surfaces when there was an error computing the ready condition.
// Note: this should never happen and it is a signal of some internal error.
MachineErrorComputingReadyV1Beta2Reason = "ErrorComputingReady"
// MachineReadyInternalErrorV1Beta2Reason surfaces unexpected error when computing the Ready condition.
MachineReadyInternalErrorV1Beta2Reason = InternalErrorV1Beta2Reason
)

// Machine's UpToDate condition and corresponding reasons that will be used in v1Beta2 API version.
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/machine/machine_controller_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ func setReadyCondition(ctx context.Context, machine *clusterv1.Machine) {
readyCondition = &metav1.Condition{
Type: clusterv1.MachineReadyV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: clusterv1.MachineErrorComputingReadyV1Beta2Reason,
Reason: clusterv1.MachineReadyInternalErrorV1Beta2Reason,
Message: "Please check controller logs for errors",
}
}
Expand Down Expand Up @@ -659,7 +659,7 @@ func setAvailableCondition(_ context.Context, machine *clusterv1.Machine) {
v1beta2conditions.Set(machine, metav1.Condition{
Type: clusterv1.MachineAvailableV1Beta2Condition,
Status: metav1.ConditionUnknown,
Reason: clusterv1.MachineReadyNotYetReportedV1Beta2Reason,
Reason: clusterv1.MachineAvailableInternalErrorV1Beta2Reason,
Message: "Please check controller logs for errors",
})
return
Expand Down

0 comments on commit 14a36f8

Please sign in to comment.