Skip to content

Commit

Permalink
controller: report sync errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zimnx committed Nov 18, 2020
1 parent 4f58522 commit b2b50ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/controllers/cluster/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const (
// Messages to display when experiencing an error.
MessageHeadlessServiceSyncFailed = "Failed to sync Headless Service for cluster"
MessageMemberServicesSyncFailed = "Failed to sync MemberServices for cluster"
MessageUpdateStatusFailed = "Failed to update status for cluster"
MessageUpdateStatusFailed = "Failed to update status for cluster: %+v"
MessageCleanupFailed = "Failed to clean up cluster resources"
MessageClusterSyncFailed = "Failed to sync cluster, got error: %+v"
)
Expand Down Expand Up @@ -61,7 +61,7 @@ func (cc *ClusterReconciler) sync(c *scyllav1alpha1.ScyllaCluster) error {
// Update Status
logger.Info(ctx, "Calculating cluster status...")
if err := cc.updateStatus(ctx, c); err != nil {
cc.Recorder.Event(c, corev1.EventTypeWarning, naming.ErrSyncFailed, MessageUpdateStatusFailed)
cc.Recorder.Event(c, corev1.EventTypeWarning, naming.ErrSyncFailed, fmt.Sprintf(MessageUpdateStatusFailed, err))
return errors.Wrap(err, "failed to update status")
}

Expand All @@ -74,6 +74,7 @@ func (cc *ClusterReconciler) sync(c *scyllav1alpha1.ScyllaCluster) error {

if err != nil {
cc.Recorder.Event(c, corev1.EventTypeWarning, naming.ErrSyncFailed, fmt.Sprintf(MessageClusterSyncFailed, errors.Cause(err)))
return err
}

return nil
Expand Down

0 comments on commit b2b50ea

Please sign in to comment.