Helm charts for supporting clustering in ODL
[integration/packaging.git] / helm / opendaylight / templates / statefulset.yaml
index 1dc3fd7f08c8e656ec1aa9d337d10b74f9f30516..e1a2e09cccd88d63a37a3404a0a59f6f8e2c572c 100644 (file)
@@ -18,6 +18,7 @@ spec:
   {{- if not .Values.autoscaling.enabled }}
   replicas: {{ .Values.replicaCount }}
   {{- end }}
+  podManagementPolicy: Parallel
   serviceName: {{ include "opendaylight.fullname" . }}
   selector:
     matchLabels:
@@ -45,6 +46,18 @@ spec:
           volumeMounts:
           - name: {{ .Values.persistence.volName }}
             mountPath: {{ .Values.persistence.mountPath }}
+        {{- if .Values.config.isClusterDeployment }}
+        - name: inject-cluster-related-conf
+          image: busybox
+          command: ["/bin/sh"]
+          args: ["-c", "cp /config-input/akka.conf /config/akka.conf"]
+          volumeMounts:
+            - mountPath: /config-input/akka.conf
+              name: config-input
+              subPath: akka.conf
+            - mountPath: /config
+              name: update-conf
+        {{- end }}
       containers:
         - name: {{ .Chart.Name }}
           securityContext:
@@ -61,10 +74,19 @@ spec:
             value: "-Xms{{.Values.config.javaOptions.minMemory}} -Xmx{{.Values.config.javaOptions.maxMemory}}"
           - name: EXTRA_JAVA_OPTS
             value: "-XX:+UseG1GC -XX:MaxGCPauseMillis={{.Values.config.javaOptions.maxGCPauseMillis}} -XX:ParallelGCThreads={{.Values.config.javaOptions.parallelGCThreads}} -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication {{.Values.config.javaOptions.gcLogOptions}}"
+          - name: ODL_REPLICAS
+            value: "{{ .Values.replicaCount }}"
+          - name: IS_CLUSTER_ENABLED
+            value: "{{ .Values.config.isClusterDeployment }}"
           ports:
             - name: http
               containerPort: {{ .Values.service.port }}
               protocol: TCP
+            {{- if .Values.config.isClusterDeployment }}
+            - name: cluster
+              containerPort: {{ .Values.service.clusterPort }}
+              protocol: TCP
+            {{- end }}
           readinessProbe:
             tcpSocket:
               port: {{ .Values.service.port }}
@@ -77,6 +99,11 @@ spec:
             mountPath: {{ .Values.persistence.mountPath }}
           - name: scripts
             mountPath: /scripts
+          {{- if .Values.config.isClusterDeployment }}
+          - mountPath: {{ .Values.cluster.salConfigDir }}/{{ .Values.cluster.salConfigVersion}}/sal-clustering-config-{{ .Values.cluster.salConfigVersion}}-akkaconf.xml
+            name: update-conf
+            subPath: akka.conf
+          {{- end }}
       {{- with .Values.nodeSelector }}
       nodeSelector:
         {{- toYaml . | nindent 8 }}
@@ -92,7 +119,16 @@ spec:
       volumes:
         - name: scripts
           configMap:
-            name: {{ include "opendaylight.fullname" . }}
+            name: {{ include "opendaylight.fullname" . }}-scripts
+        {{- if .Values.config.isClusterDeployment }}
+        - name: config-input
+          configMap:
+            name: {{ include "opendaylight.fullname" . }}-conf
+            defaultMode: 0755
+        - name: update-conf
+          emptyDir:
+            medium: Memory
+        {{- end }}
   {{ if not .Values.persistence.enabled }}
         - name: {{ .Values.persistence.volName }} 
           emptyDir: {}