[ONAP-wide] Replace .Release.Name with common.release
[oom.git] / kubernetes / oof / charts / oof-cmso / charts / oof-cmso-optimizer / templates / deployment.yaml
1 # Copyright © 2018 AT&T
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #       http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 apiVersion: extensions/v1beta1
16 kind: Deployment
17 metadata:
18   name: {{ include "common.fullname" . }}
19   namespace: {{ include "common.namespace" . }}
20   labels:
21     app: {{ include "common.name" . }}
22     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
23     release: {{ include "common.release" . }}
24     heritage: {{ .Release.Service }}
25 spec:
26   replicas: {{ .Values.replicaCount }}
27   template:
28     metadata:
29       labels:
30         app: {{ include "common.name" . }}
31         release: {{ include "common.release" . }}
32     spec:
33       initContainers:
34       - command:
35         - /root/ready.py
36         args:
37         - --container-name
38         - {{ .Values.mariadb.nameOverride }}
39         env:
40         - name: NAMESPACE
41           valueFrom:
42             fieldRef:
43               apiVersion: v1
44               fieldPath: metadata.namespace
45         image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
46         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
47         name: {{ include "common.name" . }}-readiness
48       - name: db-init
49         image: "{{ include "common.repository" . }}/{{ .Values.dbinit.image }}"
50         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
51         env:
52         - name: DB_HOST
53           value: {{ .Values.config.db_host }}.{{.Release.Namespace}}
54         - name: DB_PORT
55           value: {{ .Values.config.db_port | quote}}
56         - name: DB_USERNAME
57           value: {{ .Values.config.db_root }}
58         - name: DB_SCHEMA
59           value: {{ .Values.config.mysqlDatabase }}
60         - name: DB_PASSWORD
61           valueFrom:
62             secretKeyRef:
63               name: {{ include "common.release" . }}-cmso-db
64               key: db-root-password
65         terminationMessagePolicy: File
66         volumeMounts:
67         - name: {{ include "common.fullname" . }}-config
68           mountPath: /share/etc/config
69         - name: {{ include "common.fullname" . }}-logs
70           mountPath: /share/logs
71       containers:
72       - name: {{ include "common.name" . }}
73         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
74         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
75         env:
76         - name: DB_HOST
77           value: {{ .Values.config.db_host }}.{{.Release.Namespace}}
78         - name: DB_PORT
79           value: {{ .Values.config.db_port | quote}}
80         - name: DB_USERNAME
81           value: {{ .Values.config.db_root }}
82         - name: DB_SCHEMA
83           value: {{ .Values.config.mysqlDatabase }}
84         - name: DB_PASSWORD
85           valueFrom:
86             secretKeyRef:
87               name: {{ include "common.release" . }}-cmso-db
88               key: db-root-password
89         - name: JAVA_TRUSTSTORE
90           value: /share/etc/certs/{{ .Values.global.truststoreFile }}
91         - name: SSL_KEYSTORE
92           value: /share/etc/certs/{{ .Values.global.keystoreFile }}
93         - name: JAVA_TRUSTSTORE_PASSWORD
94           value: {{ .Values.global.truststorePassword }}
95         - name: SSL_KEYSTORE_PASSWORD
96           value: {{ .Values.global.keystorePassword }}
97         - name: AUTHENTICATION
98           value: {{ .Values.global.authentication }}
99         ports:
100         - containerPort: {{ .Values.service.internalPort }}
101         # disable liveness probe when breakpoints set in debugger
102         # so K8s doesn't restart unresponsive container
103         {{- if eq .Values.liveness.enabled true }}
104         livenessProbe:
105           tcpSocket:
106             port: {{ .Values.service.internalPort }}
107           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
108           periodSeconds: {{ .Values.liveness.periodSeconds }}
109         {{ end -}}
110         readinessProbe:
111           tcpSocket:
112             port: {{ .Values.service.internalPort }}
113           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
114           periodSeconds: {{ .Values.readiness.periodSeconds }}
115         volumeMounts:
116         - name: {{ include "common.fullname" . }}-logs
117           mountPath: /share/logs
118         - name: {{ include "common.fullname" . }}-logs
119           mountPath: /share/debug-logs
120         - name: {{ include "common.fullname" . }}-config
121           mountPath: /share/etc/config
122         - name: {{ include "common.fullname" . }}-certs
123           mountPath: /share/etc/certs
124         - name: {{ include "common.fullname" . }}-certs
125           mountPath: /opt/app/cmso/src/main/resources/aaf
126         resources:
127 {{ include "common.resources" . | indent 12 }}
128         {{- if .Values.nodeSelector }}
129         nodeSelector:
130 {{ toYaml .Values.nodeSelector | indent 10 }}
131         {{- end -}}
132         {{- if .Values.affinity }}
133         affinity:
134 {{ toYaml .Values.affinity | indent 10 }}
135         {{- end }}
136       volumes:
137         - name: {{ include "common.fullname" . }}-config
138           configMap:
139             name: {{ include "common.fullname" . }}
140             items:
141             - key: logback.xml
142               path: logback.xml
143             - key: cadi.properties
144               path: cadi.properties
145             - key: optimizer.properties
146               path: optimizer.properties
147             - key: liquibase.properties
148               path: liquibase.properties
149         - name:  {{ include "common.fullname" . }}-logs
150           emptyDir: {}
151         - name: {{ include "common.fullname" . }}-certs
152           secret:
153             secretName: {{ include "common.release" . }}-{{ .Values.global.commonConfigPrefix }}-certs
154       imagePullSecrets:
155       - name: "{{ include "common.namespace" . }}-docker-registry-key"