Skip to content

Commit 252ff99

Browse files
committed
Fix patch errors not being logged
1 parent e2f1a48 commit 252ff99

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func (r *KubeadmConfigReconciler) SetupWithManager(ctx context.Context, mgr ctrl
141141
func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, rerr error) {
142142
log := ctrl.LoggerFrom(ctx)
143143

144-
// Lookup the kubeadm config
144+
// Look up the kubeadm config
145145
config := &bootstrapv1.KubeadmConfig{}
146146
if err := r.Client.Get(ctx, req.NamespacedName, config); err != nil {
147147
if apierrors.IsNotFound(err) {
@@ -225,10 +225,7 @@ func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques
225225
patchOpts = append(patchOpts, patch.WithStatusObservedGeneration{})
226226
}
227227
if err := patchHelper.Patch(ctx, config, patchOpts...); err != nil {
228-
log.Error(rerr, "Failed to patch config")
229-
if rerr == nil {
230-
rerr = err
231-
}
228+
rerr = kerrors.NewAggregate([]error{rerr, errors.Wrapf(err, "failed to patch %s", klog.KObj(config))})
232229
}
233230
}()
234231

0 commit comments

Comments
 (0)