diff --git a/charts/litmus/templates/auth-server-deployment.yaml b/charts/litmus/templates/auth-server-deployment.yaml index e7ce1c63..fbe334e2 100644 --- a/charts/litmus/templates/auth-server-deployment.yaml +++ b/charts/litmus/templates/auth-server-deployment.yaml @@ -37,7 +37,7 @@ spec: {{- end }} initContainers: - name: wait-for-mongodb - image: mongo:latest + image: {{ .Values.portal.server.waitForMongodb.image.repository }}:{{ .Values.portal.server.waitForMongodb.image.tag }} imagePullPolicy: {{ .Values.portal.server.waitForMongodb.image.pullPolicy }} command: ["/bin/bash", "-c"] env: @@ -66,9 +66,14 @@ spec: name: {{ include "litmus-portal.secretname" . }} key: DB_USER {{- end }} + - name: DB_SERVER + valueFrom: + configMapKeyRef: + name: {{ include "litmus-portal.fullname" . }}-admin-config + key: DB_SERVER args: [ - "until mongosh -u ${DB_USER} -p ${DB_PASSWORD} {{ include "litmus-portal.mongodbConnectionString" . }} --eval 'rs.status()' | grep 'ok' &> /dev/null; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'", + "until [[ $(mongosh -u ${DB_USER} -p ${DB_PASSWORD} ${DB_SERVER} --eval 'rs.status()' | grep 'ok' | wc -l) -eq 1 ]]; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'", ] resources: {{- toYaml .Values.portal.server.waitForMongodb.resources | nindent 12 }} diff --git a/charts/litmus/templates/server-deployment.yaml b/charts/litmus/templates/server-deployment.yaml index a9c281a7..a9a0d3b5 100644 --- a/charts/litmus/templates/server-deployment.yaml +++ b/charts/litmus/templates/server-deployment.yaml @@ -36,7 +36,7 @@ spec: {{- toYaml .Values.portal.server.graphqlServer.volumes | default "" | nindent 8 }} initContainers: - name: wait-for-mongodb - image: mongo:latest + image: {{ .Values.portal.server.waitForMongodb.image.repository }}:{{ .Values.portal.server.waitForMongodb.image.tag }} imagePullPolicy: {{ .Values.portal.server.waitForMongodb.image.pullPolicy }} command: ["/bin/bash", "-c"] env: @@ -65,9 +65,14 @@ spec: name: {{ include "litmus-portal.secretname" . }} key: DB_USER {{- end }} + - name: DB_SERVER + valueFrom: + configMapKeyRef: + name: {{ include "litmus-portal.fullname" . }}-admin-config + key: DB_SERVER args: [ - "until [[ $(mongosh -u ${DB_USER} -p ${DB_PASSWORD} {{ include "litmus-portal.mongodbConnectionString" . }} --eval 'rs.status()' | grep 'ok' | wc -l) -eq 1 ]]; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'", + "until [[ $(mongosh -u ${DB_USER} -p ${DB_PASSWORD} ${DB_SERVER} --eval 'rs.status()' | grep 'ok' | wc -l) -eq 1 ]]; do sleep 5; echo 'Waiting for the MongoDB to be ready...'; done; echo 'Connection with MongoDB established'", ] resources: {{- toYaml .Values.portal.server.waitForMongodb.resources | nindent 12 }} diff --git a/charts/litmus/values.yaml b/charts/litmus/values.yaml index 4124a948..b9bcd5c5 100644 --- a/charts/litmus/values.yaml +++ b/charts/litmus/values.yaml @@ -18,8 +18,8 @@ adminConfig: VERSION: "ci" SKIP_SSL_VERIFY: "false" # -- leave empty if uses Mongo DB deployed by this chart - DBPASSWORD: "1234" - DBUSER: "root" + DBPASSWORD: "" + DBUSER: "" DB_SERVER: "" DB_PORT: "" ADMIN_USERNAME: "admin" @@ -165,8 +165,8 @@ portal: # my.company.com/tier: "backend" waitForMongodb: image: - repository: curl - tag: ci + repository: mongo + tag: 6 pullPolicy: "Always" securityContext: {}