Merge "Revise dcae bootstrap version"
[oom.git] / kubernetes / nbi / templates / deployment.yaml
1 # Copyright © 2018 Orange
2 # Modifications Copyright © 2018  Amdocs, Bell Canada
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 apiVersion: extensions/v1beta1
17 kind: Deployment
18 metadata:
19   name: {{ include "common.fullname" . }}
20   namespace: {{ include "common.namespace" . }}
21   labels:
22     app: {{ include "common.name" . }}
23     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
24     release: {{ include "common.release" . }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ include "common.release" . }}
33       name: {{ include "common.fullname" . }}
34     spec:
35 {{- if .Values.global.aafEnabled }}
36       initContainers: {{ include "common.certInitializer.initContainer" . | nindent 6 }}
37 {{- end }}
38       containers:
39         - name: {{ include "common.name" . }}
40           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
41           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
42           ports:
43             - containerPort: {{ .Values.service.internalPort }}
44           # disable liveness probe when breakpoints set in debugger
45           # so K8s doesn't restart unresponsive container
46           {{- if .Values.global.aafEnabled }}
47           command:
48           - bash
49           args:
50           - -c
51           - |
52             export $(grep '^c' {{ .Values.certInitializer.credsPath }}/mycreds.prop | xargs -0)
53             export JAVA_OPTS="-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
54               -Dserver.ssl.key-store={{ .Values.certInitializer.credsPath }}/org.onap.nbi.p12 \
55               -Dserver.ssl.key-store-type=PKCS12 \
56               -Djavax.net.ssl.trustStore={{ .Values.certInitializer.credsPath }}/org.onap.nbi.trust.jks \
57               -Dserver.ssl.key-store-password=$cadi_keystore_password_p12  \
58               -Djavax.net.ssl.trustStoreType=jks\
59               -Djava.security.egd=file:/dev/./urandom -Dserver.port=8443"
60             exec java -XX:+UseContainerSupport $JAVA_OPTS -jar /opt/onap/app.jar
61           {{- end }}
62           {{ if .Values.liveness.enabled }}
63           livenessProbe:
64             httpGet:
65               port: {{ .Values.liveness.port }}
66               path: {{ .Values.liveness.path }}
67               scheme: HTTPS
68             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
69             periodSeconds: {{ .Values.liveness.periodSeconds }}
70           {{ end }}
71           readinessProbe:
72             httpGet:
73               port: {{ .Values.readiness.port }}
74               path: {{ .Values.readiness.path }}
75               scheme: HTTPS
76             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
77             periodSeconds: {{ .Values.readiness.periodSeconds }}
78           env:
79             - name: SPRING_DATASOURCE_URL
80               value: jdbc:mariadb://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ index .Values "mariadb-galera" "config" "mysqlDatabase" }}
81             - name: SPRING_DATASOURCE_USERNAME
82               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nbi-db-secret" "key" "login") | indent 14 }}
83             - name: SPRING_DATASOURCE_PASSWORD
84               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nbi-db-secret" "key" "password") | indent 14 }}
85             - name: SPRING_DATA_MONGODB_HOST
86               value: {{ .Values.mongo.service.name }}.{{ include "common.namespace" . }}
87             - name: SPRING_DATA_MONGODB_PORT
88               value: "{{ .Values.mongo.service.internalPort }}"
89             - name: SPRING_DATA_MONGODB_DATABASE
90               value: {{ .Values.mongo.config.dbName }}
91             - name: ONAP_LCPCLOUDREGIONID
92               value: {{ .Values.config.openStackRegion }}
93             - name: ONAP_TENANTID
94               value: {{ .Values.config.openStackVNFTenantId | quote }}
95             - name: ONAP_CLOUDOWNER
96               value: {{ .Values.config.cloudOwner }}
97             - name: NBI_URL
98               value: "https://nbi.{{ include "common.namespace" . }}:8443/nbi/api/v4"
99             - name: SDC_HOST
100               value: "https://sdc-be.{{ include "common.namespace" . }}:8443"
101             - name: SDC_HEADER_ECOMPINSTANCEID
102               value: {{ .Values.config.ecompInstanceId }}
103             - name: SDC_HEADER_AUTHORIZATION
104               value: {{ .Values.sdc_authorization }}
105             - name: AAI_HOST
106               value: "https://aai.{{ include "common.namespace" . }}:8443"
107             - name: AAI_HEADER_AUTHORIZATION
108               value: {{ .Values.aai_authorization }}
109             - name: SO_HOST
110               value: http://so.{{ include "common.namespace" . }}:8080
111             {{- if .Values.so_authorization }}
112             - name: SO_HEADER_AUTHORIZATION
113               value: {{ .Values.so_authorization }}
114             {{- end }}
115             - name: DMAAP_HOST
116               value: "https://message-router.{{ include "common.namespace" . }}:3905"
117             - name: LOGGING_LEVEL_ORG_ONAP_NBI
118               value: {{ .Values.config.loglevel }}
119             - name: MSB_ENABLED
120               value: "true"
121             - name: MSB_DISCOVERY_HOST
122               value: "msb-discovery.{{ include "common.namespace" . }}"
123             - name: MSB_DISCOVERY_PORT
124               value: "10081"
125           volumeMounts: {{ include "common.certInitializer.volumeMount" . | nindent 12 }}
126             - mountPath: /etc/localtime
127               name: localtime
128               readOnly: true
129           resources:
130 {{ include "common.resources" . | indent 12 }}
131         {{- if .Values.nodeSelector }}
132         nodeSelector:
133 {{ toYaml .Values.nodeSelector | indent 10 }}
134         {{- end -}}
135         {{- if .Values.affinity }}
136         affinity:
137 {{ toYaml .Values.affinity | indent 10 }}
138         {{- end }}
139       # side car containers
140         # - name: filebeat-onap
141         #   image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
142         #   imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
143         #   volumeMounts:
144         #   - mountPath: /usr/share/filebeat/filebeat.yml
145         #     name: filebeat-conf
146         #     subPath: filebeat.yml
147         #   - mountPath: /home/esr/works/logs
148         #     name: esr-server-logs
149         #   - mountPath: /usr/share/filebeat/data
150         #     name: esr-server-filebeat
151       volumes: {{ include "common.certInitializer.volumes" . | nindent 8 }}
152         - name: localtime
153           hostPath:
154             path: /etc/localtime
155         # - name: filebeat-conf
156         #   configMap:
157         #     name: {{ include "common.fullname" . }}-esr-filebeat
158         # - name: esr-server-logs
159         #   emptyDir: {}
160         # - name: esr-server-filebeat
161         #   emptyDir: {}
162         # - name: esrserver-log
163         #   configMap:
164         #     name: {{ include "common.fullname" . }}-esr-esrserver-log
165       imagePullSecrets:
166       - name: "{{ include "common.namespace" . }}-docker-registry-key"