From f8b68a809f9af3ab732c997b9ad70fb6ee46f34d Mon Sep 17 00:00:00 2001 From: Ali <83188384+testA113@users.noreply.github.com> Date: Mon, 26 Feb 2024 09:20:59 +1300 Subject: [PATCH] fix(app): parse nan in validation check [EE-6714] (#11247) --- .../resourceReservationValidation.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts b/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts index 6efe8ba37..2648b9253 100644 --- a/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts +++ b/app/react/kubernetes/applications/components/ResourceReservationFormSection/resourceReservationValidation.ts @@ -99,6 +99,8 @@ function hasSuitableNode( cpuLimit: number, nodeLimits: NodesLimits ) { + const nanParsedMemoryLimit = Number.isNaN(memoryLimit) ? 0 : memoryLimit; + const nanParsedCPULimit = Number.isNaN(cpuLimit) ? 0 : cpuLimit; // transform the nodelimits from bytes to MB const limits = Object.values(nodeLimits).map((nodeLimit) => ({ ...nodeLimit, @@ -108,6 +110,8 @@ function hasSuitableNode( })); // make sure there's a node available with enough memory and cpu return limits.some( - (nodeLimit) => nodeLimit.Memory >= memoryLimit && nodeLimit.CPU >= cpuLimit + (nodeLimit) => + nodeLimit.Memory >= nanParsedMemoryLimit && + nodeLimit.CPU >= nanParsedCPULimit ); }