diff --git a/pkg/client/restconfig/restconfig.go b/pkg/client/restconfig/restconfig.go index 9a74f8b639..de80329630 100644 --- a/pkg/client/restconfig/restconfig.go +++ b/pkg/client/restconfig/restconfig.go @@ -117,7 +117,7 @@ func UpdateQPS(config *rest.Config) { flowControlEnabled, err := flowcontrol.IsEnabled(ctx, config) if err != nil { - klog.Warning("Failed to query apiserver to check for flow control enablement: %v", err) + klog.Warningf("Failed to query apiserver to check for flow control enablement: %v", err) // Default to the lower QPS limits. } if flowControlEnabled { diff --git a/pkg/parse/run.go b/pkg/parse/run.go index f5da03e27d..fe9f65003d 100644 --- a/pkg/parse/run.go +++ b/pkg/parse/run.go @@ -196,7 +196,7 @@ func run(ctx context.Context, p Parser, trigger string, state *reconcilerState) gs.lastUpdate = metav1.Now() var setSourceStatusErr error if state.needToSetSourceStatus(gs) { - klog.V(3).Info("Updating source status (before read): %#v", gs) + klog.V(3).Infof("Updating source status (before read): %#v", gs) setSourceStatusErr = p.setSourceStatus(ctx, gs) if setSourceStatusErr == nil { state.sourceStatus = gs @@ -219,7 +219,7 @@ func run(ctx context.Context, p Parser, trigger string, state *reconcilerState) if os.IsNotExist(err) || (err == nil && hydrate.DoneCommit(doneFilePath) != gs.commit) { rs.message = RenderingInProgress rs.lastUpdate = metav1.Now() - klog.V(3).Info("Updating rendering status (before read): %#v", rs) + klog.V(3).Infof("Updating rendering status (before read): %#v", rs) setRenderingStatusErr := p.setRenderingStatus(ctx, state.renderingStatus, rs) if setRenderingStatusErr == nil { state.reset() @@ -235,7 +235,7 @@ func run(ctx context.Context, p Parser, trigger string, state *reconcilerState) rs.message = RenderingFailed rs.lastUpdate = metav1.Now() rs.errs = status.InternalHydrationError(err, "unable to read the done file: %s", doneFilePath) - klog.V(3).Info("Updating rendering status (before read): %#v", rs) + klog.V(3).Infof("Updating rendering status (before read): %#v", rs) setRenderingStatusErr := p.setRenderingStatus(ctx, state.renderingStatus, rs) if setRenderingStatusErr == nil { state.renderingStatus = rs @@ -299,7 +299,7 @@ func read(ctx context.Context, p Parser, trigger string, state *reconcilerState, hydrationStatus.lastUpdate = metav1.Now() // update the rendering status before source status because the parser needs to // read and parse the configs after rendering is done and there might have errors. - klog.V(3).Info("Updating rendering status (after read): %#v", hydrationStatus) + klog.V(3).Infof("Updating rendering status (after read): %#v", hydrationStatus) setRenderingStatusErr := p.setRenderingStatus(ctx, state.renderingStatus, hydrationStatus) if setRenderingStatusErr == nil { state.renderingStatus = hydrationStatus @@ -319,7 +319,7 @@ func read(ctx context.Context, p Parser, trigger string, state *reconcilerState, sourceStatus.lastUpdate = metav1.Now() var setSourceStatusErr error if state.needToSetSourceStatus(sourceStatus) { - klog.V(3).Info("Updating source status (after read): %#v", sourceStatus) + klog.V(3).Infof("Updating source status (after read): %#v", sourceStatus) setSourceStatusErr := p.setSourceStatus(ctx, sourceStatus) if setSourceStatusErr == nil { state.sourceStatus = sourceStatus @@ -462,7 +462,7 @@ func parseAndUpdate(ctx context.Context, p Parser, trigger string, state *reconc lastUpdate: metav1.Now(), } if state.needToSetSourceStatus(newSourceStatus) { - klog.V(3).Info("Updating source status (after parse): %#v", newSourceStatus) + klog.V(3).Infof("Updating source status (after parse): %#v", newSourceStatus) if err := p.setSourceStatus(ctx, newSourceStatus); err != nil { // If `p.setSourceStatus` fails, we terminate the reconciliation. // If we call `update` in this case and `update` succeeds, `Status.Source.Commit` would end up be older diff --git a/pkg/reconcilermanager/controllers/reposync_controller.go b/pkg/reconcilermanager/controllers/reposync_controller.go index dd084231cb..f1927483d5 100644 --- a/pkg/reconcilermanager/controllers/reposync_controller.go +++ b/pkg/reconcilermanager/controllers/reposync_controller.go @@ -717,7 +717,7 @@ func (r *RepoSyncReconciler) mapConfigMapToRepoSyncs(obj client.Object) []reconc ctx := context.Background() repoSyncList := &v1beta1.RepoSyncList{} if err := r.client.List(ctx, repoSyncList, &client.ListOptions{Namespace: objRef.Namespace}); err != nil { - klog.Error("failed to list RepoSyncs for %s (%s): %v", + klog.Errorf("failed to list RepoSyncs for %s (%s): %v", obj.GetObjectKind().GroupVersionKind().Kind, objRef, err) return nil } diff --git a/pkg/reconcilermanager/controllers/rootsync_controller.go b/pkg/reconcilermanager/controllers/rootsync_controller.go index 5244e30d00..ef66fec4f2 100644 --- a/pkg/reconcilermanager/controllers/rootsync_controller.go +++ b/pkg/reconcilermanager/controllers/rootsync_controller.go @@ -494,7 +494,7 @@ func (r *RootSyncReconciler) mapConfigMapsToRootSyncs(obj client.Object) []recon ctx := context.Background() rootSyncList := &v1beta1.RootSyncList{} if err := r.client.List(ctx, rootSyncList, &client.ListOptions{Namespace: objRef.Namespace}); err != nil { - klog.Error("failed to list RootSyncs for %s: %v", kinds.ObjectSummary(obj), err) + klog.Errorf("failed to list RootSyncs for %s: %v", kinds.ObjectSummary(obj), err) return nil } var requests []reconcile.Request @@ -557,7 +557,7 @@ func (r *RootSyncReconciler) mapObjectToRootSync(obj client.Object) []reconcile. allRootSyncs := &v1beta1.RootSyncList{} if err := r.client.List(context.Background(), allRootSyncs); err != nil { - klog.Error("failed to list all RootSyncs for %s (%s): %v", + klog.Errorf("failed to list all RootSyncs for %s (%s): %v", obj.GetObjectKind().GroupVersionKind().Kind, objRef, err) return nil } diff --git a/pkg/syncer/reconcile/apply.go b/pkg/syncer/reconcile/apply.go index c0f8eb9c8a..4686fed35f 100644 --- a/pkg/syncer/reconcile/apply.go +++ b/pkg/syncer/reconcile/apply.go @@ -124,7 +124,7 @@ func (c *clientApplier) Create(ctx context.Context, intendedState *unstructured. } logErr, err := c.fights.DetectFight(time.Now(), intendedState) if logErr { - klog.Error("Fight detected on create of %s.", description(intendedState)) + klog.Errorf("Fight detected on create of %s.", description(intendedState)) } if err == nil { klog.V(3).Infof("Created object %v", core.GKNN(intendedState))