allow setting readOnly on customStorage and limit permissionsmounts (#357)

* alles setting readOnly on customStorage

* update common version and example

* fix a typo

* Limit volume mounting for permission fix to relevant volumes.
This commit is contained in:
Kjeld Schouten-Lebbing
2021-04-15 16:45:50 +02:00
committed by GitHub
parent 369f0e1c00
commit aeab9be5d2
6 changed files with 39 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
apiVersion: v2
kubeVersion: ">=1.16.0-0"
name: common-test
version: 2.1.3
version: 2.1.4
# upstream_version:
appVersion: none
description: Helper chart to test different use cases of the common library

View File

@@ -55,7 +55,6 @@ additionalIngress:
enabled: true
# these values and names are set specifically with the unittests in mind.
fixMountPermissions: false
deviceMounts:
test1:
enabled: true

View File

@@ -1,7 +1,7 @@
apiVersion: v2
kubeVersion: ">=1.16.0-0"
name: common
version: 3.0.4
version: 3.5.0
# upstream_version:
appVersion: none
description: Function library for TrueCharts

View File

@@ -37,6 +37,9 @@ Volumes included by the controller.
{{ if $csm.subPath }}
subPath: {{ $csm.subPath }}
{{ end }}
{{ if $csm.readOnly }}
readOnly: {{ $csm.readOnly }}
{{ end }}
{{- end -}}
{{ end }}

View File

@@ -40,11 +40,40 @@ spec:
#securityContext:
#
volumeMounts:
{{- include "common.controller.volumeMounts" . | indent 12 }}
{{- with (include "common.controller.volumes" . | trim) }}
{{ range $name, $csm := .Values.customStorage }}
{{- if $csm.enabled -}}
{{- if $csm.setPermissions -}}
{{ if $csm.name }}
{{ $name = $csm.name }}
{{ end }}
- name: customstorage-{{ $name }}
mountPath: {{ $csm.mountPath }}
{{ if $csm.subPath }}
subPath: {{ $csm.subPath }}
{{ end }}
{{ if $csm.readOnly }}
readOnly: {{ $csm.readOnly }}
{{ end }}
{{- end -}}
{{- end -}}
{{ end }}
volumes:
{{- . | nindent 8 }}
{{- end }}
{{- range $name, $cs := .Values.customStorage -}}
{{ if $cs.enabled }}
{{ if $cs.setPermissions }}
{{ if $cs.name }}
{{ $name = $cs.name }}
{{ end }}
- name: customstorage-{{ $name }}
{{ if $cs.emptyDir }}
emptyDir: {}
{{- else -}}
hostPath:
path: {{ required "hostPath not set" $cs.hostPath }}
{{ end }}
{{ end }}
{{ end }}
{{- end -}}
{{- end }}

View File

@@ -310,4 +310,5 @@ fixMountPermissions: true
# mountPath: "/data"
# subPath: some-subpath
# hostPath: ""
# readOnly: false
# setPermissions: true