Skip to content

Commit

Permalink
Merge pull request #9224 from AndiDog/logging-improvements
Browse files Browse the repository at this point in the history
🌱 Fix patch errors not being logged
  • Loading branch information
k8s-ci-robot committed Aug 17, 2023
2 parents f8764fe + 252ff99 commit 62d734c
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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))})
}
}()

Expand Down

0 comments on commit 62d734c

Please sign in to comment.