From 802d0c4203687ca5b9cc5b803b098bcca958361b Mon Sep 17 00:00:00 2001 From: Chunyi Lyu Date: Thu, 25 Mar 2021 16:51:21 +0000 Subject: [PATCH] Publish event when failed to update secret status --- controllers/user_controller.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/user_controller.go b/controllers/user_controller.go index e5b49fc6..14342d55 100644 --- a/controllers/user_controller.go +++ b/controllers/user_controller.go @@ -233,7 +233,9 @@ func (r *UserReconciler) setUserStatus(ctx context.Context, user *topology.User) } user.Status.Credentials = credentials if err := r.Status().Update(ctx, user); err != nil { - logger.Error(err, "Failed to update secret status credentials", "user", user.Name, "secretRef", credentials) + msg := "Failed to update secret status credentials" + r.Recorder.Event(user, corev1.EventTypeWarning, "FailedStatusUpdate", msg) + logger.Error(err, msg, "user", user.Name, "secretRef", credentials) return err } logger.Info("Successfully updated secret status credentials", "user", user.Name, "secretRef", credentials)