Skip to content

Commit

Permalink
adjust comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrove-oss committed Sep 16, 2024
1 parent 53a0b0c commit 391423a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/cluster-checker/checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ function reservation (pod) {
return gpus
}

// check container resource requests against node_resources
function checkContainerResources(namespace, workload, container) {
// selectively merge limits into requests
const resources = {}
for (const k in container.resources?.requests ?? []) {
resources[k] = container.resources.requests[k]
Expand All @@ -164,7 +166,7 @@ function checkContainerResources(namespace, workload, container) {
const cpus = k8srp.cpuParser(resources['cpu'] ?? '0')
const mem = k8srp.memoryParser(resources['memory'] ?? '0')

// Check that resources will fit on a node
// warn if the resource requests cannot be satisfied by a Node
if (gpus > nodeResources['nvidia.com/gpu']) {
console.log(`WARNING: workload "${namespace.metadata.name}/${workload.metadata.name}" has a container requesting "${gpus} GPUs"`)
}
Expand All @@ -178,7 +180,7 @@ function checkContainerResources(namespace, workload, container) {
console.log(`WARNING: workload "${namespace.metadata.name}/${workload.metadata.name}" has a container requesting ${resources['memory']} memory`)
}

// Check that resource:GPU ratio is proportional
// warn if the resource:GPU ratio is not proportional to Node resources
if (gdr > 0 && ((gpus == 0) || (gpus/gdr < nodeResources['nvidia.com/gpu']/nodeResources['nvidia.com/roce_gdr']))) {
console.log(`WARNING: workload "${namespace.metadata.name}/${workload.metadata.name}" has a container requesting ${gdr} roce_gdr but only ${gpus} GPUs`)
}
Expand Down

0 comments on commit 391423a

Please sign in to comment.