From cc1cde7fdc14092689480030eff95ed08c908a2c Mon Sep 17 00:00:00 2001 From: Kjeld Schouten-Lebbing Date: Thu, 9 Sep 2021 14:20:26 +0200 Subject: [PATCH] fix: ensure supplementalgroups when using devices are actually added (#942) --- charts/library/common/Chart.yaml | 2 +- .../common/templates/lib/chart/_values.tpl | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index 0d66063a5bd..f80e40b5804 100644 --- a/charts/library/common/Chart.yaml +++ b/charts/library/common/Chart.yaml @@ -18,4 +18,4 @@ maintainers: name: common sources: null type: library -version: 6.13.9 +version: 6.13.10 diff --git a/charts/library/common/templates/lib/chart/_values.tpl b/charts/library/common/templates/lib/chart/_values.tpl index 98a189757cf..7f935b00396 100644 --- a/charts/library/common/templates/lib/chart/_values.tpl +++ b/charts/library/common/templates/lib/chart/_values.tpl @@ -129,25 +129,29 @@ {{- $_ := set .Values.securityContext "privileged" true -}} {{- end }} - {{/* save supplementalGroups to placeholder variable */}} - {{- $supGroups := list }} - {{ if .Values.podSecurityContext.supplementalGroups }} - {{- $supGroups = .Values.podSecurityContext.supplementalGroups }} + {{/* save supplementalGroups to placeholder variables */}} + {{- $fixedGroups := list 568 }} + {{- $valuegroups := list }} + {{- $devGroups := list }} + {{- $gpuGroups := list }} + + {{/* put user-entered supplementalgroups in placeholder variable */}} + {{- if .Values.podSecurityContext.supplementalGroups }} + {{- $valuegroups = .Values.podSecurityContext.supplementalGroups }} {{- end }} {{/* Append requered groups to supplementalGroups when deviceList is used */}} {{- if .Values.deviceList}} - {{- $devGroups := list 5 20 24 }} - {{- $supGroups := list ( concat $supGroups $devGroups ) }} + {{- $devGroups = list 5 20 24 }} {{- end }} {{/* Append requered groups to supplementalGroups when scaleGPU is used */}} {{- if .Values.scaleGPU }} - {{- $gpuGroups := list 44 107 }} - {{- $supGroups := list ( concat $supGroups $gpuGroups ) }} + {{- $gpuGroups = list 44 107 }} {{- end }} - {{/* write appended supplementalGroups to .Values */}} + {{/* combine and write all supplementalGroups to .Values */}} + {{- $supGroups := concat $fixedGroups $valuegroups $devGroups $gpuGroups }} {{- $_ := set .Values.podSecurityContext "supplementalGroups" $supGroups -}} {{/* merge serviceList with service */}}