From cd09ccfcdb97b2540dad466103c838610ef14710 Mon Sep 17 00:00:00 2001 From: "aleksey.sergey" Date: Mon, 20 Dec 2021 19:58:44 +0800 Subject: [PATCH] add support for persistence.subPath option (#263) Hello, PR adds a `persistence.subPath` option to provide user more flexibility on mounting the `data` PV. https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath The setting is similar to e.g. `primary.persistence.subPath` in MariaDB helm chart: https://github.com/bitnami/charts/tree/master/bitnami/mariadb Co-authored-by: Aleksey Sergey Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/263 Reviewed-by: justusbunsi Reviewed-by: luhahn Co-authored-by: aleksey.sergey Co-committed-by: aleksey.sergey --- README.md | 3 ++- templates/gitea/statefulset.yaml | 12 ++++++++++++ values.yaml | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59db63e..f220d31 100644 --- a/README.md +++ b/README.md @@ -581,7 +581,7 @@ gitea: | `extraVolumeMounts` | Additional volume mounts for the Gitea containers | `{}` | | `initPreScript` | Bash script copied verbatim to start of init container | | | `podSecurityContext.fsGroup` | Set the shared file system group for all containers | 1000 | -| `containerSecurityContext` | Run init and gitea containers as a specific securityContext | `{}` | +| `containerSecurityContext` | Run init and Gitea containers as a specific securityContext | `{}` | | `schedulerName` | Use an alternate scheduler, e.g. "stork" | | ### Image @@ -602,6 +602,7 @@ gitea: | `persistence.size` | Size for persistence to store repo information | `10Gi` | | `persistence.accessModes` | AccessMode for persistence | | | `persistence.storageClass` | Storage class for repository persistence | | +| `persistence.subPath` | Subdirectory of the volume to mount at | | | `persistence.labels` | Labels for the persistence volume claim to be created | `{}` | | `persistence.annotations` | Annotations for the persistence volume claim to be created | `{}` | diff --git a/templates/gitea/statefulset.yaml b/templates/gitea/statefulset.yaml index 734f342..66dd287 100644 --- a/templates/gitea/statefulset.yaml +++ b/templates/gitea/statefulset.yaml @@ -62,6 +62,9 @@ spec: mountPath: /tmp - name: data mountPath: /data + {{- if .Values.persistence.subPath }} + subPath: {{ .Values.persistence.subPath }} + {{- end }} {{- if .Values.extraVolumeMounts }} {{- toYaml .Values.extraVolumeMounts | nindent 12 }} {{- end }} @@ -89,6 +92,9 @@ spec: mountPath: /tmp - name: data mountPath: /data + {{- if .Values.persistence.subPath }} + subPath: {{ .Values.persistence.subPath }} + {{- end }} {{- if .Values.extraVolumeMounts }} {{- toYaml .Values.extraVolumeMounts | nindent 12 }} {{- end }} @@ -161,6 +167,9 @@ spec: mountPath: /tmp - name: data mountPath: /data + {{- if .Values.persistence.subPath }} + subPath: {{ .Values.persistence.subPath }} + {{- end }} {{- if .Values.extraVolumeMounts }} {{- toYaml .Values.extraVolumeMounts | nindent 12 }} {{- end }} @@ -227,6 +236,9 @@ spec: mountPath: /tmp - name: data mountPath: /data + {{- if .Values.persistence.subPath }} + subPath: {{ .Values.persistence.subPath }} + {{- end }} {{- if .Values.extraVolumeMounts }} {{- toYaml .Values.extraVolumeMounts | nindent 12 }} {{- end }} diff --git a/values.yaml b/values.yaml index 1290ef9..5740b7f 100644 --- a/values.yaml +++ b/values.yaml @@ -121,6 +121,7 @@ persistence: labels: {} annotations: {} # storageClass: + # subPath: # additional volumes to add to the Gitea statefulset. extraVolumes: