Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions checks/runchecks.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,21 @@ func RunChecks(ctx *context.Context) []*pkg.CheckResult {

func transformResults(ctx *context.Context, in []*pkg.CheckResult) (out []*pkg.CheckResult) {
for _, r := range in {
// If check fails, do not apply transform
if !r.Pass {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!pass doesn't necessarily means it failed to connect - it could have failed a threshold, response code/body check etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through the checks code and all the errors are raised via .Failf or .ErrorMessage (which calls .Failf inside) all of which sets pass = false.

If not for r.Pass, what should we check against ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add another field called Error = true that ErrorMessage sets - however we might need to update some of the checks to use ErrorMessage instead of Failf for connection errors

out = append(out, r)
continue
}

transformed, err := transform(ctx, r)
if err != nil {
r.Failf("transformation failure: %v", err)
out = append(out, r)
} else {
for _, t := range transformed {
out = append(out, processTemplates(ctx, t))
}
continue
}

for _, t := range transformed {
out = append(out, processTemplates(ctx, t))
}
}
return out
Expand Down
8 changes: 4 additions & 4 deletions pkg/controllers/canary_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ func (r *CanaryReconciler) Report() {
canary.Status.Status = &v1.Failed
}

for _, eventMsg := range payload.FailEvents {
r.Events.Event(&canary, corev1.EventTypeWarning, "Failed", eventMsg)
}

if err := r.Status().Update(gocontext.Background(), &canary); err != nil {
r.Log.Error(err, "failed to update status", "canary", canary.Name)
}

for _, eventMsg := range payload.FailEvents {
r.Events.Event(&canary, corev1.EventTypeWarning, "Failed", eventMsg)
}
}
}

Expand Down