Merge "make sdnctl user db password configurable for SDNC"
[oom.git] / kubernetes / sdnc / templates / statefulset.yaml
index fd4f81b..03ae880 100644 (file)
@@ -23,7 +23,7 @@ metadata:
     release: {{ .Release.Name }}
     heritage: {{ .Release.Service }}
 spec:
-  serviceName: "{{ .Values.service.name }}-cluster"
+  serviceName: {{ include "common.servicename" . }}-cluster
   replicas: {{ .Values.replicaCount }}
   podManagementPolicy: Parallel
   template:
@@ -49,7 +49,7 @@ spec:
         name: {{ include "common.name" . }}-readiness
       containers:
         - name: {{ include "common.name" . }}
-          image: "{{ .Values.global.repository | default .Values.repository }}/{{ .Values.image }}"
+          image: "{{ include "common.repository" . }}/{{ .Values.image }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           command: ["/bin/bash"]
           args: ["-c", "/opt/sdnc/bin/startODL.sh"]
@@ -69,10 +69,28 @@ spec:
                 secretKeyRef:
                   name: {{ template "common.fullname" . }}
                   key: db-root-password
+            - name: ODL_ADMIN_PASSWORD
+              valueFrom:
+                secretKeyRef:
+                  name: {{ template "common.fullname" . }}-odl
+                  key: odl-password
+            - name: SDNC_DB_PASSWORD
+              valueFrom:
+                secretKeyRef:
+                  name: {{ template "common.fullname" . }}-sdnctl
+                  key: db-sdnctl-password
             - name: SDNC_CONFIG_DIR
               value: "{{ .Values.config.configDir }}"
             - name: ENABLE_ODL_CLUSTER
               value: "{{ .Values.config.enableClustering }}"
+            - name: MY_ODL_CLUSTER
+              value: "{{ .Values.config.myODLCluster }}"
+            - name: PEER_ODL_CLUSTER
+              value: "{{ .Values.config.peerODLCluster }}"
+            - name: IS_PRIMARY_CLUSTER
+              value: "{{ .Values.config.isPrimaryCluster }}"
+            - name: GEO_ENABLED
+              value: "{{ .Values.config.geoEnabled}}"
             - name: SDNC_REPLICAS
               value: "{{ .Values.replicaCount }}"
             - name: MYSQL_HOST
@@ -84,24 +102,29 @@ spec:
           - mountPath: /opt/opendaylight/current/etc/org.ops4j.pax.logging.cfg
             name: sdnc-logging-cfg-config
             subPath: org.ops4j.pax.logging.cfg
-          - mountPath: /opt/onap/sdnc/bin/startODL.sh
-            name: startodl
+          - mountPath: {{ .Values.config.binDir }}/startODL.sh
+            name: bin
             subPath: startODL.sh
-          - mountPath: /opt/onap/sdnc/bin/installSdncDb.sh
-            name: installsdncdb
+          - mountPath: {{ .Values.config.binDir }}/installSdncDb.sh
+            name: bin
             subPath: installSdncDb.sh
-          - mountPath: /opt/onap/sdnc/data/properties/aaiclient.properties
-            name: aaiclient-conf
+          - mountPath: {{ .Values.config.configDir }}/aaiclient.properties
+            name: properties
             subPath: aaiclient.properties
-          - mountPath: /opt/onap/sdnc/data/properties/dblib.properties
-            name: sdnc-dblib-properties
+          - mountPath: {{ .Values.config.configDir }}/dblib.properties
+            name: properties
             subPath: dblib.properties
-          - mountPath: /opt/onap/sdnc/data/properties/svclogic.properties
-            name: sdnc-svclogic-config
+          - mountPath: {{ .Values.config.configDir }}/lcm-dg.properties
+            name: properties
+            subPath: lcm-dg.properties
+          - mountPath: {{ .Values.config.configDir }}/svclogic.properties
+            name: properties
             subPath: svclogic.properties
           - mountPath: /opt/onap/sdnc/svclogic/config/svclogic.properties
-            name: onap-sdnc-svclogic-config
+            name: properties
             subPath: svclogic.properties
+          - mountPath: {{ .Values.persistence.mdsalPath }}
+            name: {{ include "common.fullname" . }}-mdsal
           - mountPath: /var/log/onap
             name: logs
           resources:
@@ -127,6 +150,8 @@ spec:
             name: logs
           - mountPath: /usr/share/filebeat/data
             name: data-filebeat
+      imagePullSecrets:
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
       volumes:
         - name: localtime
           hostPath:
@@ -141,48 +166,27 @@ spec:
         - name: sdnc-logging-cfg-config
           configMap:
             name: {{ include "common.fullname" . }}-log-configmap
-        - name: startodl
-          configMap:
-            name: {{ include "common.fullname" . }}-startodl
-            items:
-            - key: startODL.sh
-              path: startODL.sh
-              mode: 0755
-        - name: installsdncdb
-          configMap:
-            name: {{ include "common.fullname" . }}-installsdncdb
-            items:
-            - key: installSdncDb.sh
-              path: installSdncDb.sh
-              mode: 0755
-        - name: aaiclient-conf
+        - name: bin
           configMap:
-            name: {{ include "common.fullname" . }}-aaiclient-properties
-            items:
-            - key: aaiclient.properties
-              path: aaiclient.properties
-              mode: 0644
-        - name: sdnc-dblib-properties
+            name: {{ include "common.fullname" . }}-bin
+            defaultMode: 0755
+        - name: properties
           configMap:
-            name: {{ include "common.fullname" . }}-dblib-properties
-            items:
-            - key: dblib.properties
-              path: dblib.properties
-              mode: 0644
-        - name: sdnc-svclogic-config
-          configMap:
-            name: {{ include "common.fullname" . }}-svclogic-config
-            items:
-            - key: svclogic.properties
-              path: svclogic.properties
-              mode: 0644
-        - name: onap-sdnc-svclogic-config
-          configMap:
-            name: {{ include "common.fullname" . }}-onap-sdnc-svclogic-config
-            items:
-            - key: svclogic.properties
-              path: svclogic.properties
-              mode: 0644
-
-      imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
+            name: {{ include "common.fullname" . }}-properties
+            defaultMode: 0644
+  {{ if not .Values.persistence.enabled }}
+        - name: {{ include "common.fullname" . }}-mdsal
+          emptyDir: {}
+  {{ else }}
+  volumeClaimTemplates:
+  - metadata:
+      name: {{ include "common.fullname" . }}-mdsal
+      labels:
+        name: {{ include "common.fullname" . }}
+    spec:
+      accessModes: [ {{ .Values.persistence.accessMode }} ]
+      storageClassName: {{ include "common.fullname" . }}-mdsal
+      resources:
+        requests:
+          storage: {{ .Values.persistence.size }}
+  {{ end }}