Skip to content

Commit

Permalink
Merge pull request openshift#2728 from kikisdeliveryservice/event-on-…
Browse files Browse the repository at this point in the history
…degraded

Bug 1955300: operator: add event on degraded and unavailable status
  • Loading branch information
openshift-merge-robot authored Aug 20, 2021
2 parents 9b6d044 + 8c3384a commit 4ca373b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/operator/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ func (optr *Operator) syncAvailableStatus() error {
if degraded {
available = configv1.ConditionFalse
message = fmt.Sprintf("Cluster not available for %s", optrVersion)
mcoObjectRef := &corev1.ObjectReference{
Kind: co.Kind,
Name: co.Name,
Namespace: co.Namespace,
UID: co.GetUID(),
}

optr.eventRecorder.Eventf(mcoObjectRef, corev1.EventTypeWarning, "OperatorNotAvailable", message)
}

coStatus := configv1.ClusterOperatorStatusCondition{
Expand Down Expand Up @@ -219,6 +227,14 @@ func (optr *Operator) syncDegradedStatus(ierr syncError) (err error) {
message = fmt.Sprintf("Unable to apply %s: %v", optrVersion, ierr.err.Error())
}
reason = ierr.task + "Failed"
mcoObjectRef := &corev1.ObjectReference{
Kind: co.Kind,
Name: co.Name,
Namespace: co.Namespace,
UID: co.GetUID(),
}
degradedReason := fmt.Sprintf("OperatorDegraded: %s", reason)
optr.eventRecorder.Eventf(mcoObjectRef, corev1.EventTypeWarning, degradedReason, message)

// set progressing
if cov1helpers.IsStatusConditionTrue(co.Status.Conditions, configv1.OperatorProgressing) {
Expand Down

0 comments on commit 4ca373b

Please sign in to comment.