[AAI] Remove unused AAF proxies
[oom.git] / kubernetes / aai / components / aai-resources / templates / deployment.yaml
1 {{/*
2 # Copyright (c) 2017 Amdocs, Bell Canada
3 # Modifications Copyright (c) 2018 AT&T
4 # Modifications Copyright (c) 2020 Nokia
5 # Modifications Copyright (c) 2021 Orange
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 */}}
19
20 apiVersion: apps/v1
21 kind: Deployment
22 metadata:
23   name: {{ include "common.fullname" . }}
24   namespace: {{ include "common.namespace" . }}
25   labels:
26     app: {{ include "common.name" . }}
27     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
28     release: {{ include "common.release" . }}
29     heritage: {{ .Release.Service }}
30 spec:
31   replicas: {{ .Values.replicaCount }}
32   selector:
33     matchLabels:
34       app: {{ include "common.name" . }}
35   template:
36     metadata:
37       labels:
38         app: {{ include "common.name" . }}
39         release: {{ include "common.release" . }}
40       name: {{ include "common.name" . }}
41       annotations:
42         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
43       {{- if .Values.global.msbEnabled }}
44         {{ $values := .Values }}
45         msb.onap.org/service-info: '[
46         {{- range $api_endpoint := $values.aai_enpoints -}}
47           {{- range $api_version := $values.api_list }}
48           {
49               "serviceName": "_{{ $api_endpoint.name }}",
50               "version": "v{{ $api_version }}",
51               "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}",
52               "protocol": "REST",
53               "port": "8447",
54               "enable_ssl": true,
55               "lb_policy":"ip_hash",
56               "visualRange": "1",
57               "path": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}"
58           },
59           {
60               "serviceName": "{{ $api_endpoint.name }}",
61               "version": "v{{ $api_version }}",
62               "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}",
63               "protocol": "REST",
64               "port": "8447",
65               "enable_ssl": true,
66               "lb_policy":"ip_hash",
67               "visualRange": "1"
68           },
69           {{- end }}
70         {{- end }}
71           ]'
72       {{- end }}
73     spec:
74       hostname: aai-resources
75       initContainers:
76       - command:
77       {{- if .Values.global.jobs.migration.enabled }}
78         - /app/ready.py
79         args:
80         - --job-name
81         - {{ include "common.release" . }}-aai-graphadmin-migration
82       {{- else }}
83         {{- if .Values.global.jobs.createSchema.enabled  }}
84         - /app/ready.py
85         args:
86         - --job-name
87         - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
88         {{- else }}
89         - /app/ready.py
90         args:
91         - --container-name
92           {{- if .Values.global.cassandra.localCluster }}
93         - aai-cassandra
94           {{- else }}
95         - cassandra
96           {{- end }}
97         - --container-name
98         - aai-schema-service
99         {{- end }}
100         env:
101         - name: NAMESPACE
102           valueFrom:
103             fieldRef:
104               apiVersion: v1
105               fieldPath: metadata.namespace
106         image: {{ include "repositoryGenerator.image.readiness" . }}
107         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
108         name: {{ include "common.name" . }}-readiness
109       {{- end }}
110       containers:
111       - name: {{ include "common.name" . }}
112         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
113         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
114         env:
115         - name: LOCAL_USER_ID
116           value: {{ .Values.global.config.userId | quote }}
117         - name: LOCAL_GROUP_ID
118           value: {{ .Values.global.config.groupId | quote }}
119         volumeMounts:
120         - mountPath: /etc/localtime
121           name: localtime
122           readOnly: true
123         - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties
124           name: {{ include "common.fullname" . }}-config
125           subPath: janusgraph-realtime.properties
126         - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-cached.properties
127           name: {{ include "common.fullname" . }}-config
128           subPath: janusgraph-cached.properties
129         - mountPath: /opt/app/aai-resources/resources/etc/appprops/aaiconfig.properties
130           name: {{ include "common.fullname" . }}-config
131           subPath: aaiconfig.properties
132         - mountPath: /opt/aai/logroot/AAI-RES
133           name: {{ include "common.fullname" . }}-logs
134         - mountPath: /opt/app/aai-resources/resources/logback.xml
135           name: {{ include "common.fullname" . }}-config
136           subPath: logback.xml
137         - mountPath: /opt/app/aai-resources/resources/localhost-access-logback.xml
138           name: {{ include "common.fullname" . }}-config
139           subPath: localhost-access-logback.xml
140         - mountPath: /opt/app/aai-resources/resources/etc/auth/realm.properties
141           name: {{ include "common.fullname" . }}-config
142           subPath: realm.properties
143         - mountPath: /opt/app/aai-resources/resources/aaf/org.onap.aai.keyfile
144           name: {{ include "common.fullname" . }}-aaf-certs
145           subPath: org.onap.aai.keyfile
146         - mountPath: /opt/app/aai-resources/resources/aaf/bath_config.csv
147           name: {{ include "common.fullname" . }}-aaf-certs
148           subPath: bath_config.csv
149         - mountPath: /opt/app/aai-resources/resources/aaf/org.onap.aai.props
150           name: {{ include "common.fullname" . }}-aaf-properties
151           subPath: org.onap.aai.props
152         - mountPath: /opt/app/aai-resources/resources/aaf/org.osaaf.location.props
153           name: {{ include "common.fullname" . }}-aaf-properties
154           subPath: org.osaaf.location.props
155         - mountPath: /opt/app/aai-resources/resources/aaf/permissions.properties
156           name: {{ include "common.fullname" . }}-aaf-properties
157           subPath: permissions.properties
158         - mountPath: /opt/app/aai-resources/resources/cadi.properties
159           name: {{ include "common.fullname" . }}-aaf-properties
160           subPath: cadi.properties
161         - mountPath: /opt/app/aai-resources/resources/aaf/org.onap.aai.p12
162           name: {{ include "common.fullname" . }}-aaf-certs
163           subPath: org.onap.aai.p12
164         - mountPath: /opt/app/aai-resources/resources/aaf/truststoreONAPall.jks
165           name: aai-common-aai-auth-mount
166           subPath: truststoreONAPall.jks
167         - mountPath: /opt/app/aai-resources/resources/application.properties
168           name: {{ include "common.fullname" . }}-config
169           subPath: application.properties
170         - mountPath: /opt/app/aai-resources/resources/application-keycloak.properties
171           name: {{ include "common.fullname" . }}-config
172           subPath: application-keycloak.properties
173           {{- $global := . }}
174           {{- range $job := .Values.global.config.auth.files }}
175         - mountPath: /opt/app/aai-resources/resources/etc/auth/{{ . }}
176           name: {{ include "common.fullname" $global }}-auth-truststore-sec
177           subPath: {{ . }}
178           {{- end }}
179         ports:
180         - containerPort: {{ .Values.service.internalPort }}
181         - containerPort: {{ .Values.service.internalPort2 }}
182         # disable liveness probe when breakpoints set in debugger
183         # so K8s doesn't restart unresponsive container
184         {{- if .Values.liveness.enabled }}
185         livenessProbe:
186           tcpSocket:
187             port: {{ .Values.service.internalPort }}
188           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
189           periodSeconds: {{ .Values.liveness.periodSeconds }}
190         {{- end }}
191         readinessProbe:
192           tcpSocket:
193             port: {{ .Values.service.internalPort }}
194           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
195           periodSeconds: {{ .Values.readiness.periodSeconds }}
196         resources: {{ include "common.resources" . | nindent 12 }}
197       {{- if .Values.nodeSelector }}
198       nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
199       {{- end }}
200       {{- if .Values.affinity }}
201       affinity: {{ toYaml .Values.affinity | nindent 8 }}
202       {{- end }}
203       # side car containers
204       - name: filebeat-onap
205         image: {{ include "repositoryGenerator.image.logging" . }}
206         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
207         volumeMounts:
208         - mountPath: /usr/share/filebeat/filebeat.yml
209           subPath: filebeat.yml
210           name: filebeat-conf
211         - mountPath: /var/log/onap
212           name: {{ include "common.fullname" . }}-logs
213         - mountPath: /usr/share/filebeat/data
214           name: {{ include "common.fullname" . }}-filebeat
215         resources: {{ include "common.resources" . | nindent 12 }}
216       volumes:
217       - name: aai-common-aai-auth-mount
218         secret:
219           secretName: aai-common-aai-auth
220       - name: localtime
221         hostPath:
222           path: /etc/localtime
223       - name: filebeat-conf
224         configMap:
225           name: aai-filebeat
226       - name: {{ include "common.fullname" . }}-logs
227         emptyDir: {}
228       - name: {{ include "common.fullname" . }}-filebeat
229         emptyDir: {}
230       - name: {{ include "common.fullname" . }}-config
231         configMap:
232           name: {{ include "common.fullname" . }}-configmap
233       - name: {{ include "common.fullname" . }}-aaf-properties
234         configMap:
235           name: {{ include "common.fullname" . }}-aaf-props
236       - name: {{ include "common.fullname" . }}-aaf-certs
237         secret:
238           secretName: {{ include "common.fullname" . }}-aaf-keys
239       - name: {{ include "common.fullname" . }}-auth-truststore-sec
240         secret:
241           secretName: aai-common-truststore
242           items:
243           {{- range $job := .Values.global.config.auth.files }}
244           - key: {{ . }}
245             path: {{ . }}
246           {{- end }}
247       restartPolicy: {{ .Values.restartPolicy }}
248       imagePullSecrets:
249       - name: "{{ include "common.namespace" . }}-docker-registry-key"