[GENERAL] Use readiness container v3.0.1
[oom.git] / kubernetes / oof / charts / oof-cmso / charts / oof-cmso-service / templates / deployment.yaml
index dd080be..ff37e8f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright © 2018 AT&T
+# Copyright (c) 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.
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-apiVersion: extensions/v1beta1
+apiVersion: apps/v1
 kind: Deployment
 metadata:
   name: {{ include "common.fullname" . }}
@@ -20,72 +20,110 @@ metadata:
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
+  selector:
+    matchLabels:
+      app: {{ include "common.name" . }}
   replicas: {{ .Values.replicaCount }}
   template:
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
       initContainers:
       - command:
-        - /root/ready.py
+        - /app/ready.py
         args:
         - --container-name
-        - {{ .Values.mariadb.nameOverride }}
+        - {{ .Values.config.db.container }}
         env:
         - name: NAMESPACE
           valueFrom:
             fieldRef:
               apiVersion: v1
               fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
+        image: "{{ include "common.repository" . }}/{{ .Values.global.readinessImage }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}-readiness
+      - name: {{ include "common.name" . }}-chown
+        command: ["/bin/sh", "-c", "chown -Rf 1000:1000 /share/"]
+        image: "{{ .Values.global.busyBoxRepository }}/{{ .Values.global.busyBoxImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+        - name: {{ include "common.fullname" . }}-logs
+          mountPath: /share/logs
       - name: db-init
         image: "{{ include "common.repository" . }}/{{ .Values.dbinit.image }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: DB_HOST
-          value: {{ .Values.config.db_host }}.{{.Release.Namespace}}
+          value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
         - name: DB_PORT
-          value: {{ .Values.config.db_port | quote}}
+          value: {{ .Values.config.db.port | quote}}
         - name: DB_USERNAME
-          value: {{ .Values.config.db_root }}
+          value: {{ .Values.config.db.root }}
         - name: DB_SCHEMA
-          value: {{ .Values.config.mysqlDatabase }}
+          value: {{ .Values.config.db.mysqlDatabase }}
         - name: DB_PASSWORD
-          valueFrom:
-            secretKeyRef:
-              name: {{ .Release.Name}}-cmso-db
-              key: db-root-password
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-root-password" "key" "password") | indent 10}}
         terminationMessagePolicy: File
         volumeMounts:
         - name: {{ include "common.fullname" . }}-config
           mountPath: /share/etc/config
-        - name: {{ include "common.fullname" . }}-logs   
+        - name: {{ include "common.fullname" . }}-logs
           mountPath: /share/logs
       containers:
+      # side car containers
+      - name: filebeat-onap
+        image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+        - mountPath: /usr/share/filebeat/filebeat.yml
+          subPath: filebeat.yml
+          name: filebeat-conf
+        - mountPath: /var/log/onap
+          name: {{ include "common.fullname" . }}-logs
+        - mountPath: /usr/share/filebeat/data
+          name: {{ include "common.fullname" . }}-filebeat
+        resources:
+{{ include "common.resources" . }}
+      - name: mso-simulator
+        image: "{{ include "common.repository" . }}/{{ .Values.robotimage }}"
+        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+        volumeMounts:
+        - name: {{ include "common.fullname" . }}-config
+          mountPath: /share/etc/config
+        ports:
+        - containerPort: 5000
+        resources:
+{{ include "common.resources" . }}
       - name: {{ include "common.name" . }}
         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         env:
         - name: DB_HOST
-          value: {{ .Values.config.db_host }}.{{.Release.Namespace}}
+          value: {{ .Values.config.db.host }}.{{.Release.Namespace}}
         - name: DB_PORT
-          value: {{ .Values.config.db_port | quote}}
+          value: {{ .Values.config.db.port | quote}}
         - name: DB_USERNAME
-          value: {{ .Values.config.db_user }}
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "login") | indent 10}}
         - name: DB_SCHEMA
-          value: {{ .Values.config.mysqlDatabase }}
+          value: {{ .Values.config.db.mysqlDatabase }}
         - name: DB_PASSWORD
-          valueFrom:
-            secretKeyRef:
-              name: {{ .Release.Name}}-cmso-db
-              key: user-password
+          {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "cmso-db-user-secret" "key" "password") | indent 10}}
+        - name: JAVA_TRUSTSTORE
+          value: /share/etc/certs/{{ .Values.global.truststoreFile }}
+        - name: SSL_KEYSTORE
+          value: /share/etc/certs/{{ .Values.global.keystoreFile }}
+        - name: JAVA_TRUSTSTORE_PASSWORD
+          value: {{ .Values.global.truststorePassword }}
+        - name: SSL_KEYSTORE_PASSWORD
+          value: {{ .Values.global.keystorePassword }}
+        - name: AUTHENTICATION
+          value: {{ .Values.global.authentication }}
         ports:
         - containerPort: {{ .Values.service.internalPort }}
         # disable liveness probe when breakpoints set in debugger
@@ -108,7 +146,11 @@ spec:
         - name: {{ include "common.fullname" . }}-logs
           mountPath: /share/debug-logs
         - name: {{ include "common.fullname" . }}-config
-          mountPath: /share/etc/config 
+          mountPath: /share/etc/config
+        - name: {{ include "common.fullname" . }}-certs
+          mountPath: /share/etc/certs
+        - name: {{ include "common.fullname" . }}-certs
+          mountPath: /opt/app/cmso/src/main/resources/aaf
         resources:
 {{ include "common.resources" . | indent 12 }}
         {{- if .Values.nodeSelector }}
@@ -128,6 +170,8 @@ spec:
               path: logback.xml
             - key: cmso.properties
               path: cmso.properties
+            - key: cadi.properties
+              path: cadi.properties
             - key: optimizer.properties
               path: optimizer.properties
             - key: ticketmgt.properties
@@ -136,5 +180,13 @@ spec:
               path: liquibase.properties
         - name:  {{ include "common.fullname" . }}-logs
           emptyDir: {}
+        - name: {{ include "common.fullname" . }}-filebeat
+          emptyDir: {}
+        - name: filebeat-conf
+          configMap:
+            name: {{ include "common.release" . }}-cmso-filebeat-configmap
+        - name: {{ include "common.fullname" . }}-certs
+          secret:
+            secretName: {{ include "common.release" . }}-{{ .Values.global.commonConfigPrefix }}-certs
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"