Skip to content

Commit

Permalink
Fix to improper formatting of UnhealthyRange
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <[email protected]>
  • Loading branch information
killianmuldoon committed Jan 13, 2022
1 parent 1e13f44 commit e177f89
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,16 @@ func (r *Reconciler) reconcile(ctx context.Context, logger logr.Logger, cluster
Status: corev1.ConditionFalse,
Severity: clusterv1.ConditionSeverityWarning,
Reason: clusterv1.TooManyUnhealthyReason,
Message: message,
// Format message to account for percent sign.
Message: strings.Replace(message, "%", "%%", -1),
})

r.recorder.Eventf(
m,
corev1.EventTypeWarning,
EventRemediationRestricted,
message,
// Format message to account for percent sign.
strings.Replace(message, "%", "%%", -1),
)
errList := []error{}
for _, t := range append(healthy, unhealthy...) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"sort"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -570,7 +571,8 @@ func TestMachineHealthCheck_Reconcile(t *testing.T) {
Status: corev1.ConditionFalse,
Severity: clusterv1.ConditionSeverityWarning,
Reason: clusterv1.TooManyUnhealthyReason,
Message: "Remediation is not allowed, the number of not started or unhealthy machines exceeds maxUnhealthy (total: 3, unhealthy: 2, maxUnhealthy: 40%)",
// Format message to account for percent sign.
Message: strings.Replace("Remediation is not allowed, the number of not started or unhealthy machines exceeds maxUnhealthy (total: 3, unhealthy: 2, maxUnhealthy: 40%)", "%", "%%", -1),
},
},
}))
Expand Down

0 comments on commit e177f89

Please sign in to comment.