de260e3df8159ebbc96e935da9798835dc75adc6
[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: {{ .Release.Name }}
25     heritage: {{ .Release.Service }}
26 spec:
27   replicas: {{ .Values.replicaCount }}
28   template:
29     metadata:
30       labels:
31         app: {{ include "common.name" . }}
32         release: {{ .Release.Name }}
33         name: {{ include "common.fullname" . }}
34     spec:
35       containers:
36         - name: {{ include "common.name" . }}
37           image: "{{ include "common.repository" . }}/{{ .Values.image }}"
38           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
39           ports:
40             - containerPort: {{ .Values.service.internalPort }}
41           # disable liveness probe when breakpoints set in debugger
42           # so K8s doesn't restart unresponsive container
43           {{ if .Values.liveness.enabled }}
44           livenessProbe:
45             tcpSocket:
46               port: {{ .Values.service.internalPort }}
47             initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
48             periodSeconds: {{ .Values.liveness.periodSeconds }}
49           {{ end }}
50           readinessProbe:
51             tcpSocket:
52               port: {{ .Values.service.internalPort }}
53             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
54             periodSeconds: {{ .Values.readiness.periodSeconds }}
55           env:
56             - name: SPRING_DATASOURCE_URL
57               value: jdbc:mariadb://{{ .Values.mariadb.service.name }}.{{ include "common.namespace" . }}:{{.Values.mariadb.service.internalPort }}/{{ .Values.mariadb.config.db.database }}
58             - name: SPRING_DATASOURCE_USERNAME
59               value: {{ .Values.mariadb.config.db.user }}
60             - name: SPRING_DATASOURCE_PASSWORD
61               valueFrom:
62                 secretKeyRef:
63                   name: {{ template "common.fullname" . }}-secret
64                   key: db-user-password
65             - name: SPRING_DATA_MONGODB_HOST
66               value: {{ .Values.mongo.service.name }}.{{ include "common.namespace" . }}
67             - name: SPRING_DATA_MONGODB_PORT
68               value: "{{ .Values.mongo.service.internalPort }}"
69             - name: SPRING_DATA_MONGODB_DATABASE
70               value: {{ .Values.mongo.config.dbName }}
71             - name: ONAP_LCPCLOUDREGIONID
72               value: {{ .Values.config.openStackRegion }}
73             - name: ONAP_TENANTID
74               value: {{ .Values.config.openStackVNFTenantId | quote }}
75             - name: ONAP_CLOUDOWNER
76               value: {{ .Values.config.cloudOwner }}
77             - name: NBI_URL
78               value: "http://nbi.{{ include "common.namespace" . }}:8080/nbi/api/v3"
79             - name: SDC_HOST
80               value: "http://sdc-be.{{ include "common.namespace" . }}:8080"
81             - name: SDC_HEADER_ECOMPINSTANCEID
82               value: {{ .Values.config.ecompInstanceId }}
83             - name: SDC_HEADER_AUTHORIZATION
84               value: {{ .Values.sdc_authorization }}
85             - name: AAI_HOST
86               value: "https://aai.{{ include "common.namespace" . }}:8443"
87             - name: AAI_HEADER_AUTHORIZATION
88               value: {{ .Values.aai_authorization }}
89             - name: SO_HOST
90               value: http://so.{{ include "common.namespace" . }}:8080
91             {{- if .Values.so_authorization }}
92             - name: SO_HEADER_AUTHORIZATION
93               value: {{ .Values.so_authorization }}
94             {{- end }}
95             - name: LOGGING_LEVEL_ORG_ONAP_NBI
96               value: {{ .Values.config.loglevel }}
97             - name: MSB_ENABLED
98               value: "true"
99             - name: MSB_DISCOVERY_HOST
100               value: "msb-discovery.{{ include "common.namespace" . }}"
101             - name: MSB_DISCOVERY_PORT
102               value: "10081"
103           volumeMounts:
104             - mountPath: /etc/localtime
105               name: localtime
106               readOnly: true
107           resources:
108 {{ include "common.resources" . | indent 12 }}
109         {{- if .Values.nodeSelector }}
110         nodeSelector:
111 {{ toYaml .Values.nodeSelector | indent 10 }}
112         {{- end -}}
113         {{- if .Values.affinity }}
114         affinity:
115 {{ toYaml .Values.affinity | indent 10 }}
116         {{- end }}
117       # side car containers
118         # - name: filebeat-onap
119         #   image: "{{ .Values.global.loggingRepository }}/{{ .Values.global.loggingImage }}"
120         #   imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
121         #   volumeMounts:
122         #   - mountPath: /usr/share/filebeat/filebeat.yml
123         #     name: filebeat-conf
124         #     subPath: filebeat.yml
125         #   - mountPath: /home/esr/works/logs
126         #     name: esr-server-logs
127         #   - mountPath: /usr/share/filebeat/data
128         #     name: esr-server-filebeat
129       volumes:
130         - name: localtime
131           hostPath:
132             path: /etc/localtime
133         # - name: filebeat-conf
134         #   configMap:
135         #     name: {{ include "common.fullname" . }}-esr-filebeat
136         # - name: esr-server-logs
137         #   emptyDir: {}
138         # - name: esr-server-filebeat
139         #   emptyDir: {}
140         # - name: esrserver-log
141         #   configMap:
142         #     name: {{ include "common.fullname" . }}-esr-esrserver-log
143       imagePullSecrets:
144       - name: "{{ include "common.namespace" . }}-docker-registry-key"