mirror of
https://github.com/truenas/charts.git
synced 2026-06-18 09:37:12 +08:00
small fixes
This commit is contained in:
@@ -130,7 +130,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (ENVVAR) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (env)] and [to (ABC) on (Configmap-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (ENVVAR) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (env)] and [to (ABC) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with env trying to override secret
|
||||
set:
|
||||
@@ -147,7 +147,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (ENVVAR) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (env)] and [to (ABC) on (Secret-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (ENVVAR) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (env)] and [to (ABC) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with env trying to override envList
|
||||
set:
|
||||
@@ -196,7 +196,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (envList)] and [to (something) on (Configmap-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (envList)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with envList trying to override secret
|
||||
set:
|
||||
@@ -214,7 +214,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (envList)] and [to (something) on (Secret-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (envList)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override fixedEnv
|
||||
set:
|
||||
@@ -229,7 +229,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (Configmap-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override env
|
||||
set:
|
||||
@@ -246,7 +246,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (env)] and [to (something) on (Configmap-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (env)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override envList
|
||||
set:
|
||||
@@ -264,7 +264,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (envList)] and [to (something) on (Configmap-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (envList)] and [to (something) on (configmap-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with configmap trying to override secret
|
||||
set:
|
||||
@@ -287,7 +287,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (Configmap-RELEASE-NAME-common-test-somename)] and [to (something123) on (Secret-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something) on (configmap-RELEASE-NAME-common-test-somename)] and [to (something123) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override fixedEnv
|
||||
set:
|
||||
@@ -302,7 +302,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (Secret-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (TZ) on container (RELEASE-NAME-common-test) is set more than once. [to (UTC) on (fixedEnv)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override env
|
||||
set:
|
||||
@@ -319,7 +319,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (env)] and [to (something) on (Secret-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (env)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override envList
|
||||
set:
|
||||
@@ -337,7 +337,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (envList)] and [to (something) on (Secret-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (postgres.svc.cluster.local) on (envList)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should fail with secret trying to override configmap
|
||||
set:
|
||||
@@ -360,7 +360,7 @@ tests:
|
||||
name: RELEASE-NAME-common-test-somename
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something123) on (Configmap-RELEASE-NAME-common-test-somename)] and [to (something) on (Secret-RELEASE-NAME-common-test-somename)]
|
||||
errorMessage: Environment Variable (POSTGRES_HOST) on container (RELEASE-NAME-common-test) is set more than once. [to (something123) on (configmap-RELEASE-NAME-common-test-somename)] and [to (something) on (secret-RELEASE-NAME-common-test-somename)]
|
||||
|
||||
- it: should pass with envs defined with int value
|
||||
documentIndex: *deploymentDoc
|
||||
|
||||
@@ -7,45 +7,66 @@ service:
|
||||
initImage:
|
||||
repository: something
|
||||
tag: somethingeles
|
||||
|
||||
|
||||
# env:
|
||||
# TZ: tsd
|
||||
|
||||
# TODO: check why it mixes up envs from main container with init container for dupe check
|
||||
|
||||
# TODO: Unittests
|
||||
initContainers:
|
||||
init-db:
|
||||
name: ss
|
||||
imageSelector: initImage
|
||||
pullPolicy: Always
|
||||
tty: true
|
||||
stdin: true
|
||||
command:
|
||||
- this
|
||||
- is
|
||||
- |
|
||||
a test
|
||||
args:
|
||||
- this args
|
||||
- is
|
||||
- |
|
||||
a test
|
||||
extraArgs:
|
||||
- this extraargs
|
||||
- is
|
||||
- |
|
||||
a test
|
||||
lifecycle:
|
||||
preStop:
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- |
|
||||
echo "Doing things..."
|
||||
termination:
|
||||
messagePath: something
|
||||
messagePolicy: FallbackToLogsOnError
|
||||
scaleGPU:
|
||||
gpu.intel.com/i915: "1"
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 2Gi
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 10Mi
|
||||
# initContainers:
|
||||
# init-db:
|
||||
# name: ss
|
||||
# imageSelector: initImage
|
||||
# pullPolicy: Always
|
||||
# tty: true
|
||||
# stdin: true
|
||||
# command:
|
||||
# - this
|
||||
# - is
|
||||
# - |
|
||||
# a test
|
||||
# args:
|
||||
# - this args
|
||||
# - is
|
||||
# - |
|
||||
# a test
|
||||
# extraArgs:
|
||||
# - this extraargs
|
||||
# - is
|
||||
# - |
|
||||
# a test
|
||||
# lifecycle:
|
||||
# preStop:
|
||||
# command:
|
||||
# - /bin/sh
|
||||
# - -c
|
||||
# - |
|
||||
# echo "Doing things..."
|
||||
# termination:
|
||||
# messagePath: something
|
||||
# messagePolicy: FallbackToLogsOnError
|
||||
# scaleGPU:
|
||||
# gpu.intel.com/i915: "1"
|
||||
# resources:
|
||||
# limits:
|
||||
# cpu: 1000m
|
||||
# memory: 2Gi
|
||||
# requests:
|
||||
# cpu: 10m
|
||||
# memory: 10Mi
|
||||
# env:
|
||||
# key: value
|
||||
# test: tasdt
|
||||
# blbla: tasd
|
||||
# envFrom:
|
||||
# - configMapRef:
|
||||
# name: omething
|
||||
# - secretRef:
|
||||
# name: omething
|
||||
# envList:
|
||||
# # - name: blbla
|
||||
# # value: tasd
|
||||
# - name: blbla23
|
||||
# value: tasd234
|
||||
|
||||
@@ -20,12 +20,12 @@ That's why the custom dict is expected.
|
||||
{{- $secretName := (tpl (required "Name is required for secretRef in envFrom." .secretRef.name) $root) }}
|
||||
- secretRef:
|
||||
name: {{ $secretName | quote }}
|
||||
{{- include "ix.v1.common.util.storeEnvFromVarsForCheck" (dict "root" $root "containers" (list $containerName) "name" $secretName "type" "secret") -}}
|
||||
{{- include "ix.v1.common.util.storeEnvFromVarsForCheck" (dict "root" $root "containerName" $containerName "source" (printf "%s-%s" "secret" $secretName)) -}}
|
||||
{{- else if .configMapRef }}
|
||||
{{- $configName := (tpl (required "Name is required for configMapRef in envFrom." .configMapRef.name) $root) }}
|
||||
- configMapRef:
|
||||
name: {{ $configName | quote }}
|
||||
{{- include "ix.v1.common.util.storeEnvFromVarsForCheck" (dict "root" $root "containers" (list $containerName) "name" $configName "type" "configmap") -}}
|
||||
{{- include "ix.v1.common.util.storeEnvFromVarsForCheck" (dict "root" $root "containerName" $containerName "source" (printf "%s-%s" "configmap" $configName)) -}}
|
||||
{{- else -}}
|
||||
{{- fail "Not valid Ref or <name> key is missing in envFrom." -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -52,13 +52,12 @@
|
||||
|
||||
{{- define "ix.v1.common.util.storeEnvFromVarsForCheck" -}}
|
||||
{{- $root := .root -}}
|
||||
{{- $name := .name -}}
|
||||
{{- $source := .source -}}
|
||||
{{- $containerName := .containerName -}}
|
||||
{{- $type := .type -}}
|
||||
|
||||
{{- $dupes := $root.Values.envsForDupeCheck -}}
|
||||
{{- range $item := $dupes -}}
|
||||
{{- if eq $item.source (printf "%s-%s" (camelcase $type) $name) -}}
|
||||
{{- if eq $item.source $source -}}
|
||||
{{- if not (mustHas $containerName $item.containers) -}}
|
||||
{{- $dupes = without $dupes $item -}}
|
||||
{{- $_ := set $item "containers" (mustAppend $item.containers $containerName) -}}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
{{- end -}}
|
||||
|
||||
{{/* Add the to the list for dupeCheck */}}
|
||||
{{- include "ix.v1.common.util.storeEnvsForDupeCheck" (dict "root" $root "source" (printf "%s-%s" (camelcase $objectType) $objectName) "containers" list "data" $dupeCheck) -}}
|
||||
{{- include "ix.v1.common.util.storeEnvsForDupeCheck" (dict "root" $root "source" (printf "%s-%s" $objectType $objectName) "containers" list "data" $dupeCheck) -}}
|
||||
{{/* Convert to Yaml before sending to classes */}}
|
||||
{{- $classData = toYaml $classData -}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user