Skip to content

Commit

Permalink
Merge pull request #218 from openshift-kni/kni-score-fix-logging-4.14
Browse files Browse the repository at this point in the history
[KNI][release-4.14] score: fix logging of found NRT objects
  • Loading branch information
ffromani authored Jun 25, 2024
2 parents 2e784b2 + ca2f3d0 commit 986716a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
17 changes: 0 additions & 17 deletions pkg/noderesourcetopology/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,10 @@ limitations under the License.
package noderesourcetopology

import (
"encoding/json"
"fmt"

"k8s.io/klog/v2"

topologyv1alpha2 "github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/apis/topology/v1alpha2"

"sigs.k8s.io/scheduler-plugins/pkg/noderesourcetopology/stringify"
)

Expand All @@ -33,17 +30,3 @@ func logNumaNodes(desc, nodeName string, nodes NUMANodeList) {
klog.V(6).InfoS(desc, stringify.ResourceListToLoggable(numaLogKey, numaNode.Resources)...)
}
}

func logNRT(desc string, nrtObj *topologyv1alpha2.NodeResourceTopology) {
if !klog.V(6).Enabled() {
// avoid the expensive marshal operation
return
}

ntrJson, err := json.MarshalIndent(nrtObj, "", " ")
if err != nil {
klog.V(6).ErrorS(err, "failed to marshal noderesourcetopology object")
return
}
klog.V(6).Info(desc, "noderesourcetopology", string(ntrJson))
}
3 changes: 2 additions & 1 deletion pkg/noderesourcetopology/score.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
apiconfig "sigs.k8s.io/scheduler-plugins/apis/config"

topologyv1alpha2 "github.com/k8stopologyawareschedwg/noderesourcetopology-api/pkg/apis/topology/v1alpha2"
"sigs.k8s.io/scheduler-plugins/pkg/noderesourcetopology/stringify"
"sigs.k8s.io/scheduler-plugins/pkg/util"
)

Expand Down Expand Up @@ -74,7 +75,7 @@ func (tm *TopologyMatch) Score(ctx context.Context, state *framework.CycleState,
return 0, nil
}

logNRT("noderesourcetopology found", nodeTopology)
klog.V(6).Info("found object", "noderesourcetopology", stringify.NodeResourceTopologyResources(nodeTopology))

handler := tm.scoringHandlerFromTopologyManagerConfig(topologyManagerConfigFromNodeResourceTopology(nodeTopology))
if handler == nil {
Expand Down

0 comments on commit 986716a

Please sign in to comment.