Skip to content

Commit

Permalink
Fix the 'reason' text in metallb Reconcile
Browse files Browse the repository at this point in the history
Change errorMsg value to "internal error" because previously,
assigning it the error message string resulted in failure to update the condition
having the following error:

status.conditions[3].reason in body should match '^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$'",
"errorVerbose": "MetalLB.metallb.io \"metallb\" is invalid: status.conditions[3].reason: Invalid value:

i.e. the error message includes invalid characters.
we do print the error message under the status.conditions.message.

Example of the error message that includes invalid characters:

"FailedToSyncMetalLBResources: could not apply (apps/v1, Kind=Deployment) openshift-metallb-system/controller:
could not update object (apps/v1, Kind=Deployment) openshift-metallb-system/controller: Operation cannot be
fulfilled on deployments.apps \\\"controller\\\": the object has been modified; please apply your changes to the
latest version and try again\"

Signed-off-by: liornoy <[email protected]>
  • Loading branch information
liornoy authored and fedepaol committed Jul 26, 2023
1 parent f80c10b commit 262c965
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/metallb_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (r *MetalLBReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
if condition != "" {
errorMsg, wrappedErrMsg := condition, ""
if err != nil {
errorMsg = err.Error()
errorMsg = "internal error"
if errors.Unwrap(err) != nil {
wrappedErrMsg = errors.Unwrap(err).Error()
}
Expand Down

0 comments on commit 262c965

Please sign in to comment.