#11812 allow hostPath as datadir (#11815)

* allow hostPath as datadir

Signed-off-by: Michael Wyraz <michael.wyraz@evermind.de>

* Better documentation for hostPath as datadir, make the chown init-container optional

Signed-off-by: Michael Wyraz <michael.wyraz@evermind.de>
This commit is contained in:
micw
2019-02-28 11:07:33 -08:00
committed by Kubernetes Prow Robot
parent 62ba4e6b6d
commit e2d9b916e2
4 changed files with 33 additions and 1 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ keywords:
- redis
- keyvalue
- database
version: 3.2.0
version: 3.2.1
appVersion: 5.0.3
description: Highly available Kubernetes implementation of Redis
icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png
+2
View File
@@ -78,6 +78,8 @@ The following table lists the configurable parameters of the Redis chart and the
| `exporter.tag` | Exporter tag | `v0.28.0` |
| `exporter.annotations` | Prometheus scrape annotations | `{prometheus.io/path: /metrics, prometheus.io/port: "9121", prometheus.io/scrape: "true"}` |
| `exporter.extraArgs` | Additional args for the exporter | `{}` |
| `hostPath.path` | Use this path on the host for data storage | not set |
| `hostPath.chown` | Run an init-container as root to set ownership on the hostPath | true |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@@ -49,6 +49,20 @@ spec:
securityContext:
{{ toYaml .Values.securityContext | indent 8 }}
initContainers:
{{- if and .Values.hostPath.path .Values.hostPath.chown }}
- name: hostpath-chown
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
securityContext:
runAsNonRoot: false
runAsUser: 0
command:
- chown
- "{{ .Values.securityContext.runAsUser }}"
- /data
volumeMounts:
- name: data
mountPath: /data
{{- end }}
- name: config-init
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
@@ -225,6 +239,10 @@ spec:
storageClassName: "{{ .Values.persistentVolume.storageClass }}"
{{- end }}
{{- end }}
{{- else if .Values.hostPath.path }}
- name: data
hostPath:
path: {{ tpl .Values.hostPath.path .}}
{{- else }}
- name: data
emptyDir: {}
+12
View File
@@ -138,3 +138,15 @@ persistentVolume:
annotations: {}
init:
resources: {}
# To use a hostPath for data, set persistentVolume.enabled to false
# and define hostPath.path.
# Warning: this might overwrite existing folders on the host system!
hostPath:
## path is evaluated as template so placeholders are replaced
# path: "/data/{{ .Release.Name }}"
# if chown is true, an init-container with root permissions is launched to
# change the owner of the hostPath folder to the user defined in the
# security context
chown: true