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