[POLICY] update images and fixes
[oom.git] / kubernetes / policy / templates / deployment.yaml
index 42a6544..fec565f 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright © 2017 Amdocs, Bell Canada
+# Modifications Copyright © 2018 AT&T
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@ metadata:
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   replicas: {{ .Values.replicaCount }}
@@ -28,14 +29,32 @@ spec:
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
+      - command:
+        - sh
+        args:
+        - -c
+        - "cd /config-input && for PFILE in `ls -1 *.conf`; do envsubst <${PFILE} >/config/${PFILE}; done"
+        env:
+        - name: JDBC_USER
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "login") | indent 10 }}
+        - name: JDBC_PASSWORD
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "db-secret" "key" "password") | indent 10 }}
+        volumeMounts:
+        - mountPath: /config-input
+          name: pe
+        - mountPath: /config
+          name: pe-processed
+        image: "{{ .Values.global.envsubstImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        name: {{ include "common.name" . }}-update-config
       - command:
         - /root/ready.py
         args:
         - --container-name
-        - {{ .Values.global.mariadb.nameOverride }}
+        - {{ include "common.release" . }}-galera-config
         env:
         - name: NAMESPACE
           valueFrom:
@@ -53,6 +72,8 @@ spec:
           name: {{ include "common.name" . }}
           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          resources:
+{{ include "common.resources" . | indent 12 }}
           ports:
           - containerPort: {{ .Values.service.externalPort }}
           - containerPort: {{ .Values.service.externalPort2 }}
@@ -75,9 +96,6 @@ spec:
           - mountPath: /etc/localtime
             name: localtime
             readOnly: true
-          - mountPath: /tmp/policy-install/config/push-policies.sh
-            name: pe-pap
-            subPath: push-policies.sh
           - mountPath: /tmp/policy-install/config/pap-tweaks.sh
             name: pe-pap
             subPath: pap-tweaks.sh
@@ -97,7 +115,7 @@ spec:
             name: pe-pap
             subPath: console.conf
           - mountPath: /tmp/policy-install/config/base.conf
-            name: pe
+            name: pe-processed
             subPath: base.conf
           - mountPath: /tmp/policy-install/do-start.sh
             name: pe-scripts
@@ -115,7 +133,7 @@ spec:
               exec:
                 command: ["/bin/sh", "-c", "export LOG=wait_logback.log; touch $LOG; export SRC=/tmp/logback.xml; export DST=/opt/app/policy/servers/pap/webapps/pap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; export SRC=/tmp/policy-install/logback.xml; export DST=/opt/app/policy/servers/console/webapps/onap/WEB-INF/classes/; while [ ! -e $DST ]; do echo 'Waiting for $DST...' >> $LOG; sleep 5; done; sleep 2; /bin/cp -f $SRC $DST; echo 'Done' >> $LOG"]
         - image: "{{ .Values.global.loggingRepository | default .Values.loggingRepository }}/{{ .Values.global.loggingImage | default .Values.loggingImage }}"
-          imagePullPolicy: {{ .Values.pullPolicy }}
+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           name: filebeat-onap
           volumeMounts:
           - mountPath: /usr/share/filebeat/filebeat.yml
@@ -125,23 +143,13 @@ spec:
             name: policy-logs
           - mountPath: /usr/share/filebeat/data
             name: policy-data-filebeat
-          resources:
-{{ toYaml .Values.resources | indent 12 }}
-        {{- if .Values.nodeSelector }}
-        nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 10 }}
-        {{- end -}}
-        {{- if .Values.affinity }}
-        affinity:
-{{ toYaml .Values.affinity | indent 10 }}
-        {{- end }}
       volumes:
         - name: localtime
           hostPath:
             path: /etc/localtime
         - name: filebeat-conf
           configMap:
-            name: {{ .Release.Name }}-filebeat-configmap
+            name: {{ include "common.release" . }}-filebeat-configmap
         - name: policy-logs
           emptyDir: {}
         - name: policy-data-filebeat
@@ -154,15 +162,18 @@ spec:
             name: {{ include "common.fullname" . }}-sdk-log-configmap
         - name: pe
           configMap:
-            name: {{ .Release.Name }}-pe-configmap
+            name: {{ include "common.release" . }}-pe-configmap
             defaultMode: 0755
         - name: pe-scripts
           configMap:
-            name: {{ .Release.Name }}-pe-scripts-configmap
+            name: {{ include "common.release" . }}-pe-scripts-configmap
             defaultMode: 0777
         - name: pe-pap
           configMap:
             name: {{ include "common.fullname" . }}-pe-configmap
             defaultMode: 0755
+        - name: pe-processed
+          emptyDir:
+            medium: Memory
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"