From 38c57d67c212c9caa60de06c02e38139446f52d5 Mon Sep 17 00:00:00 2001 From: Jakub Kabza Date: Fri, 30 Aug 2019 13:47:27 +0200 Subject: [PATCH] fix bug: --- controllers/oauth2client_controller.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/controllers/oauth2client_controller.go b/controllers/oauth2client_controller.go index 74a2d89..28bb18c 100644 --- a/controllers/oauth2client_controller.go +++ b/controllers/oauth2client_controller.go @@ -115,14 +115,16 @@ func (r *OAuth2ClientReconciler) registerOAuth2Client(ctx context.Context, clien }, } - err = r.Create(ctx, &clientSecret) - if err != nil { - return err - } - - client.Status.Secret = &clientSecret.Name client.Status.ClientID = created.ClientID client.Status.ObservedGeneration = client.Generation + + err = r.Create(ctx, &clientSecret) + if err != nil { + r.Log.Error(err, fmt.Sprintf("registering client %s/%s failed", client.Name, client.Namespace), "oauth2client", "register") + } else { + client.Status.Secret = &clientSecret.Name + } + return r.Status().Update(ctx, client) }