File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ const Env = z.object({
89
89
KUBERNETES_CPU_REQUEST_RATIO : z . coerce . number ( ) . min ( 0 ) . max ( 1 ) . default ( 0.75 ) , // Ratio of CPU limit, so 0.75 = 75% of CPU limit
90
90
KUBERNETES_MEMORY_REQUEST_MIN_GB : z . coerce . number ( ) . min ( 0 ) . default ( 0 ) ,
91
91
KUBERNETES_MEMORY_REQUEST_RATIO : z . coerce . number ( ) . min ( 0 ) . max ( 1 ) . default ( 1 ) , // Ratio of memory limit, so 1 = 100% of memory limit
92
+ KUBERNETES_MEMORY_OVERHEAD_GB : z . coerce . number ( ) . min ( 0 ) . optional ( ) , // Optional memory overhead to add to the limit in GB
92
93
93
94
// Placement tags settings
94
95
PLACEMENT_TAGS_ENABLED : BoolEnv . default ( false ) ,
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export class KubernetesWorkloadManager implements WorkloadManager {
25
25
private readonly cpuRequestRatio = env . KUBERNETES_CPU_REQUEST_RATIO ;
26
26
private readonly memoryRequestMinGb = env . KUBERNETES_MEMORY_REQUEST_MIN_GB ;
27
27
private readonly memoryRequestRatio = env . KUBERNETES_MEMORY_REQUEST_RATIO ;
28
+ private readonly memoryOverheadGb = env . KUBERNETES_MEMORY_OVERHEAD_GB ;
28
29
29
30
constructor ( private opts : WorkloadManagerOptions ) {
30
31
this . k8s = createK8sApi ( ) ;
@@ -319,9 +320,13 @@ export class KubernetesWorkloadManager implements WorkloadManager {
319
320
}
320
321
321
322
#getResourceLimitsForMachine( preset : MachinePreset ) : ResourceQuantities {
323
+ const memoryLimit = this . memoryOverheadGb
324
+ ? preset . memory + this . memoryOverheadGb
325
+ : preset . memory ;
326
+
322
327
return {
323
328
cpu : `${ preset . cpu } ` ,
324
- memory : `${ preset . memory } G` ,
329
+ memory : `${ memoryLimit } G` ,
325
330
} ;
326
331
}
327
332
You can’t perform that action at this time.
0 commit comments