From ee185178187d356484f36803c97caac6da89e5a5 Mon Sep 17 00:00:00 2001 From: Juan Ariza Toledano Date: Tue, 2 Apr 2019 17:43:32 +0200 Subject: [PATCH] [stable/mongodb] Add support to specify the volumeMounts' mountPath & subPath (#12756) Signed-off-by: juan131 --- stable/mongodb/Chart.yaml | 2 +- stable/mongodb/README.md | 6 ++++-- stable/mongodb/templates/deployment-standalone.yaml | 3 ++- stable/mongodb/templates/statefulset-primary-rs.yaml | 3 ++- .../mongodb/templates/statefulset-secondary-rs.yaml | 3 ++- stable/mongodb/values-production.yaml | 11 +++++++++++ stable/mongodb/values.yaml | 11 +++++++++++ 7 files changed, 33 insertions(+), 6 deletions(-) diff --git a/stable/mongodb/Chart.yaml b/stable/mongodb/Chart.yaml index 3795054bf9..5df8ea7948 100644 --- a/stable/mongodb/Chart.yaml +++ b/stable/mongodb/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: mongodb -version: 5.14.2 +version: 5.15.0 appVersion: 4.0.8 description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications. keywords: diff --git a/stable/mongodb/README.md b/stable/mongodb/README.md index b8ddab490a..76d919615f 100644 --- a/stable/mongodb/README.md +++ b/stable/mongodb/README.md @@ -93,6 +93,8 @@ The following table lists the configurable parameters of the MongoDB chart and t | `securityContext.fsGroup` | Group ID for the container | `1001` | | `securityContext.runAsUser` | User ID for the container | `1001` | | `persistence.enabled` | Use a PVC to persist data | `true` | +| `persistence.mountPath` | Path to mount the volume at | `/bitnami/mongodb` | +| `persistence.subPath` | Subdirectory of the volume to mount at | `""` | | `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) | | `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` | | `persistence.size` | Size of data volume | `8Gi` | @@ -217,7 +219,7 @@ $ kubectl delete statefulset my-release-mongodb-arbiter my-release-mongodb-prima MongoDB can exposed externally using the [NGINX Ingress Controller](https://github.com/kubernetes/ingress-nginx). To do so, it's necessary to: - Install the MongoDB chart setting the parameter `ingress.enabled=true`. -- Create a ConfigMap to map the external port to use and the internal service/port where to redirect the requests (see https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/exposing-tcp-udp-services.md for more information). +- Create a ConfigMap to map the external port to use and the internal service/port where to redirect the requests (see https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/exposing-tcp-udp-services.md for more information). For instance, if you installed the MongoDB chart in the `default` namespace, you can install the [stable/nginx-ingress chart](https://github.com/helm/charts/tree/master/stable/nginx-ingress) setting the "tcp" parameter in the **values.yaml** used to install the chart as shown below: @@ -226,4 +228,4 @@ For instance, if you installed the MongoDB chart in the `default` namespace, you tcp: 27017: "default/mongodb:27017" -``` \ No newline at end of file +``` diff --git a/stable/mongodb/templates/deployment-standalone.yaml b/stable/mongodb/templates/deployment-standalone.yaml index 4ad3099a9a..879ed3ea00 100644 --- a/stable/mongodb/templates/deployment-standalone.yaml +++ b/stable/mongodb/templates/deployment-standalone.yaml @@ -147,7 +147,8 @@ spec: {{- end }} volumeMounts: - name: data - mountPath: /bitnami/mongodb + mountPath: {{ .Values.persistence.mountPath }} + subPath: {{ .Values.persistence.subPath }} {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*[sh|js|json]") (.Values.initConfigMap) }} - name: custom-init-scripts mountPath: /docker-entrypoint-initdb.d diff --git a/stable/mongodb/templates/statefulset-primary-rs.yaml b/stable/mongodb/templates/statefulset-primary-rs.yaml index bd87daf070..768ff6fc72 100644 --- a/stable/mongodb/templates/statefulset-primary-rs.yaml +++ b/stable/mongodb/templates/statefulset-primary-rs.yaml @@ -173,7 +173,8 @@ spec: {{- end }} volumeMounts: - name: datadir - mountPath: /bitnami/mongodb + mountPath: {{ .Values.persistence.mountPath }} + subPath: {{ .Values.persistence.subPath }} {{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*[sh|js|json]") (.Values.initConfigMap) }} - name: custom-init-scripts mountPath: /docker-entrypoint-initdb.d diff --git a/stable/mongodb/templates/statefulset-secondary-rs.yaml b/stable/mongodb/templates/statefulset-secondary-rs.yaml index a73adf36c7..9fd218314f 100644 --- a/stable/mongodb/templates/statefulset-secondary-rs.yaml +++ b/stable/mongodb/templates/statefulset-secondary-rs.yaml @@ -161,7 +161,8 @@ spec: {{- end }} volumeMounts: - name: datadir - mountPath: /bitnami/mongodb + mountPath: {{ .Values.persistence.mountPath }} + subPath: {{ .Values.persistence.subPath }} {{- if .Values.configmap }} - name: config mountPath: /opt/bitnami/mongodb/conf/mongodb.conf diff --git a/stable/mongodb/values-production.yaml b/stable/mongodb/values-production.yaml index 498c2e2ead..4b63740d70 100644 --- a/stable/mongodb/values-production.yaml +++ b/stable/mongodb/values-production.yaml @@ -181,8 +181,19 @@ persistence: ## A manually managed Persistent Volume and Claim ## Requires persistence.enabled: true ## If defined, PVC must be created manually before volume will be bound + ## # existingClaim: + ## The path the volume will be mounted at, useful when using different + ## MongoDB images. + ## + mountPath: /bitnami/mongodb + + ## The subdirectory of the volume to mount to, useful in dev environments + ## and one PV for multiple services. + ## + subPath: "" + ## mongodb data Persistent Volume Storage Class ## If defined, storageClassName: ## If set to "-", storageClassName: "", which disables dynamic provisioning diff --git a/stable/mongodb/values.yaml b/stable/mongodb/values.yaml index 1793019981..ff0ef0b2b4 100644 --- a/stable/mongodb/values.yaml +++ b/stable/mongodb/values.yaml @@ -180,8 +180,19 @@ persistence: ## A manually managed Persistent Volume and Claim ## Requires persistence.enabled: true ## If defined, PVC must be created manually before volume will be bound + ## # existingClaim: + ## The path the volume will be mounted at, useful when using different + ## MongoDB images. + ## + mountPath: /bitnami/mongodb + + ## The subdirectory of the volume to mount to, useful in dev environments + ## and one PV for multiple services. + ## + subPath: "" + ## mongodb data Persistent Volume Storage Class ## If defined, storageClassName: ## If set to "-", storageClassName: "", which disables dynamic provisioning