adapt resources, require requests, add inherit

This commit is contained in:
Stavros kois
2022-12-30 14:49:12 +02:00
parent 75474a92bb
commit 51d36c820c
10 changed files with 510 additions and 88 deletions

View File

@@ -19,6 +19,15 @@ tests:
cpu: 10m
memory: 50Mi
- it: should fail with inherit defined in main container
documentIndex: *deploymentDoc
set:
resources:
inherit:
asserts:
- failedTemplate:
errorMessage: <resources.inherit> key is only available for additional/init/install/upgrade containers.
- it: should fail with empty key in gpu
documentIndex: *deploymentDoc
set:
@@ -35,6 +44,238 @@ tests:
- failedTemplate:
errorMessage: Value is not provided for GPU (<key> somekey)
- it: should fail with empty requests.cpu
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 3000m
memory: 4Gi
requests:
cpu:
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.requests.cpu> cannot be empty.
- it: should fail with empty requests.memory
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 3000m
memory: 4Gi
requests:
cpu: 20m
memory:
asserts:
- failedTemplate:
errorMessage: <resources.requests.memory> cannot be empty.
- it: should fail with invalid format in requests.memory (zero)
documentIndex: *deploymentDoc
set:
scaleGPU:
somekey:
resources:
limits:
cpu: 3000m
memory: 4Gi
requests:
cpu: 20m
memory: 0.0
asserts:
- failedTemplate:
errorMessage: <resources.requests.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in requests.memory (zero exponent)
documentIndex: *deploymentDoc
set:
scaleGPU:
somekey:
resources:
limits:
cpu: 3000m
memory: 4Gi
requests:
cpu: 20m
memory: 0e0
asserts:
- failedTemplate:
errorMessage: <resources.requests.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in requests.memory (zero with suffix)
documentIndex: *deploymentDoc
set:
scaleGPU:
somekey:
resources:
limits:
cpu: 3000m
memory: 4Gi
requests:
cpu: 20m
memory: 0M
asserts:
- failedTemplate:
errorMessage: <resources.requests.memory> has invalid format in value (0M). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in requests.memory (string)
documentIndex: *deploymentDoc
set:
scaleGPU:
somekey:
resources:
limits:
cpu: 3000m
memory: 4Gi
requests:
cpu: 20m
memory: not-valid
asserts:
- failedTemplate:
errorMessage: <resources.requests.memory> has invalid format in value (not-valid). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in limits.memory (zero)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 3000m
memory: 0.0
requests:
cpu: 20m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.limits.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in limits.memory (zero exponent)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 3000m
memory: 0e0
requests:
cpu: 20m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.limits.memory> has invalid format in value (0). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in requests.limits (zero with suffix)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 3000m
memory: 0M
requests:
cpu: 20m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.limits.memory> has invalid format in value (0M). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in limits.memory (string)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 3000m
memory: not-valid
requests:
cpu: 20m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.limits.memory> has invalid format in value (not-valid). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6).
- it: should fail with invalid format in limits.cpu (zero)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 0.0
memory: 4Gi
requests:
cpu: 20m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.limits.cpu> has invalid format in value (0). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
- it: should fail with invalid format in limits.cpu (zero with suffix)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 0m
memory: 4Gi
requests:
cpu: 20m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.limits.cpu> has invalid format in value (0m). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
- it: should fail with invalid format in limits.cpu (string)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: not-valid
memory: 4Gi
requests:
cpu: 20m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.limits.cpu> has invalid format in value (not-valid). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
- it: should fail with invalid format in requests.cpu (zero)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 4000m
memory: 4Gi
requests:
cpu: 0.0
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.requests.cpu> has invalid format in value (0). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
- it: should fail with invalid format in requests.cpu (zero with suffix)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 4000m
memory: 4Gi
requests:
cpu: 0m
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.requests.cpu> has invalid format in value (0m). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
- it: should fail with invalid format in requests.cpu (string)
documentIndex: *deploymentDoc
set:
resources:
limits:
cpu: 4000m
memory: 4Gi
requests:
cpu: not-valid
memory: 100Mi
asserts:
- failedTemplate:
errorMessage: <resources.requests.cpu> has invalid format in value (not-valid). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m).
- it: should pass with changed resources
documentIndex: *deploymentDoc
set:
@@ -165,20 +406,20 @@ tests:
cpu: 20m
memory: 100Mi
- it: should pass with empty resources
- it: should pass with empty resources.limits
documentIndex: *deploymentDoc
set:
scaleGPU: {}
resources:
limits:
cpu:
memory:
requests:
cpu:
memory:
asserts:
- isNull:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
cpu: 10m
memory: 50Mi
- it: should pass with only limits.cpu defined
documentIndex: *deploymentDoc
@@ -188,15 +429,15 @@ tests:
limits:
cpu: 3000m
memory:
requests:
cpu:
memory:
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
limits:
cpu: 3000m
requests:
cpu: 10m
memory: 50Mi
- it: should pass with only limits.memory defined
documentIndex: *deploymentDoc
@@ -206,15 +447,15 @@ tests:
limits:
cpu:
memory: 4Gi
requests:
cpu:
memory:
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
limits:
memory: 4Gi
requests:
cpu: 10m
memory: 50Mi
- it: should pass with only requests.cpu defined
documentIndex: *deploymentDoc
@@ -225,14 +466,14 @@ tests:
cpu:
memory:
requests:
cpu: 10m
memory:
cpu: 30m
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
cpu: 10m
cpu: 30m
memory: 50Mi
- it: should pass with only requests.memory defined
documentIndex: *deploymentDoc
@@ -243,14 +484,14 @@ tests:
cpu:
memory:
requests:
cpu:
memory: 50Mi
memory: 15Mi
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
requests:
memory: 50Mi
cpu: 10m
memory: 15Mi
- it: should pass with only limits.gpu defined
documentIndex: *deploymentDoc
@@ -261,15 +502,15 @@ tests:
limits:
cpu:
memory:
requests:
cpu:
memory:
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
limits:
gpu.intel.com/i915: "1"
requests:
cpu: 10m
memory: 50Mi
- it: should pass with only requests defined
documentIndex: *deploymentDoc
@@ -296,18 +537,19 @@ tests:
scaleGPU: {}
resources:
limits:
cpu: 3000m
memory: 4Gi
requests:
cpu:
memory:
cpu: 1000m
memory: 1Gi
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
limits:
cpu: 3000m
memory: 4Gi
cpu: 1000m
memory: 1Gi
requests:
cpu: 10m
memory: 50Mi
- it: should pass with only gpu defined
documentIndex: *deploymentDoc
@@ -318,12 +560,12 @@ tests:
limits:
cpu:
memory:
requests:
cpu:
memory:
asserts:
- equal:
path: spec.template.spec.containers[0].resources
value:
limits:
gpu.intel.com/i915: "1"
requests:
cpu: 10m
memory: 50Mi

View File

@@ -75,7 +75,7 @@ tests:
inherit: true
asserts:
- failedTemplate:
errorMessage: <inherit> key is only available for additional/init/install/upgrade containers.
errorMessage: <securityContext.inherit> key is only available for additional/init/install/upgrade containers.
- it: should fail with securityContext changed, runAsNonRoot true and runAsUser 0
set:

View File

@@ -161,6 +161,44 @@ tests:
terminationMessagePath: somePath
terminationMessagePolicy: File
- it: should pass with resources inherited from main container and modified in init container
documentIndex: *deploymentDoc
set:
resources:
requests:
cpu: 25m
memory: 80Mi
initContainers:
some-name:
resources:
inherit: true
limits:
cpu: 1000m
memory: 1Gi
requests:
memory: 120Mi
asserts:
- isSubset:
path: spec.template.spec.containers[0]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
requests:
cpu: 25m
memory: 80Mi
- isSubset:
path: spec.template.spec.initContainers[0]
content:
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 25m
memory: 120Mi
- it: should pass with resources defined in init container
documentIndex: *deploymentDoc
set:

View File

@@ -163,6 +163,44 @@ tests:
terminationMessagePath: somePath
terminationMessagePolicy: File
- it: should pass with resources inherited from main container and modified in init container
documentIndex: *deploymentDoc
set:
resources:
requests:
cpu: 25m
memory: 80Mi
initContainers:
some-name:
resources:
inherit: true
limits:
cpu: 1000m
memory: 1Gi
requests:
memory: 120Mi
asserts:
- isSubset:
path: spec.template.spec.containers[0]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
requests:
cpu: 25m
memory: 80Mi
- isSubset:
path: spec.template.spec.initContainers[0]
content:
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 25m
memory: 120Mi
- it: should pass with resources defined in init container
documentIndex: *deploymentDoc
set:

View File

@@ -175,6 +175,44 @@ tests:
terminationMessagePath: somePath
terminationMessagePolicy: File
- it: should pass with resources inherited from main container and modified in init container
documentIndex: *deploymentDoc
set:
resources:
requests:
cpu: 25m
memory: 80Mi
installContainers:
some-name:
resources:
inherit: true
limits:
cpu: 1000m
memory: 1Gi
requests:
memory: 120Mi
asserts:
- isSubset:
path: spec.template.spec.containers[0]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
requests:
cpu: 25m
memory: 80Mi
- isSubset:
path: spec.template.spec.initContainers[0]
content:
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 25m
memory: 120Mi
- it: should pass with resources defined in install container
documentIndex: *deploymentDoc
set:

View File

@@ -177,6 +177,44 @@ tests:
terminationMessagePath: somePath
terminationMessagePolicy: File
- it: should pass with resources inherited from main container and modified in init container
documentIndex: *deploymentDoc
set:
resources:
requests:
cpu: 25m
memory: 80Mi
upgradeContainers:
some-name:
resources:
inherit: true
limits:
cpu: 1000m
memory: 1Gi
requests:
memory: 120Mi
asserts:
- isSubset:
path: spec.template.spec.containers[0]
content:
resources:
limits:
cpu: 4000m
memory: 8Gi
requests:
cpu: 25m
memory: 80Mi
- isSubset:
path: spec.template.spec.initContainers[0]
content:
resources:
limits:
cpu: 1000m
memory: 1Gi
requests:
cpu: 25m
memory: 120Mi
- it: should pass with resources defined in upgrade container
documentIndex: *deploymentDoc
set:

View File

@@ -2,63 +2,52 @@
{{- define "ix.v1.common.container.resources" -}}
{{- $resources := .resources -}}
{{- $gpu := .gpu -}}
{{- $isMainContainer := .isMainContainer -}}
{{- $root := .root -}}
{{- if and (hasKey $resources "inherit") $isMainContainer -}}
{{- fail "<resources.inherit> key is only available for additional/init/install/upgrade containers." -}}
{{- end -}}
{{/* Get defaults from global */}}
{{- $defautlResources := $root.Values.global.defaults.resources -}}
{{- $limitsCPU := $defautlResources.limits.cpu -}}
{{- $limitsMemory := $defautlResources.limits.memory -}}
{{- $requestsCPU := $defautlResources.requests.cpu -}}
{{- $requestsMemory := $defautlResources.requests.memory -}}
{{/* TODO: Inherit */}}
{{/* Modify based on user/dev input */}}
{{- with $resources -}}
{{- with $resources.requests -}}
{{- if hasKey . "cpu" -}}
{{- if ne $requestsCPU .cpu -}}
{{- $requestsCPU = .cpu -}}
{{- else if not .cpu -}} {{/* If key exists but it's empty, means user/dev explicitly said "no limit" */}}
{{- $requestsCPU = "" -}}
{{- end -}}
{{- end -}}
{{- if hasKey . "memory" -}}
{{- if ne $requestsMemory .memory -}}
{{- $requestsMemory = .memory -}}
{{- else if not .memory -}} {{/* If key exists but it's empty, means user/dev explicitly said "no limit" */}}
{{- $requestsMemory = "" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- with $resources.limits -}}
{{- if hasKey . "cpu" -}}
{{- if ne $limitsCPU .cpu -}}
{{- $limitsCPU = .cpu -}}
{{- else if not .cpu -}} {{/* If key exists but it's empty, means user/dev explicitly said "no limit" */}}
{{- $limitsCPU = "" -}}
{{- end -}}
{{- end -}}
{{- if hasKey . "memory" -}}
{{- if ne $limitsMemory .memory -}}
{{- $limitsMemory = .memory -}}
{{- else if not .memory -}} {{/* If key exists but it's empty, means user/dev explicitly said "no limit" */}}
{{- $limitsMemory = "" -}}
{{- end -}}
{{- end -}}
{{- $newResources := (mustDeepCopy $defautlResources) -}}
{{- if and $resources.inherit (not $isMainContainer) -}} {{/* if inherit is set, overwrite defaults with values from mainContainer */}}
{{- if (hasKey $root.Values "resources") -}}
{{- $newResources = mustMergeOverwrite $newResources $root.Values.resources -}}
{{- end -}}
{{- end -}}
{{- if or $resources $defautlResources $gpu -}}
{{- if or $requestsCPU $requestsMemory -}}
{{- with (include "ix.v1.common.container.resources.cpuAndMemory" (dict "cpu" $requestsCPU "memory" $requestsMemory)) }}
{{/* Overwrite from values that user/dev passed on this container */}}
{{- $newResources = mustMergeOverwrite $newResources $resources -}}
{{/* Validate Values */}}
{{- include "ix.v1.common.lib.resources.validate" (dict "key" "cpu"
"object" "requests"
"required" true
"value" $newResources.requests.cpu) -}}
{{- include "ix.v1.common.lib.resources.validate" (dict "key" "memory"
"object" "requests"
"required" true
"value" $newResources.requests.memory) -}}
{{- include "ix.v1.common.lib.resources.validate" (dict "key" "cpu"
"object" "limits"
"required" false
"value" $newResources.limits.cpu) -}}
{{- include "ix.v1.common.lib.resources.validate" (dict "key" "memory"
"object" "limits"
"required" false
"value" $newResources.limits.memory) -}}
{{- with (include "ix.v1.common.container.resources.cpuAndMemory" (dict "cpu" $newResources.requests.cpu "memory" $newResources.requests.memory)) }}
requests:
{{- . | indent 2 -}}
{{- end -}}
{{- end -}}
{{- if or $limitsCPU $limitsMemory $gpu }}
{{- . | indent 2 -}}
{{- end -}}
{{- if or $newResources.limits.cpu $newResources.limits.memory $gpu }}
limits:
{{- include "ix.v1.common.container.resources.cpuAndMemory" (dict "cpu" $limitsCPU "memory" $limitsMemory) | indent 2 -}}
{{- include "ix.v1.common.container.resources.gpu" (dict "gpu" $gpu) | indent 2 -}}
{{- end -}}
{{- include "ix.v1.common.container.resources.cpuAndMemory" (dict "cpu" $newResources.limits.cpu "memory" $newResources.limits.memory) | indent 2 -}}
{{- include "ix.v1.common.container.resources.gpu" (dict "gpu" $gpu) | indent 2 -}}
{{- end -}}
{{- end -}}
@@ -87,3 +76,37 @@ memory: {{ . }}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* Validates resources to match a pattern */}}
{{- define "ix.v1.common.lib.resources.validate" -}}
{{- $key := .key -}}
{{- $object := .object -}}
{{- $value := .value -}}
{{- $required := .required -}}
{{- with (toString $value) -}} {{/* Stringify to avoid falsy values evaluating as false */}}
{{- if $required -}} {{/* If requred and it's empty fail (requests are requried) */}}
{{- if eq . "<nil>" -}}
{{- fail (printf "<resources.%s.%s> cannot be empty." $object $key) -}}
{{- end -}}
{{- end -}}
{{/* If it's not null validate input */}}
{{- if ne . "<nil>" -}} {{/* Limits can be null, means "no limit" */}}
{{- if eq $key "cpu" -}}
{{/* https://regex101.com/r/TlVTXr/3 */}} {{/*TODO: smallify this? */}}
{{- if not (mustRegexMatch "^([1-9][0-9]*(\\.\\[0-9]+)?m|[1-9][0-9]*|[0-9]*\\.[1-9][0-9]*(m)?)$" .) -}}
{{- fail (printf "<resources.%s.%s> has invalid format in value (%s). Valid formats are (Plain Integer eg. 1) (Float eg. 0.5) (Milicpu 500m)." $object $key .) -}}
{{- end -}}
{{- else if eq $key "memory" -}}
{{/* https://regex101.com/r/NNPV2D/1 */}}
{{- if not (mustRegexMatch "^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$" .) -}}
{{- fail (printf "<resources.%s.%s> has invalid format in value (%s). Valid formats are (Suffixed with EPTGMK eg. 1G) (Suffixed with EPTGMK + i eg. 1Gi) (Plain integer (in bytes) eg. 1024) (Exponent eg. 134e6)." $object $key .) -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

View File

@@ -13,16 +13,15 @@ The reason is not splitted, is that on one of the places needs a combo of all va
{{/* Initialiaze Values */}}
{{- $defaultSecCont := $root.Values.global.defaults.securityContext -}}
{{- $returnValue := (deepCopy $defaultSecCont) -}}
{{- $returnValue := (mustDeepCopy $defaultSecCont) -}}
{{/* TODO: deviceList + suppleGroups */}}
{{- if and (hasKey $secCont "inherit") $isMainContainer -}}
{{- fail "<inherit> key is only available for additional/init/install/upgrade containers." -}}
{{- fail "<securityContext.inherit> key is only available for additional/init/install/upgrade containers." -}}
{{- end -}}
{{/* SecurityContext */}}
{{- if and $secCont.inherit (not $isMainContainer) -}} {{/* if inherit is set, overwrite defaults with values from mainContainer */}}
{{- if and $secCont.inherit (not $isMainContainer) -}} {{/* if inherit is set, overwrite values from mainContainer */}}
{{- if (hasKey $root.Values "securityContext") -}}
{{- $returnValue = mustMergeOverwrite $returnValue $root.Values.securityContext -}}
{{- end -}}
@@ -77,7 +76,7 @@ The reason is not splitted, is that on one of the places needs a combo of all va
{{/* Initialiaze Values */}}
{{- $defaultPodSecCont := $root.Values.global.defaults.podSecurityContext -}}
{{- $returnValue := (deepCopy $defaultPodSecCont) -}}
{{- $returnValue := (mustDeepCopy $defaultPodSecCont) -}}
{{/* Overwrite from values that user/dev passed */}}
{{- $returnValue = mustMergeOverwrite $returnValue $podSecCont -}}
@@ -106,7 +105,7 @@ The reason is not splitted, is that on one of the places needs a combo of all va
{{/* Initialiaze Values */}}
{{- $defaultSecEnvs := $root.Values.global.defaults.security -}}
{{- $returnValue := (deepCopy $defaultSecEnvs) -}}
{{- $returnValue := (mustDeepCopy $defaultSecEnvs) -}}
{{/* Overwrite from values that user/dev passed */}}
{{- $returnValue = mustMergeOverwrite $returnValue $secEnvs -}}

View File

@@ -78,7 +78,10 @@
terminationMessagePolicy: {{ . }}
{{- end -}}
{{- end -}}
{{- with (include "ix.v1.common.container.resources" (dict "resources" $container.resources "gpu" $container.scaleGPU "root" $root) | trim) }}
{{- with (include "ix.v1.common.container.resources" (dict "resources" $container.resources
"gpu" $container.scaleGPU
"isMainContainer" false
"root" $root) | trim) }}
resources:
{{- . | nindent 4 }}
{{- end -}}

View File

@@ -61,7 +61,10 @@ So it can work on multiple places, like additional containers and not only the m
{{- with (include "ix.v1.common.container.probes" (dict "probes" .Values.probes "services" .Values.service "root" $) | trim) }}
{{- . | nindent 2 }}
{{- end -}}
{{- with (include "ix.v1.common.container.resources" (dict "resources" .Values.resources "gpu" .Values.scaleGPU "root" $) | trim) }}
{{- with (include "ix.v1.common.container.resources" (dict "resources" .Values.resources
"gpu" .Values.scaleGPU
"isMainContainer" true
"root" $) | trim) }}
resources:
{{- . | nindent 4 }}
{{- end -}}