diff --git a/stable/mongodb/Chart.yaml b/stable/mongodb/Chart.yaml index 40b60d9401..6e0358e43e 100644 --- a/stable/mongodb/Chart.yaml +++ b/stable/mongodb/Chart.yaml @@ -1,5 +1,5 @@ name: mongodb -version: 1.0.1 +version: 1.0.2 appVersion: 3.7.3 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/templates/deployment.yaml b/stable/mongodb/templates/deployment.yaml index 0abdf0b0bd..8f02126277 100644 --- a/stable/mongodb/templates/deployment.yaml +++ b/stable/mongodb/templates/deployment.yaml @@ -35,11 +35,13 @@ spec: key: mongodb-root-password - name: MONGODB_USERNAME value: {{ default "" .Values.mongodbUsername | quote }} + {{ if and .Values.mongodbUsername .Values.mongodbDatabase }} - name: MONGODB_PASSWORD valueFrom: secretKeyRef: name: {{ template "mongodb.fullname" . }} key: mongodb-password + {{ end }} - name: MONGODB_DATABASE value: {{ default "" .Values.mongodbDatabase | quote }} ports: diff --git a/stable/mongodb/templates/secrets.yaml b/stable/mongodb/templates/secrets.yaml index 7d2d4047bf..2726aa1c6e 100644 --- a/stable/mongodb/templates/secrets.yaml +++ b/stable/mongodb/templates/secrets.yaml @@ -14,8 +14,10 @@ data: {{ else }} mongodb-root-password: {{ randAlphaNum 10 | b64enc | quote }} {{ end }} + {{ if and .Values.mongodbUsername .Values.mongodbDatabase }} {{ if .Values.mongodbPassword }} mongodb-password: {{ .Values.mongodbPassword | b64enc | quote }} {{ else }} mongodb-password: {{ randAlphaNum 10 | b64enc | quote }} + {{ end }} {{ end }} \ No newline at end of file