mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 23:39:41 +02:00
fix(app): parse nan in validation check [EE-6714] (#11246)
This commit is contained in:
parent
3caf1ddb7d
commit
f6beedf0d5
1 changed files with 5 additions and 1 deletions
|
@ -99,6 +99,8 @@ function hasSuitableNode(
|
||||||
cpuLimit: number,
|
cpuLimit: number,
|
||||||
nodeLimits: NodesLimits
|
nodeLimits: NodesLimits
|
||||||
) {
|
) {
|
||||||
|
const nanParsedMemoryLimit = Number.isNaN(memoryLimit) ? 0 : memoryLimit;
|
||||||
|
const nanParsedCPULimit = Number.isNaN(cpuLimit) ? 0 : cpuLimit;
|
||||||
// transform the nodelimits from bytes to MB
|
// transform the nodelimits from bytes to MB
|
||||||
const limits = Object.values(nodeLimits).map((nodeLimit) => ({
|
const limits = Object.values(nodeLimits).map((nodeLimit) => ({
|
||||||
...nodeLimit,
|
...nodeLimit,
|
||||||
|
@ -108,6 +110,8 @@ function hasSuitableNode(
|
||||||
}));
|
}));
|
||||||
// make sure there's a node available with enough memory and cpu
|
// make sure there's a node available with enough memory and cpu
|
||||||
return limits.some(
|
return limits.some(
|
||||||
(nodeLimit) => nodeLimit.Memory >= memoryLimit && nodeLimit.CPU >= cpuLimit
|
(nodeLimit) =>
|
||||||
|
nodeLimit.Memory >= nanParsedMemoryLimit &&
|
||||||
|
nodeLimit.CPU >= nanParsedCPULimit
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue