Merge pull request #121059 from matte21/improve_err_message_in_cpu_assignments

Improve error message in Kubelet CPU assignment logic
This commit is contained in:
Kubernetes Prow Robot 2023-10-16 16:48:54 +02:00 committed by GitHub
commit c7d270302c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -453,7 +453,7 @@ func takeByTopologyNUMAPacked(topo *topology.CPUTopology, availableCPUs cpuset.C
return acc.result, nil
}
if acc.isFailed() {
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request")
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request: requested=%d, available=%d", numCPUs, availableCPUs.Size())
}
// Algorithm: topology-aware best-fit
@ -565,7 +565,7 @@ func takeByTopologyNUMADistributed(topo *topology.CPUTopology, availableCPUs cpu
return acc.result, nil
}
if acc.isFailed() {
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request")
return cpuset.New(), fmt.Errorf("not enough cpus available to satisfy request: requested=%d, available=%d", numCPUs, availableCPUs.Size())
}
// Get the list of NUMA nodes represented by the set of CPUs in 'availableCPUs'.

View File

@ -522,7 +522,7 @@ func commonTakeByTopologyTestCases(t *testing.T) []takeByTopologyTestCase {
topoSingleSocketHT,
cpuset.New(0, 2, 4, 6),
5,
"not enough cpus available to satisfy request",
"not enough cpus available to satisfy request: requested=5, available=4",
cpuset.New(),
},
{

View File

@ -399,7 +399,7 @@ func TestStaticPolicyAdd(t *testing.T) {
stAssignments: state.ContainerCPUAssignments{},
stDefaultCPUSet: cpuset.New(0, 1, 2, 3, 4, 5, 6, 7),
pod: makePod("fakePod", "fakeContainer2", "8000m", "8000m"),
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=8, available=7"),
expCPUAlloc: false,
expCSet: cpuset.New(),
},
@ -429,7 +429,7 @@ func TestStaticPolicyAdd(t *testing.T) {
},
stDefaultCPUSet: cpuset.New(0, 4, 5, 6, 7, 8, 9, 10, 11),
pod: makePod("fakePod", "fakeContainer5", "10000m", "10000m"),
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=10, available=8"),
expCPUAlloc: false,
expCSet: cpuset.New(),
},
@ -444,7 +444,7 @@ func TestStaticPolicyAdd(t *testing.T) {
},
stDefaultCPUSet: cpuset.New(0, 7),
pod: makePod("fakePod", "fakeContainer5", "2000m", "2000m"),
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=2, available=1"),
expCPUAlloc: false,
expCSet: cpuset.New(),
},
@ -461,7 +461,7 @@ func TestStaticPolicyAdd(t *testing.T) {
},
stDefaultCPUSet: cpuset.New(10, 11, 53, 37, 55, 67, 52),
pod: makePod("fakePod", "fakeContainer5", "76000m", "76000m"),
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=76, available=7"),
expCPUAlloc: false,
expCSet: cpuset.New(),
},
@ -981,7 +981,7 @@ func TestStaticPolicyAddWithResvList(t *testing.T) {
stAssignments: state.ContainerCPUAssignments{},
stDefaultCPUSet: cpuset.New(0, 1, 2, 3, 4, 5, 6, 7),
pod: makePod("fakePod", "fakeContainer2", "8000m", "8000m"),
expErr: fmt.Errorf("not enough cpus available to satisfy request"),
expErr: fmt.Errorf("not enough cpus available to satisfy request: requested=8, available=7"),
expCPUAlloc: false,
expCSet: cpuset.New(),
},