Skip to content

Commit

Permalink
fix: canary CRD message
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Dec 17, 2024
1 parent 50cf0f7 commit 976f21b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions pkg/jobs/canary/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func UpdateCanaryStatusAndEvent(ctx context.Context, canary v1.Canary, results [
var duration int64
var messages, errorMsgs []string
var failEvents []string
var msg string
var status v1.CanaryStatusCondition
var lastTransitionedTime *metav1.Time
var highestLatency float64
Expand Down Expand Up @@ -81,11 +80,8 @@ func UpdateCanaryStatusAndEvent(ctx context.Context, canary v1.Canary, results [
lastTransitionedTime = &metav1.Time{Time: transitionTime}
}

// Update status message
if len(messages) == 1 {
msg = messages[0]
} else if len(messages) > 1 {
msg = fmt.Sprintf("%s, (%d more)", messages[0], len(messages)-1)
if result.Message != "" {
messages = append(messages, result.Message)
}

if result.Error != "" {
Expand All @@ -111,6 +107,13 @@ func UpdateCanaryStatusAndEvent(ctx context.Context, canary v1.Canary, results [
errMsg = fmt.Sprintf("%s, (%d more)", errorMsgs[0], len(errorMsgs)-1)
}

var msg string
if len(messages) == 1 {
msg = messages[0]
} else if len(messages) > 1 {
msg = fmt.Sprintf("%s, (%d more)", messages[0], len(messages)-1)
}

payload := CanaryStatusPayload{
Status: status,
CheckStatus: checkStatus,
Expand Down

0 comments on commit 976f21b

Please sign in to comment.