1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 23:09:41 +02:00

fix cpu parsing logic (#10808)

This commit is contained in:
Prabhat Khera 2023-12-12 15:35:36 +13:00 committed by GitHub
parent 6ff6fd7f75
commit 32d8dc311b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,9 +28,17 @@ class KubernetesResourceReservationHelper {
static parseCPU(cpu) {
let res = parseInt(cpu, 10);
if (_.endsWith(cpu, 'm')) {
// milli
res /= 1000;
} else if (_.endsWith(cpu, 'u')) {
// micro
res /= 1000000;
} else if (_.endsWith(cpu, 'n')) {
// nano
res /= 1000000000;
} else if (_.endsWith(cpu, 'p')) {
// pico
res /= 1000000000000;
}
return res;
}