Skip to content

Commit

Permalink
feat: Add event when the reconcile is failed (#879)
Browse files Browse the repository at this point in the history
* feat: Add event when the reconcile is failed

Signed-off-by: Ce Gao <[email protected]>

* fix: Use format

Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege authored and k8s-ci-robot committed Oct 14, 2019
1 parent d93b602 commit 8221592
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/controller.v1alpha3/trial/trial_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ func (r *ReconcileTrial) Reconcile(request reconcile.Request) (reconcile.Result,
err := r.reconcileTrial(instance)
if err != nil {
logger.Error(err, "Reconcile trial error")
r.recorder.Eventf(instance,
corev1.EventTypeWarning, ReconcileFailedReason,
"Failed to reconcile: %v", err)
return reconcile.Result{}, err
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/controller.v1alpha3/trial/trial_controller_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ const (
JobSucceededReason = "JobSucceeded"
JobMetricsUnavailableReason = "MetricsUnavailable"
JobFailedReason = "JobFailed"
ReconcileFailedReason = "ReconcileFailed"
)

0 comments on commit 8221592

Please sign in to comment.