Skip to content

Commit

Permalink
Merge pull request #1343 from arooshap/mongodb-specification
Browse files Browse the repository at this point in the history
Explicitly specifying node names in `values.yaml.`
  • Loading branch information
arooshap authored Apr 4, 2023
2 parents f5832b5 + 91ad22b commit 5ddabf6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
4 changes: 2 additions & 2 deletions helm/mongodb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: mongodb
description: A Helm chart for launching a MongoDB ReplicaSet with 3 instances
type: application
version: 1.0.3
appVersion: 1.0.3
version: 1.0.4
appVersion: 1.0.4
17 changes: 14 additions & 3 deletions helm/mongodb/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- $environment := .Values.environment | default dict }}
---
apiVersion: v1
kind: Service
Expand Down Expand Up @@ -65,12 +66,22 @@ spec:
env:
- name: "RS_NAME"
value: {{.Values.db.rsname}}
{{- if (eq (toString $environment) "prod") }}
- name: "NODE_HOSTNAME_ONE"
value: {{.Values.db.nodeHostname.one}}
value: {{.Values.db.nodeName.prod.one}}
- name: "NODE_HOSTNAME_TWO"
value: {{.Values.db.nodeHostname.two}}
value: {{.Values.db.nodeName.prod.two}}
- name: "NODE_HOSTNAME_THREE"
value: {{.Values.db.nodeHostname.three}}
value: {{.Values.db.nodeName.prod.three}}
{{- end }}
{{- if (eq (toString $environment) "preprod")}}
- name: "NODE_HOSTNAME_ONE"
value: {{.Values.db.nodeName.preprod.one}}
- name: "NODE_HOSTNAME_TWO"
value: {{.Values.db.nodeName.preprod.two}}
- name: "NODE_HOSTNAME_THREE"
value: {{.Values.db.nodeName.preprod.three}}
{{- end }}
- name: "MONGODB_ID"
value: {{.Values.db.instance0.mongoId | quote}}
- name: "MONGODB_ADMIN_PASSWORD"
Expand Down
15 changes: 11 additions & 4 deletions helm/mongodb/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
environment: test
quickSetting:
namespace: default
env: test-rs
Expand All @@ -12,12 +13,18 @@ monitoring:
jobName: "mongodb-exporter"
db:
rsname: "cms-rs"
nodeHostname:
one: nodeHostName1
two: nodeHostName2
three: nodeHostName3
clusterName: mongodb
env: k8s-mongo
#ensuring different explicit node names for prod and preprod cluster
nodeName:
prod:
one: cms-mongo-prod-node-0.cern.ch
two: cms-mongo-prod-node-1.cern.ch
three: cms-mongo-prod-node-2.cern.ch
preprod:
one: cms-mongo-preprod-node-0.cern.ch
two: cms-mongo-preprod-node-1.cern.ch
three: cms-mongo-preprod-node-2.cern.ch
auth:
password: password
keyfile: keyfile
Expand Down

0 comments on commit 5ddabf6

Please sign in to comment.