Skip to content

Commit

Permalink
OCPBUGS-34972: perfprof: bump verbosiness of logs (#1075)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ffromani authored Jun 11, 2024
1 parent a228c4a commit 6de4dca
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (h *handler) Apply(ctx context.Context, obj client.Object, recorder record.
}

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

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

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

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

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

if len(ctrcfgs) == 0 {
klog.Infof("no ContainerRuntimeConfig found that matches MCP labels %s that associated with performance profile %q; using default container runtime", mcpSetLabels.String(), profile.Name)
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)
return mcov1.ContainerRuntimeDefaultRuntimeRunc, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func GetClusterOperator(ctx context.Context, cli client.Client) (*apiconfigv1.Cl
func CreateOrUpdateMachineConfig(ctx context.Context, cli client.Client, mc *mcov1.MachineConfig) error {
_, err := GetMachineConfig(ctx, cli, mc.Name)
if errors.IsNotFound(err) {
klog.Infof("Create machine-config %q", mc.Name)
klog.V(1).Infof("Create machine-config %q", mc.Name)
if err := cli.Create(ctx, mc); err != nil {
return err
}
Expand All @@ -94,7 +94,7 @@ func CreateOrUpdateMachineConfig(ctx context.Context, cli client.Client, mc *mco
return err
}

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

Expand Down Expand Up @@ -162,7 +162,7 @@ func GetMutatedKubeletConfig(ctx context.Context, cli client.Client, kc *mcov1.K
func CreateOrUpdateKubeletConfig(ctx context.Context, cli client.Client, kc *mcov1.KubeletConfig) error {
_, err := GetKubeletConfig(ctx, cli, kc.Name)
if errors.IsNotFound(err) {
klog.Infof("Create kubelet-config %q", kc.Name)
klog.V(1).Infof("Create kubelet-config %q", kc.Name)
if err := cli.Create(ctx, kc); err != nil {
return err
}
Expand All @@ -173,7 +173,7 @@ func CreateOrUpdateKubeletConfig(ctx context.Context, cli client.Client, kc *mco
return err
}

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

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

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

klog.Infof("Update tuned %q under the namespace %q", tuned.Name, tuned.Namespace)
klog.V(2).Infof("Update tuned %q in the namespace %q", tuned.Name, tuned.Namespace)
return cli.Update(ctx, tuned)
}

Expand Down Expand Up @@ -320,7 +320,7 @@ func GetMutatedRuntimeClass(ctx context.Context, cli client.Client, runtimeClass
func CreateOrUpdateRuntimeClass(ctx context.Context, cli client.Client, runtimeClass *nodev1.RuntimeClass) error {
_, err := GetRuntimeClass(ctx, cli, runtimeClass.Name)
if errors.IsNotFound(err) {
klog.Infof("Create runtime class %q", runtimeClass.Name)
klog.V(1).Infof("Create runtime class %q", runtimeClass.Name)
if err := cli.Create(ctx, runtimeClass); err != nil {
return err
}
Expand All @@ -331,7 +331,7 @@ func CreateOrUpdateRuntimeClass(ctx context.Context, cli client.Client, runtimeC
return err
}

klog.Infof("Update runtime class %q", runtimeClass.Name)
klog.V(2).Infof("Update runtime class %q", runtimeClass.Name)
return cli.Update(ctx, runtimeClass)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package status
import (
"context"
"fmt"

"github.com/openshift/cluster-node-tuning-operator/pkg/performanceprofile/controller/performanceprofile/resources"

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

klog.Infof("Updating the performance profile %q status", profile.Name)
klog.V(4).Infof("Updating the performance profile %q status", profile.Name)
return w.Client.Status().Update(ctx, profileCopy)
}
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (r *PerformanceProfileReconciler) ctrRuntimeConfToPerformanceProfile(ctx co
klog.Errorf("failed to get container runtime config; name=%q err=%v", ctrRuntimeConfObj.GetName(), err)
return nil
}
klog.Infof("reconciling from ContainerRuntimeConfig %q", ctrcfg.Name)
klog.V(2).Infof("reconciling from ContainerRuntimeConfig %q", ctrcfg.Name)

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

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

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

0 comments on commit 6de4dca

Please sign in to comment.