Skip to content

Commit 6de4dca

Browse files
authored
OCPBUGS-34972: perfprof: bump verbosiness of logs (#1075)
Increase the verbosiness required to emit log messages to reduce the log amount. Note this change doesn't address the reason for periodic reconciles, we only review the verbosiness of log messages. Signed-off-by: Francesco Romani <[email protected]>
1 parent a228c4a commit 6de4dca

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

pkg/performanceprofile/controller/performanceprofile/components/handler/handler.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func (h *handler) Apply(ctx context.Context, obj client.Object, recorder record.
4242
}
4343

4444
if profileutil.IsPaused(profile) {
45+
// this is expected to be exceptional, hence we omit V()
4546
klog.Infof("Ignoring reconcile loop for pause performance profile %s", profile.Name)
4647
return nil
4748
}
@@ -50,7 +51,7 @@ func (h *handler) Apply(ctx context.Context, obj client.Object, recorder record.
5051
if err != nil {
5152
return fmt.Errorf("could not determine high-performance runtime class container-runtime for profile %q; %w", profile.Name, err)
5253
}
53-
klog.Infof("using %q as high-performance runtime class container-runtime for profile %q", ctrRuntime, profile.Name)
54+
klog.V(2).Infof("using %q as high-performance runtime class container-runtime for profile %q", ctrRuntime, profile.Name)
5455

5556
opts.MachineConfig.DefaultRuntime = ctrRuntime
5657
components, err := manifestset.GetNewComponents(profile, opts)
@@ -146,23 +147,23 @@ func (h *handler) Delete(ctx context.Context, profileName string) error {
146147
func (h *handler) Exists(ctx context.Context, profileName string) bool {
147148
tunedName := components.GetComponentName(profileName, components.ProfileNamePerformance)
148149
if _, err := resources.GetTuned(ctx, h.Client, tunedName, components.NamespaceNodeTuningOperator); !k8serros.IsNotFound(err) {
149-
klog.Infof("Tuned %q custom resource is still exists in the namespace %q", tunedName, components.NamespaceNodeTuningOperator)
150+
klog.V(1).Infof("Tuned %q custom resource is still exists in the namespace %q", tunedName, components.NamespaceNodeTuningOperator)
150151
return true
151152
}
152153

153154
name := components.GetComponentName(profileName, components.ComponentNamePrefix)
154155
if _, err := resources.GetKubeletConfig(ctx, h.Client, name); !k8serros.IsNotFound(err) {
155-
klog.Infof("Kubelet Config %q exists in the cluster", name)
156+
klog.V(1).Infof("Kubelet Config %q exists in the cluster", name)
156157
return true
157158
}
158159

159160
if _, err := resources.GetRuntimeClass(ctx, h.Client, name); !k8serros.IsNotFound(err) {
160-
klog.Infof("Runtime class %q exists in the cluster", name)
161+
klog.V(1).Infof("Runtime class %q exists in the cluster", name)
161162
return true
162163
}
163164

164165
if _, err := resources.GetMachineConfig(ctx, h.Client, machineconfig.GetMachineConfigName(profileName)); !k8serros.IsNotFound(err) {
165-
klog.Infof("Machine Config %q exists in the cluster", name)
166+
klog.V(1).Infof("Machine Config %q exists in the cluster", name)
166167
return true
167168
}
168169
return false
@@ -192,7 +193,7 @@ func (h *handler) getContainerRuntimeName(ctx context.Context, profile *performa
192193
}
193194

194195
if len(ctrcfgs) == 0 {
195-
klog.Infof("no ContainerRuntimeConfig found that matches MCP labels %s that associated with performance profile %q; using default container runtime", mcpSetLabels.String(), profile.Name)
196+
klog.V(1).Infof("no ContainerRuntimeConfig found that matches MCP labels %s that associated with performance profile %q; using default container runtime", mcpSetLabels.String(), profile.Name)
196197
return mcov1.ContainerRuntimeDefaultRuntimeRunc, nil
197198
}
198199

pkg/performanceprofile/controller/performanceprofile/resources/resources.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func GetClusterOperator(ctx context.Context, cli client.Client) (*apiconfigv1.Cl
8383
func CreateOrUpdateMachineConfig(ctx context.Context, cli client.Client, mc *mcov1.MachineConfig) error {
8484
_, err := GetMachineConfig(ctx, cli, mc.Name)
8585
if errors.IsNotFound(err) {
86-
klog.Infof("Create machine-config %q", mc.Name)
86+
klog.V(1).Infof("Create machine-config %q", mc.Name)
8787
if err := cli.Create(ctx, mc); err != nil {
8888
return err
8989
}
@@ -94,7 +94,7 @@ func CreateOrUpdateMachineConfig(ctx context.Context, cli client.Client, mc *mco
9494
return err
9595
}
9696

97-
klog.Infof("Update machine-config %q", mc.Name)
97+
klog.V(2).Infof("Update machine-config %q", mc.Name)
9898
return cli.Update(ctx, mc)
9999
}
100100

@@ -162,7 +162,7 @@ func GetMutatedKubeletConfig(ctx context.Context, cli client.Client, kc *mcov1.K
162162
func CreateOrUpdateKubeletConfig(ctx context.Context, cli client.Client, kc *mcov1.KubeletConfig) error {
163163
_, err := GetKubeletConfig(ctx, cli, kc.Name)
164164
if errors.IsNotFound(err) {
165-
klog.Infof("Create kubelet-config %q", kc.Name)
165+
klog.V(1).Infof("Create kubelet-config %q", kc.Name)
166166
if err := cli.Create(ctx, kc); err != nil {
167167
return err
168168
}
@@ -173,7 +173,7 @@ func CreateOrUpdateKubeletConfig(ctx context.Context, cli client.Client, kc *mco
173173
return err
174174
}
175175

176-
klog.Infof("Update kubelet-config %q", kc.Name)
176+
klog.V(2).Infof("Update kubelet-config %q", kc.Name)
177177
return cli.Update(ctx, kc)
178178
}
179179

@@ -232,7 +232,7 @@ func CreateOrUpdateTuned(ctx context.Context, cli client.Client, tuned *tunedv1.
232232

233233
_, err := GetTuned(ctx, cli, tuned.Name, tuned.Namespace)
234234
if errors.IsNotFound(err) {
235-
klog.Infof("Create tuned %q under the namespace %q", tuned.Name, tuned.Namespace)
235+
klog.V(1).Infof("Create tuned %q in the namespace %q", tuned.Name, tuned.Namespace)
236236
if err := cli.Create(ctx, tuned); err != nil {
237237
return err
238238
}
@@ -243,7 +243,7 @@ func CreateOrUpdateTuned(ctx context.Context, cli client.Client, tuned *tunedv1.
243243
return err
244244
}
245245

246-
klog.Infof("Update tuned %q under the namespace %q", tuned.Name, tuned.Namespace)
246+
klog.V(2).Infof("Update tuned %q in the namespace %q", tuned.Name, tuned.Namespace)
247247
return cli.Update(ctx, tuned)
248248
}
249249

@@ -320,7 +320,7 @@ func GetMutatedRuntimeClass(ctx context.Context, cli client.Client, runtimeClass
320320
func CreateOrUpdateRuntimeClass(ctx context.Context, cli client.Client, runtimeClass *nodev1.RuntimeClass) error {
321321
_, err := GetRuntimeClass(ctx, cli, runtimeClass.Name)
322322
if errors.IsNotFound(err) {
323-
klog.Infof("Create runtime class %q", runtimeClass.Name)
323+
klog.V(1).Infof("Create runtime class %q", runtimeClass.Name)
324324
if err := cli.Create(ctx, runtimeClass); err != nil {
325325
return err
326326
}
@@ -331,7 +331,7 @@ func CreateOrUpdateRuntimeClass(ctx context.Context, cli client.Client, runtimeC
331331
return err
332332
}
333333

334-
klog.Infof("Update runtime class %q", runtimeClass.Name)
334+
klog.V(2).Infof("Update runtime class %q", runtimeClass.Name)
335335
return cli.Update(ctx, runtimeClass)
336336
}
337337

pkg/performanceprofile/controller/performanceprofile/status/writer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package status
33
import (
44
"context"
55
"fmt"
6+
67
"github.com/openshift/cluster-node-tuning-operator/pkg/performanceprofile/controller/performanceprofile/resources"
78

89
"k8s.io/apimachinery/pkg/types"
@@ -128,6 +129,6 @@ func (w *writer) update(ctx context.Context, profile *performancev2.PerformanceP
128129
return nil
129130
}
130131

131-
klog.Infof("Updating the performance profile %q status", profile.Name)
132+
klog.V(4).Infof("Updating the performance profile %q status", profile.Name)
132133
return w.Client.Status().Update(ctx, profileCopy)
133134
}

pkg/performanceprofile/controller/performanceprofile_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func (r *PerformanceProfileReconciler) ctrRuntimeConfToPerformanceProfile(ctx co
290290
klog.Errorf("failed to get container runtime config; name=%q err=%v", ctrRuntimeConfObj.GetName(), err)
291291
return nil
292292
}
293-
klog.Infof("reconciling from ContainerRuntimeConfig %q", ctrcfg.Name)
293+
klog.V(2).Infof("reconciling from ContainerRuntimeConfig %q", ctrcfg.Name)
294294

295295
selector, err := metav1.LabelSelectorAsSelector(ctrcfg.Spec.MachineConfigPoolSelector)
296296
if err != nil {
@@ -309,7 +309,7 @@ func (r *PerformanceProfileReconciler) ctrRuntimeConfToPerformanceProfile(ctx co
309309
return nil
310310
}
311311

312-
klog.Infof("reconciling from ContainerRuntimeConfig %q selector %v: %d MCPs", ctrcfg.Name, ctrcfg.Spec.MachineConfigPoolSelector, len(mcps.Items))
312+
klog.V(2).Infof("reconciling from ContainerRuntimeConfig %q selector %v: %d MCPs", ctrcfg.Name, ctrcfg.Spec.MachineConfigPoolSelector, len(mcps.Items))
313313

314314
profiles := &performancev2.PerformanceProfileList{}
315315
err = r.List(ctx, profiles)
@@ -383,7 +383,7 @@ func (r *PerformanceProfileReconciler) Reconcile(ctx context.Context, req ctrl.R
383383
operatorReleaseVersion := os.Getenv("RELEASE_VERSION")
384384
operandReleaseVersion := operatorv1helpers.FindOperandVersion(co.Status.Versions, tunedv1.TunedOperandName)
385385
if operandReleaseVersion == nil || operatorReleaseVersion != operandReleaseVersion.Version {
386-
// Upgrade in progress
386+
// Upgrade in progress. Should happen rarely, so we omit V()
387387
klog.Infof("operator and operand release versions do not match")
388388
return reconcile.Result{RequeueAfter: 10 * time.Second}, nil
389389
}

0 commit comments

Comments
 (0)