(feat) Dynamically set PGID, GID and GROUP_ID (#1091)

* base PGID on fsGroup

* also remove PGID from questions.yaml

* remove mistake

* small fix

* fix first test

* fix linting

* always set PUID to 568

* use quotes for env vars (obviously)
This commit is contained in:
Kjeld Schouten-Lebbing 2021-10-04 12:31:56 +02:00 committed by GitHub
parent 1a7a85d772
commit 308ba8accf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
63 changed files with 117 additions and 241 deletions

View File

@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 8.1.1
version: 8.2.0

View File

@ -3,12 +3,7 @@ This template serves as the blueprint for the mountPermissions job that is run
before chart installation.
*/}}
{{- define "common.controller.autopermissions" -}}
{{- $group := 568 -}}
{{- if .Values.env -}}
{{- $group = dig "PGID" $group .Values.env -}}
{{- end -}}
{{- $group = dig "fsGroup" $group .Values.podSecurityContext -}}
{{- $group := .Values.podSecurityContext.fsGroup -}}
{{- $hostPathMounts := dict -}}
{{- range $name, $mount := .Values.persistence -}}
{{- if and $mount.enabled $mount.setPermissions -}}

View File

@ -35,6 +35,12 @@
{{- end }}
env:
- name: PGID
value: {{ .Values.podSecurityContext.fsGroup | quote }}
- name: GROUP_ID
value: {{ .Values.podSecurityContext.fsGroup | quote }}
- name: GID
value: {{ .Values.podSecurityContext.fsGroup | quote }}
{{- if or ( .Values.securityContext.readOnlyRootFilesystem ) ( .Values.securityContext.runAsNonRoot ) }}
- name: S6_READ_ONLY_ROOT
value: "1"

View File

@ -85,12 +85,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -27,9 +27,9 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1001"
# -- Specify the group ID the application will run as
PGID: "1001"
PUID: 568
# -- Used to set the base path for reverse proxies eg. /booksonic, /books, etc.
CONTEXT_PATH: # "url-base"
# -- For passing additional java options. For some reverse proxies, you may need to pass `JAVA_OPTS=-Dserver.use-forward-headers=true` for airsonic to generate the proper URL schemes.

View File

@ -14,7 +14,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -27,9 +27,9 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "568"
# -- Specify the group ID the application will run as
PGID: "568"
PUID: 568
# -- Used to set the base path for reverse proxies eg. /booksonic, /books, etc.
# CONTEXT_PATH=url-base

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -22,7 +22,7 @@ service:
env: {}
# TZ:
# PUID:
# PGID:
# UMASK:
# DOCKER_MODS:

View File

@ -29,9 +29,9 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1001"
# -- Specify the group ID the application will run as
PGID: "1001"
PUID: 568
# -- Username for the calibre gui
GUAC_USER:
# -- Password's md5 hash for the calibre gui

View File

@ -30,7 +30,7 @@ serviceList:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -12,7 +12,7 @@ image:
envTpl:
# Permissions Settings
USER_ID: "{{ .Values.env.PUID }}"
GROUP_ID: "{{ .Values.env.PGID }}"
##
# Most other defaults are set in questions.yaml
# For other options please refer to the wiki, default_values.yaml or the common library chart

View File

@ -86,12 +86,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -23,11 +23,11 @@ podSecurityContext:
envTpl:
# Permissions Settings
USER_ID: "{{ .Values.env.PUID }}"
GROUP_ID: "{{ .Values.env.PGID }}"
env:
PUID: "568"
PGID: "568"
PUID: 568
# TZ: UTC
VISION-FACE: "True"
VISION-DETECTION: "True"

View File

@ -85,12 +85,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -19,9 +19,7 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: 1001
# -- Specify the group ID the application will run as
PGID: 1001
PUID: 568
# -- Configures service settings for the chart.
# @default -- See values.yaml

View File

@ -27,9 +27,7 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1000"
# -- Specify the group ID the application will run as
PGID: "1000"
PUID: 568
# -- Configures service settings for the chart.
# @default -- See values.yaml

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -22,7 +22,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -22,7 +22,7 @@ service:
env: {}
# TZ:
# PUID:
# PGID:
persistence:
config:

View File

@ -13,7 +13,7 @@ image:
envTpl:
# Permissions Settings
USER_ID: "{{ .Values.env.PUID }}"
GROUP_ID: "{{ .Values.env.PGID }}"
##
# Most other defaults are set in questions.yaml
# For other options please refer to the wiki, default_values.yaml or the common library chart

View File

@ -85,12 +85,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -29,12 +29,12 @@ service:
envTpl:
# Permissions Settings
USER_ID: "{{ .Values.env.PUID }}"
GROUP_ID: "{{ .Values.env.PGID }}"
env:
# Permissions Settings
PUID: "568"
PGID: "568"
PUID: 568
# General Settings
KEEP_APP_RUNNING: "0"
CLEAN_TMP_DIR: "1"

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -22,7 +22,7 @@ service:
env: {}
# TZ:
# PUID:
# PGID:
probes:
startup:

View File

@ -100,12 +100,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -26,9 +26,7 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1001"
# -- Specify the group ID the application will run as
PGID: "1001"
PUID: 568
# -- Configures service settings for the chart.
# @default -- See values.yaml

View File

@ -28,7 +28,7 @@ probes:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -13,7 +13,7 @@ image:
envTpl:
# Permissions Settings
USER_ID: "{{ .Values.env.PUID }}"
GROUP_ID: "{{ .Values.env.PGID }}"
##
# Most other defaults are set in questions.yaml

View File

@ -31,12 +31,12 @@ service:
envTpl:
# Permissions Settings
USER_ID: "{{ .Values.env.PUID }}"
GROUP_ID: "{{ .Values.env.PGID }}"
env:
# Permissions Settings
PUID: "568"
PGID: "568"
PUID: 568
# General Settings
KEEP_APP_RUNNING: "0"
CLEAN_TMP_DIR: "1"

View File

@ -76,12 +76,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -21,7 +21,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -27,9 +27,9 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1001"
# -- Specify the group ID the application will run as
PGID: "1001"
PUID: 568
# PASSWORD:
# CUSTOM_RESULTS:
# DB_TYPE:

View File

@ -17,7 +17,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
probes:
liveness:

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -22,7 +22,7 @@ service:
env: {}
# PHP_TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -26,9 +26,7 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1000"
# -- Specify the group ID the application will run as
PGID: "1000"
PUID: 568
# -- Configures service settings for the chart.
# @default -- See values.yaml

View File

@ -17,7 +17,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
probes:
liveness:

View File

@ -17,7 +17,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -22,7 +22,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -10,14 +10,11 @@ securityContext:
podSecurityContext:
runAsUser: 0
runAsGroup: 0
runAsGroup: 20
env:
TZ: UTC
PUID: "568"
# currently needed for working with /dev/ttyXYZ devices
# see: https://github.com/linuxserver/docker-oscam/issues/21
PGID: "20"
PUID: 568
service:
main:

View File

@ -26,9 +26,7 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1001"
# -- Specify the group ID the application will run as
PGID: "1001"
PUID: 568
# -- Configures service settings for the chart.
# @default -- See values.yaml

View File

@ -11,7 +11,7 @@ securityContext:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
# UMASK: 022
service:

View File

@ -17,7 +17,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
probes:
liveness:

View File

@ -17,7 +17,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
probes:
liveness:

View File

@ -26,9 +26,9 @@ env:
# -- Set the container timezone
TZ: UTC
# -- Specify the user ID the application will run as
PUID: "1001"
# -- Specify the group ID the application will run as
PGID: "1001"
PUID: 568
# -- Sets default UMASK
UMASK: # 022

View File

@ -14,7 +14,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -14,7 +14,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
probes:
liveness:

View File

@ -14,7 +14,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
config:

View File

@ -26,7 +26,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
# TRANSMISSION_ALT_SPEED_DOWN: 50
# TRANSMISSION_ALT_SPEED_ENABLED: false
# TRANSMISSION_ALT_SPEED_TIME_BEGIN: 540

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -22,7 +22,7 @@ service:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
persistence:
data:

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -15,7 +15,6 @@ podSecurityContext:
# See https://github.com/linuxserver/docker-tvheadend#parameters
env: {}
# PUID: 1000
# PGID: 1000
# TZ: Europe/London
# RUN_OPTS: <run options here>

View File

@ -12,7 +12,7 @@ image:
envTpl:
# Permissions Settings
UNIFI_GID: "{{ .Values.env.PUID }}"
UNIFI_UID: "{{ .Values.env.PGID }}"
UNIFI_UID: "{{ .Values.podSecurityContext.fsGroup }}"
##
# Most other defaults are set in questions.yaml
# For other options please refer to the wiki, default_values.yaml or the common library chart

View File

@ -84,12 +84,7 @@ questions:
schema:
type: int
default: 568
- variable: PGID
label: "PGID"
description: "Sets the PGID env var for LinuxServer.io (compatible) containers"
schema:
type: int
default: 568
- variable: UMASK
label: "UMASK"
description: "Sets the UMASK env var for LinuxServer.io (compatible) containers"

View File

@ -8,7 +8,7 @@ image:
envTpl:
# Permissions Settings
UNIFI_GID: "{{ .Values.env.PUID }}"
UNIFI_UID: "{{ .Values.env.PGID }}"
UNIFI_UID: "{{ .Values.podSecurityContext.fsGroup }}"
service:
main:
@ -64,8 +64,8 @@ podSecurityContext:
env:
# TZ:
PUID: "568"
PGID: "568"
PUID: 568
persistence:
config:

View File

@ -18,7 +18,7 @@ portal:
env: {}
# TZ: UTC
# PUID: 1001
# PGID: 1001
probes:
liveness:

View File

@ -283,37 +283,6 @@ class Test < ChartTest
initContainer = deployment["spec"]["template"]["spec"]["initContainers"][0]
assert_equal(results[:command], initContainer["command"])
end
it 'outputs PUID AND PGID permissions for multiple volumes when both are set' do
results= {
command: ["/bin/sh", "-c", "echo 'Automatically correcting permissions...';chown -R :568 '/configlist'; chmod -R g+w '/configlist';chown -R :568 '/data'; chmod -R g+w '/data';"]
}
values = {
env: {
PGID: 666,
PUID: 999
},
persistenceList: [
{
name: "data",
enabled: true,
setPermissions: true,
mountPath: "/data",
hostPath: "/tmp1"
},
{
name: "configlist",
enabled: true,
setPermissions: true,
mountPath: "/configlist",
hostPath: "/tmp2"
}
]
}
chart.value values
deployment = chart.resources(kind: "Deployment").first
initContainer = deployment["spec"]["template"]["spec"]["initContainers"][0]
assert_equal(results[:command], initContainer["command"])
end
end
end
end

View File

@ -85,7 +85,7 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_nil(mainContainer["env"])
assert_nil(mainContainer["env"][4])
end
it 'set static "k/v pair style" environment variables' do
@ -101,14 +101,14 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][1]["name"])
assert_equal(values[:env].values[0].to_s, mainContainer["env"][1]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][2]["name"])
assert_equal(values[:env].values[1].to_s, mainContainer["env"][2]["value"])
assert_equal(values[:env].keys[2].to_s, mainContainer["env"][3]["name"])
assert_equal(values[:env].values[2].to_s, mainContainer["env"][3]["value"])
assert_equal(values[:env].keys[3].to_s, mainContainer["env"][4]["name"])
assert_equal(values[:env].values[3].to_s, mainContainer["env"][4]["value"])
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][4]["name"])
assert_equal(values[:env].values[0].to_s, mainContainer["env"][4]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][5]["name"])
assert_equal(values[:env].values[1].to_s, mainContainer["env"][5]["value"])
assert_equal(values[:env].keys[2].to_s, mainContainer["env"][6]["name"])
assert_equal(values[:env].values[2].to_s, mainContainer["env"][6]["value"])
assert_equal(values[:env].keys[3].to_s, mainContainer["env"][7]["name"])
assert_equal(values[:env].values[3].to_s, mainContainer["env"][7]["value"])
end
it 'set list of static "kubernetes style" environment variables' do
@ -124,8 +124,8 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:envList][0][:name].to_s, mainContainer["env"][1]["name"])
assert_equal(values[:envList][0][:value].to_s, mainContainer["env"][1]["value"])
assert_equal(values[:envList][0][:name].to_s, mainContainer["env"][4]["name"])
assert_equal(values[:envList][0][:value].to_s, mainContainer["env"][4]["value"])
end
it 'set both static "k/v pair style" and static "k/valueFrom style" environment variables' do
@ -145,10 +145,10 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][1]["name"])
assert_equal(values[:env].values[0].to_s, mainContainer["env"][1]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][2]["name"])
assert_equal(values[:env].values[1][:valueFrom][:fieldRef][:fieldPath], mainContainer["env"][2]["valueFrom"]["fieldRef"]["fieldPath"])
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][4]["name"])
assert_equal(values[:env].values[0].to_s, mainContainer["env"][4]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][5]["name"])
assert_equal(values[:env].values[1][:valueFrom][:fieldRef][:fieldPath], mainContainer["env"][5]["valueFrom"]["fieldRef"]["fieldPath"])
end
it 'set static "k/explicitValueFrom pair style" environment variables' do
@ -167,8 +167,8 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][1]["name"])
assert_equal(values[:env].values[0][:valueFrom][:fieldRef][:fieldPath], mainContainer["env"][1]["valueFrom"]["fieldRef"]["fieldPath"])
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][4]["name"])
assert_equal(values[:env].values[0][:valueFrom][:fieldRef][:fieldPath], mainContainer["env"][4]["valueFrom"]["fieldRef"]["fieldPath"])
end
it 'set static "k/implicitValueFrom pair style" environment variables' do
@ -185,8 +185,8 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][1]["name"])
assert_equal(values[:env].values[0][:fieldRef][:fieldPath], mainContainer["env"][1]["valueFrom"]["fieldRef"]["fieldPath"])
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][4]["name"])
assert_equal(values[:env].values[0][:fieldRef][:fieldPath], mainContainer["env"][4]["valueFrom"]["fieldRef"]["fieldPath"])
end
it 'set both static "k/v pair style" and templated "k/v pair style" environment variables' do
@ -200,10 +200,10 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][1]["name"])
assert_equal("common-test-admin", mainContainer["env"][1]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][2]["name"])
assert_equal(values[:env].values[1].to_s, mainContainer["env"][2]["value"])
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][4]["name"])
assert_equal("common-test-admin", mainContainer["env"][4]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][5]["name"])
assert_equal(values[:env].values[1].to_s, mainContainer["env"][5]["value"])
end
it 'set templated "k/v pair style" environment variables' do
@ -216,8 +216,8 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][1]["name"])
assert_equal("common-test-admin", mainContainer["env"][1]["value"])
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][4]["name"])
assert_equal("common-test-admin", mainContainer["env"][4]["value"])
end
it 'set static "k/v pair style", templated "k/v pair style", static "k/explicitValueFrom pair style", and static "k/implicitValueFrom pair style" environment variables' do
@ -243,14 +243,14 @@ class Test < ChartTest
deployment = chart.resources(kind: "Deployment").first
containers = deployment["spec"]["template"]["spec"]["containers"]
mainContainer = containers.find{ |c| c["name"] == "common-test" }
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][1]["name"])
assert_equal("common-test-admin", mainContainer["env"][1]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][2]["name"])
assert_equal(values[:env].values[1].to_s, mainContainer["env"][2]["value"])
assert_equal(values[:env].keys[2].to_s, mainContainer["env"][3]["name"])
assert_equal(values[:env].values[2][:valueFrom][:fieldRef][:fieldPath], mainContainer["env"][3]["valueFrom"]["fieldRef"]["fieldPath"])
assert_equal(values[:env].keys[3].to_s, mainContainer["env"][4]["name"])
assert_equal(values[:env].values[3][:fieldRef][:fieldPath], mainContainer["env"][4]["valueFrom"]["fieldRef"]["fieldPath"])
assert_equal(values[:env].keys[0].to_s, mainContainer["env"][4]["name"])
assert_equal("common-test-admin", mainContainer["env"][4]["value"])
assert_equal(values[:env].keys[1].to_s, mainContainer["env"][5]["name"])
assert_equal(values[:env].values[1].to_s, mainContainer["env"][5]["value"])
assert_equal(values[:env].keys[2].to_s, mainContainer["env"][6]["name"])
assert_equal(values[:env].values[2][:valueFrom][:fieldRef][:fieldPath], mainContainer["env"][6]["valueFrom"]["fieldRef"]["fieldPath"])
assert_equal(values[:env].keys[3].to_s, mainContainer["env"][7]["name"])
assert_equal(values[:env].values[3][:fieldRef][:fieldPath], mainContainer["env"][7]["valueFrom"]["fieldRef"]["fieldPath"])
end
it 'set "static" secret variables' do