Skip to content

Commit

Permalink
Track retries and backoff limit
Browse files Browse the repository at this point in the history
  • Loading branch information
fao89 committed May 8, 2024
1 parent 57cf568 commit b0674d0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions pkg/deployment/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,21 @@ func (d *Deployer) ConditionalDeploy(
}

if ansibleEE.Status.JobStatus == ansibleeev1.JobStatusFailed {
severity := condition.SeverityWarning
errorReason := condition.ErrorReason
errorMsg := fmt.Sprintf("attempt #%d - execution.name %s execution.namespace %s execution.status.jobstatus: %s", ansibleEE.Status.failed, ansibleEE.Name, ansibleEE.Namespace, ansibleEE.Status.JobStatus)
ansibleCondition := ansibleEE.Status.Conditions.Get(condition.JobReadyCondition)
if ansibleCondition.Reason == condition.JobReasonBackoffLimitExceeded {
severity = condition.SeverityError
errorReason = condition.JobReasonBackoffLimitExceeded
errorMsg = fmt.Sprintf("backoff limit reached for execution.name %s execution.namespace %s execution.status.jobstatus: %s", ansibleEE.Name, ansibleEE.Namespace, ansibleEE.Status.JobStatus)
}
log.Info(fmt.Sprintf("Condition %s error", readyCondition))
err = fmt.Errorf("execution.name %s Execution.namespace %s Execution.status.jobstatus: %s", ansibleEE.Name, ansibleEE.Namespace, ansibleEE.Status.JobStatus)
err = fmt.Errorf(errorMsg)
nsConditions.Set(condition.FalseCondition(
readyCondition,
condition.ErrorReason,
condition.SeverityError,
errorReason,
severity,
readyErrorMessage,
err.Error()))
}
Expand Down

0 comments on commit b0674d0

Please sign in to comment.