diff --git a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go index 18e1fce5716d..53eb5c4c8220 100644 --- a/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go +++ b/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go @@ -141,7 +141,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, rerr error) { log := ctrl.LoggerFrom(ctx) - // Lookup the kubeadm config + // Look up the kubeadm config config := &bootstrapv1.KubeadmConfig{} if err := r.Client.Get(ctx, req.NamespacedName, config); err != nil { if apierrors.IsNotFound(err) { @@ -225,10 +225,7 @@ func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques patchOpts = append(patchOpts, patch.WithStatusObservedGeneration{}) } if err := patchHelper.Patch(ctx, config, patchOpts...); err != nil { - log.Error(rerr, "Failed to patch config") - if rerr == nil { - rerr = err - } + rerr = kerrors.NewAggregate([]error{rerr, errors.Wrapf(err, "failed to patch %s", klog.KObj(config))}) } }()