Skip to content

Commit

Permalink
Report when backoff limit is exceeded
Browse files Browse the repository at this point in the history
Depends-On: openstack-k8s-operators/lib-common#504

Signed-off-by: Fabricio Aguiar <[email protected]>
  • Loading branch information
fao89 committed May 28, 2024
1 parent c6e11d8 commit d9425cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions controllers/openstack_ansibleee_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,17 @@ func (r *OpenStackAnsibleEEReconciler) Reconcile(ctx context.Context, req ctrl.R
}

if err != nil {
var errorReason condition.Reason
errorReason = condition.ErrorReason
severity := condition.SeverityWarning
if ansibleeeJob.HasReachedLimit() {
errorReason = condition.JobReasonBackoffLimitExceeded
severity = condition.SeverityError
}
instance.Status.Conditions.Set(condition.FalseCondition(
condition.JobReadyCondition,
condition.ErrorReason,
condition.SeverityWarning,
errorReason,
severity,
condition.JobReadyErrorMessage,
err.Error()))
instance.Status.JobStatus = ansibleeev1.JobStatusFailed
Expand Down
8 changes: 4 additions & 4 deletions tests/kuttl/tests/run_failed_playbook/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ status:
conditions:
- message: 'Job error occurred Internal error occurred: Job has reached the specified backoff limit.
Check job logs'
reason: Error
severity: Warning
reason: BackoffLimitExceeded
severity: Error
status: "False"
type: Ready
- message: 'Job error occurred Internal error occurred: Job has reached the specified backoff limit.
Check job logs'
reason: Error
severity: Warning
reason: BackoffLimitExceeded
severity: Error
status: "False"
type: JobReady
---
Expand Down

0 comments on commit d9425cc

Please sign in to comment.