diff --git a/charts/library/common/Chart.yaml b/charts/library/common/Chart.yaml index cccfcac3bfc..f57a4721ff3 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.8.1 +version: 6.8.2 diff --git a/charts/library/common/templates/classes/_mountPermissions.tpl b/charts/library/common/templates/classes/_mountPermissions.tpl index 640fdfd2f7c..24b5ca3e0ad 100644 --- a/charts/library/common/templates/classes/_mountPermissions.tpl +++ b/charts/library/common/templates/classes/_mountPermissions.tpl @@ -5,13 +5,10 @@ before chart installation. {{- define "common.class.mountPermissions" -}} {{- if .Values.persistence -}} {{- $jobName := include "common.names.fullname" . -}} - {{- $user := 568 -}} {{- $group := 568 -}} {{- if .Values.env -}} - {{- $user = dig "PUID" $user .Values.env -}} {{- $group = dig "PGID" $group .Values.env -}} {{- end -}} - {{- $user = dig "runAsUser" $user .Values.podSecurityContext -}} {{- $group = dig "fsGroup" $group .Values.podSecurityContext -}} {{- $hostPathMounts := dict -}} {{- range $name, $mount := .Values.persistence -}} @@ -45,7 +42,7 @@ spec: - -c - | {{- range $_, $hpm := $hostPathMounts }} - chown -R {{ printf "%d:%d %s" (int $user) (int $group) $hpm.mountPath }} + chown -R {{ printf ":%d %s" (int $group) $hpm.mountPath }} {{- end }} volumeMounts: {{- range $name, $hpm := $hostPathMounts }} diff --git a/charts/library/common/tests/permissions_job_test.go b/charts/library/common/tests/permissions_job_test.go index 3783b8e7b46..7154c0ba566 100644 --- a/charts/library/common/tests/permissions_job_test.go +++ b/charts/library/common/tests/permissions_job_test.go @@ -139,7 +139,7 @@ func (suite *PermissionsJobTestSuite) TestCommand() { "DefaultPermissionsForMultipleMounts": { values: baseValues, expectedCommand: []string{ - "/bin/sh", "-c", "chown -R 568:568 /config\nchown -R 568:568 /data\n", + "/bin/sh", "-c", "chown -R :568 /config\nchown -R :568 /data\n", }, }, "DefaultPermissionsForDisabledpodSecurityContext": { @@ -147,7 +147,7 @@ func (suite *PermissionsJobTestSuite) TestCommand() { "podSecurityContext.allowPrivilegeEscalation=false", ), expectedCommand: []string{ - "/bin/sh", "-c", "chown -R 568:568 /config\nchown -R 568:568 /data\n", + "/bin/sh", "-c", "chown -R :568 /config\nchown -R :568 /data\n", }, }, "PermissionsForFsGroup": { @@ -155,33 +155,15 @@ func (suite *PermissionsJobTestSuite) TestCommand() { "podSecurityContext.fsGroup=666", ), expectedCommand: []string{ - "/bin/sh", "-c", "chown -R 568:666 /config\nchown -R 568:666 /data\n", + "/bin/sh", "-c", "chown -R :666 /config\nchown -R :666 /data\n", }, }, - "PermissionsForRunAsUser": { + "PermissionsForPgid": { values: append(baseValues, - "podSecurityContext.runAsUser=999", - ), - expectedCommand: []string{ - "/bin/sh", "-c", "chown -R 999:568 /config\nchown -R 999:568 /data\n", - }, - }, - "PermissionsForRunAsUserAndFsGroup": { - values: append(baseValues, - "podSecurityContext.runAsUser=999", - "podSecurityContext.fsGroup=666", - ), - expectedCommand: []string{ - "/bin/sh", "-c", "chown -R 999:666 /config\nchown -R 999:666 /data\n", - }, - }, - "PermissionsForPgidPuid": { - values: append(baseValues, - "env.PUID=999", "env.PGID=666", ), expectedCommand: []string{ - "/bin/sh", "-c", "chown -R 999:666 /config\nchown -R 999:666 /data\n", + "/bin/sh", "-c", "chown -R :666 /config\nchown -R :666 /data\n", }, }, }