From 563213a69946f44085dbcf918fa9b774f6098221 Mon Sep 17 00:00:00 2001 From: Andreas Sommer Date: Mon, 15 Jan 2024 10:09:11 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Vince Prignano --- .../kubeadm/internal/controllers/kubeadmconfig_controller.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go index 97d4e5b42eaf..5e18e841d737 100644 --- a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go @@ -350,9 +350,8 @@ func (r *KubeadmConfigReconciler) refreshBootstrapTokenIfNeeded(ctx context.Cont // Extend TTL for existing token newExpiration := time.Now().UTC().Add(r.TokenTTL).Format(time.RFC3339) secret.Data[bootstrapapi.BootstrapTokenExpirationKey] = []byte(newExpiration) - log.Info("Refreshing token until the infrastructure has a chance to consume it", "oldExpiration", secretExpiration, "newExpiration", newExpiration) - err = remoteClient.Update(ctx, secret) - if err != nil { + log.Info("Bootstrap data hasn't yet been consumed by an infrastructure provider; refreshing token", "oldExpiration", secretExpiration, "newExpiration", newExpiration) + if err := remoteClient.Update(ctx, secret); err != nil { return ctrl.Result{}, errors.Wrapf(err, "failed to refresh bootstrap token") } return ctrl.Result{