From 91ad22be979c86a793fb4fa3002a09b4fff71e97 Mon Sep 17 00:00:00 2001 From: Aroosha Pervaiz Date: Thu, 30 Mar 2023 12:00:20 +0200 Subject: [PATCH] Explicitly specifying node names in values.yaml. --- helm/mongodb/Chart.yaml | 4 ++-- helm/mongodb/templates/deployment.yaml | 17 ++++++++++++++--- helm/mongodb/values.yaml | 15 +++++++++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/helm/mongodb/Chart.yaml b/helm/mongodb/Chart.yaml index a52723376..36cc9a278 100644 --- a/helm/mongodb/Chart.yaml +++ b/helm/mongodb/Chart.yaml @@ -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 diff --git a/helm/mongodb/templates/deployment.yaml b/helm/mongodb/templates/deployment.yaml index 93ef74019..d8f292a03 100644 --- a/helm/mongodb/templates/deployment.yaml +++ b/helm/mongodb/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- $environment := .Values.environment | default dict }} --- apiVersion: v1 kind: Service @@ -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" diff --git a/helm/mongodb/values.yaml b/helm/mongodb/values.yaml index 19ab3647e..b00bb83f2 100644 --- a/helm/mongodb/values.yaml +++ b/helm/mongodb/values.yaml @@ -1,3 +1,4 @@ +environment: test quickSetting: namespace: default env: test-rs @@ -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