Merge "Corrected AAI endpoint & auth with SO APIH override.yaml"
[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.aaf-config" . | 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.aafConfig.credsPath }}/mycreds.prop | xargs -0)
53             export JAVA_OPTS="-Djavax.net.ssl.trustStorePassword=$cadi_truststore_password \
54               -Dserver.ssl.key-store={{ .Values.aafConfig.credsPath }}/org.onap.nbi.p12 \
55               -Dserver.ssl.key-store-type=PKCS12 \
56               -Djavax.net.ssl.trustStore={{ .Values.aafConfig.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             {{- if eq "DEBUG" .Values.config.loglevel }}
61             export JAVA_DEBUG="-Djavax.net.debug=all"
62             {{- end }}
63             exec java -XX:+UseContainerSupport $JAVA_DEBUG $JAVA_OPTS -jar /opt/onap/app.jar
64           {{- end }}
65           {{ if .Values.liveness.enabled }}
66           livenessProbe:
67             httpGet:
68               port: {{ .Values.liveness.port }}
69               path: {{ .Values.liveness.path }}
70               scheme: HTTPS
71             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
72             periodSeconds: {{ .Values.liveness.periodSeconds }}
73           {{ end }}
74           readinessProbe:
75             httpGet:
76               port: {{ .Values.readiness.port }}
77               path: {{ .Values.readiness.path }}
78               scheme: HTTPS
79             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
80             periodSeconds: {{ .Values.readiness.periodSeconds }}
81           env:
82             - name: SPRING_DATASOURCE_URL
83               value: jdbc:mariadb://{{ include "common.mariadbService" . }}:{{ include "common.mariadbPort" . }}/{{ index .Values "mariadb-galera" "config" "mysqlDatabase" }}
84             - name: SPRING_DATASOURCE_USERNAME
85               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nbi-db-secret" "key" "login") | indent 14 }}
86             - name: SPRING_DATASOURCE_PASSWORD
87               {{- include "common.secret.envFromSecretFast" (dict "global" . "uid" "nbi-db-secret" "key" "password") | indent 14 }}
88             - name: SPRING_DATA_MONGODB_HOST
89               value: {{ .Values.mongo.service.name }}.{{ include "common.namespace" . }}
90             - name: SPRING_DATA_MONGODB_PORT
91               value: "{{ .Values.mongo.service.internalPort }}"
92             - name: SPRING_DATA_MONGODB_DATABASE
93               value: {{ .Values.mongo.config.dbName }}
94             - name: ONAP_LCPCLOUDREGIONID
95               value: {{ .Values.config.openStackRegion }}
96             - name: ONAP_TENANTID
97               value: {{ .Values.config.openStackVNFTenantId | quote }}
98             - name: ONAP_CLOUDOWNER
99               value: {{ .Values.config.cloudOwner }}
100             - name: NBI_URL
101               value: "https://nbi.{{ include "common.namespace" . }}:8443/nbi/api/v4"
102             - name: SDC_HOST
103               value: "https://sdc-be.{{ include "common.namespace" . }}:8443"
104             - name: SDC_HEADER_ECOMPINSTANCEID
105               value: {{ .Values.config.ecompInstanceId }}
106             - name: SDC_HEADER_AUTHORIZATION
107               value: {{ .Values.sdc_authorization }}
108             - name: AAI_HOST
109               value: "https://aai.{{ include "common.namespace" . }}:8443"
110             - name: AAI_HEADER_AUTHORIZATION
111               value: {{ .Values.aai_authorization }}
112             - name: SO_HOST
113               value: http://so.{{ include "common.namespace" . }}:8080
114             {{- if .Values.so_authorization }}
115             - name: SO_HEADER_AUTHORIZATION
116               value: {{ .Values.so_authorization }}
117             {{- end }}
118             - name: DMAAP_HOST
119               value: "http://message-router.{{ include "common.namespace" . }}:3904"
120             - name: LOGGING_LEVEL_ORG_ONAP_NBI
121               value: {{ .Values.config.loglevel }}
122             - name: MSB_ENABLED
123               value: "true"
124             - name: MSB_DISCOVERY_HOST
125               value: "msb-discovery.{{ include "common.namespace" . }}"
126             - name: MSB_DISCOVERY_PORT
127               value: "10081"
128           volumeMounts: {{ include "common.aaf-config-volume-mountpath" . | nindent 12 }}
129             - mountPath: /etc/localtime
130               name: localtime
131               readOnly: true
132           resources:
133 {{ include "common.resources" . | indent 12 }}
134         {{- if .Values.nodeSelector }}
135         nodeSelector:
136 {{ toYaml .Values.nodeSelector | indent 10 }}
137         {{- end -}}
138         {{- if .Values.affinity }}
139         affinity:
140 {{ toYaml .Values.affinity | indent 10 }}
141         {{- end }}
142       # side car containers
143         # - name: filebeat-onap
144         #   image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
145         #   imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
146         #   volumeMounts:
147         #   - mountPath: /usr/share/filebeat/filebeat.yml
148         #     name: filebeat-conf
149         #     subPath: filebeat.yml
150         #   - mountPath: /home/esr/works/logs
151         #     name: esr-server-logs
152         #   - mountPath: /usr/share/filebeat/data
153         #     name: esr-server-filebeat
154       volumes: {{ include "common.aaf-config-volumes" . | nindent 8 }}
155         - name: localtime
156           hostPath:
157             path: /etc/localtime
158         # - name: filebeat-conf
159         #   configMap:
160         #     name: {{ include "common.fullname" . }}-esr-filebeat
161         # - name: esr-server-logs
162         #   emptyDir: {}
163         # - name: esr-server-filebeat
164         #   emptyDir: {}
165         # - name: esrserver-log
166         #   configMap:
167         #     name: {{ include "common.fullname" . }}-esr-esrserver-log
168       imagePullSecrets:
169       - name: "{{ include "common.namespace" . }}-docker-registry-key"