mirror of
https://github.com/truecharts/library-charts.git
synced 2026-07-05 14:36:22 -03:00
formatting
This commit is contained in:
@@ -7,70 +7,70 @@ That's why the custom dict is expected.
|
||||
*/}}
|
||||
{{/* Environment Variables included by the container */}}
|
||||
{{- define "ix.v1.common.container.envVars" -}}
|
||||
{{- $envs := .envs -}}
|
||||
{{- $envList := .envList -}}
|
||||
{{- $root := .root -}}
|
||||
{{- if $root.Values.injectFixedEnvs -}}
|
||||
{{- include "ix.v1.common.container.fixedEnvs" $root | trim -}}
|
||||
{{- end -}} {{/* Finish fixedEnv */}}
|
||||
{{- with $envs -}}
|
||||
{{- range $k, $v := . -}} {{/* TODO: Check if there is a user provided env that exist in fixedEnv and error out */}}
|
||||
{{- $name := $k -}}
|
||||
{{- $value := $v -}}
|
||||
{{- if kindIs "int" $name -}}
|
||||
{{- fail "Environment Variables as a list is not supported. Use key-value format." -}}
|
||||
{{- end }}
|
||||
{{- $envs := .envs -}}
|
||||
{{- $envList := .envList -}}
|
||||
{{- $root := .root -}}
|
||||
{{- if $root.Values.injectFixedEnvs -}}
|
||||
{{- include "ix.v1.common.container.fixedEnvs" $root | trim -}}
|
||||
{{- end -}} {{/* Finish fixedEnv */}}
|
||||
{{- with $envs -}}
|
||||
{{- range $k, $v := . -}} {{/* TODO: Check if there is a user provided env that exist in fixedEnv and error out */}}
|
||||
{{- $name := $k -}}
|
||||
{{- $value := $v -}}
|
||||
{{- if kindIs "int" $name -}}
|
||||
{{- fail "Environment Variables as a list is not supported. Use key-value format." -}}
|
||||
{{- end }}
|
||||
- name: {{ $name | quote }}
|
||||
{{- if not (kindIs "map" $value) -}}
|
||||
{{- if kindIs "string" $value -}} {{/* Single values are parsed as string (eg. int, bool) */}}
|
||||
{{- $value = tpl $value $root -}} {{/* Expand Value */}}
|
||||
{{- end }}
|
||||
{{- if not (kindIs "map" $value) -}}
|
||||
{{- if kindIs "string" $value -}} {{/* Single values are parsed as string (eg. int, bool) */}}
|
||||
{{- $value = tpl $value $root -}} {{/* Expand Value */}}
|
||||
{{- end }}
|
||||
value: {{ quote $value }}
|
||||
{{- else if kindIs "map" $value -}} {{/* If value is a dict... */}}
|
||||
{{- if hasKey $value "valueFrom" -}}
|
||||
{{- fail "Please remove <valueFrom> and use directly configMapKeyRef or secretKeyRef" -}}
|
||||
{{- end }}
|
||||
{{- else if kindIs "map" $value -}} {{/* If value is a dict... */}}
|
||||
{{- if hasKey $value "valueFrom" -}}
|
||||
{{- fail "Please remove <valueFrom> and use directly configMapKeyRef or secretKeyRef" -}}
|
||||
{{- end }}
|
||||
valueFrom:
|
||||
{{- if hasKey $value "configMapKeyRef" }} {{/* And contains configMapRef... */}}
|
||||
{{- if hasKey $value "configMapKeyRef" }} {{/* And contains configMapRef... */}}
|
||||
configMapKeyRef:
|
||||
{{- $_ := set $value "name" $value.configMapKeyRef.name -}} {{/* Extract name and key */}}
|
||||
{{- $_ := set $value "key" $value.configMapKeyRef.key -}}
|
||||
{{- if hasKey $value.configMapKeyRef "optional" -}}
|
||||
{{- fail "<optional> is not supported in configMapRefKey" -}}
|
||||
{{- end -}}
|
||||
{{- else if hasKey $value "secretKeyRef" }} {{/* And contains secretpRef... */}}
|
||||
secretKeyRef:
|
||||
{{- $_ := set $value "name" $value.secretKeyRef.name -}} {{/* Extract name and key */}}
|
||||
{{- $_ := set $value "key" $value.secretKeyRef.key -}}
|
||||
{{- if (hasKey $value.secretKeyRef "optional") -}}
|
||||
{{- if (kindIs "bool" $value.secretKeyRef.optional) }}
|
||||
optional: {{ $value.secretKeyRef.optional }}
|
||||
{{- else -}}
|
||||
{{- fail (printf "<optional> in secretKeyRef must be a boolean on Environment Variable (%s)" $name) -}}
|
||||
{{- $_ := set $value "name" $value.configMapKeyRef.name -}} {{/* Extract name and key */}}
|
||||
{{- $_ := set $value "key" $value.configMapKeyRef.key -}}
|
||||
{{- if hasKey $value.configMapKeyRef "optional" -}}
|
||||
{{- fail "<optional> is not supported in configMapRefKey" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- fail "Not a valid valueFrom reference. Valid options are (configMapKeyRef and secretKeyRef)" -}}
|
||||
{{- end }}
|
||||
{{- else if hasKey $value "secretKeyRef" }} {{/* And contains secretpRef... */}}
|
||||
secretKeyRef:
|
||||
{{- $_ := set $value "name" $value.secretKeyRef.name -}} {{/* Extract name and key */}}
|
||||
{{- $_ := set $value "key" $value.secretKeyRef.key -}}
|
||||
{{- if (hasKey $value.secretKeyRef "optional") -}}
|
||||
{{- if (kindIs "bool" $value.secretKeyRef.optional) }}
|
||||
optional: {{ $value.secretKeyRef.optional }}
|
||||
{{- else -}}
|
||||
{{- fail (printf "<optional> in secretKeyRef must be a boolean on Environment Variable (%s)" $name) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- fail "Not a valid valueFrom reference. Valid options are (configMapKeyRef and secretKeyRef)" -}}
|
||||
{{- end }}
|
||||
name: {{ tpl (required (printf "<name> for the keyRef is not defined in (%s)" $name) $value.name) $root }} {{/* Expand name and key */}}
|
||||
key: {{ tpl (required (printf "<key> for the keyRef is not defined in (%s)" $name) $value.key) $root }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}} {{/* Finish env */}}
|
||||
{{- with $envList -}}
|
||||
{{- range $envList -}}
|
||||
{{- if and .name .value -}}
|
||||
{{- if mustHas (kindOf .name) (list "map" "slice") -}}
|
||||
{{- fail "Name in envList cannot be a map or slice" -}}
|
||||
{{- end -}}
|
||||
{{- if mustHas (kindOf .value) (list "map" "slice") -}}
|
||||
{{- fail "Value in envList cannot be a map or slice" -}}
|
||||
{{- end }}
|
||||
{{- end -}} {{/* Finish env */}}
|
||||
{{- with $envList -}}
|
||||
{{- range $envList -}}
|
||||
{{- if and .name .value -}}
|
||||
{{- if mustHas (kindOf .name) (list "map" "slice") -}}
|
||||
{{- fail "Name in envList cannot be a map or slice" -}}
|
||||
{{- end -}}
|
||||
{{- if mustHas (kindOf .value) (list "map" "slice") -}}
|
||||
{{- fail "Value in envList cannot be a map or slice" -}}
|
||||
{{- end }}
|
||||
- name: {{ tpl .name $root }}
|
||||
value: {{ tpl .value $root | quote }}
|
||||
{{- else -}}
|
||||
{{- fail "Please specify both name and value for environment variable" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}} {{/* Finish envList */}}
|
||||
{{- else -}}
|
||||
{{- fail "Please specify both name and value for environment variable" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}} {{/* Finish envList */}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
value: {{ tpl (toYaml .Values.security.UMASK) $ | quote }}
|
||||
- name: UMASK_SET
|
||||
value: {{ tpl (toYaml .Values.security.UMASK) $ | quote }}
|
||||
{{- if not (.Values.scaleGPU) }}
|
||||
{{- if not (.Values.scaleGPU) }}
|
||||
- name: NVIDIA_VISIBLE_DEVICES
|
||||
value: "void"
|
||||
{{- else }}
|
||||
{{- else }}
|
||||
- name: NVIDIA_DRIVER_CAPABILITIES
|
||||
value: {{ join "," .Values.nvidiaCaps | quote }}
|
||||
{{- end -}}
|
||||
{{- if and (or (eq (.Values.podSecurityContext.runAsUser | int) 0) (eq (.Values.podSecurityContext.runAsGroup | int) 0)) (or .Values.security.PUID (eq (.Values.security.PUID | int) 0)) }} {{/* If root user or root group and a PUID is set, set PUID and related envs */}}
|
||||
{{- end -}}
|
||||
{{- if and (or (eq (.Values.podSecurityContext.runAsUser | int) 0) (eq (.Values.podSecurityContext.runAsGroup | int) 0)) (or .Values.security.PUID (eq (.Values.security.PUID | int) 0)) }} {{/* If root user or root group and a PUID is set, set PUID and related envs */}}
|
||||
- name: PUID
|
||||
value: {{ tpl (toYaml .Values.security.PUID) $ | quote }}
|
||||
- name: USER_ID
|
||||
@@ -25,9 +25,9 @@
|
||||
value: {{ tpl (toYaml .Values.podSecurityContext.fsGroup) $ | quote }}
|
||||
- name: GID
|
||||
value: {{ tpl (toYaml .Values.podSecurityContext.fsGroup) $ | quote }}
|
||||
{{- end -}}
|
||||
{{- if or (.Values.securityContext.readOnlyRootFilesystem) (.Values.securityContext.runAsNonRoot) }} {{/* Mainly for LSIO containers, tell S6 to avoid using rootfs */}}
|
||||
{{- end -}}
|
||||
{{- if or (.Values.securityContext.readOnlyRootFilesystem) (.Values.securityContext.runAsNonRoot) }} {{/* Mainly for LSIO containers, tell S6 to avoid using rootfs */}}
|
||||
- name: S6_READ_ONLY_ROOT
|
||||
value: "1"
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user