refactor: remove calculation and pass resources as the docker api expect

This commit is contained in:
Mauricio Siu
2024-12-14 20:38:33 -06:00
parent a63981fa15
commit 7521bc8297

View File

@@ -317,16 +317,12 @@ export const calculateResources = ({
}: Resources): ResourceRequirements => {
return {
Limits: {
MemoryBytes: memoryLimit ? memoryLimit * 1024 * 1024 : undefined,
NanoCPUs: cpuLimit ? (cpuLimit || 1) * 1000 * 1000 * 1000 : undefined,
MemoryBytes: memoryLimit ?? undefined,
NanoCPUs: cpuLimit ?? undefined,
},
Reservations: {
MemoryBytes: memoryReservation
? (memoryReservation || 1) * 1024 * 1024
: undefined,
NanoCPUs: cpuReservation
? (cpuReservation || 1) * 1000 * 1000 * 1000
: undefined,
MemoryBytes: memoryReservation ?? undefined,
NanoCPUs: cpuReservation ?? undefined,
},
};
};