[AAI] Remove AAF/TLS config from charts
[oom.git] / kubernetes / aai / components / aai-graphadmin / templates / deployment.yaml
1 {{/*
2 #
3 # ============LICENSE_START=======================================================
4 # org.onap.aai
5 # ================================================================================
6 # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
7 # Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
8 # Copyright (c) 2020-2021 Orange Intellectual Property. All rights reserved.
9 # Modifications Copyright © 2023 Nordix Foundation
10 # ================================================================================
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
14 #
15 #    http://www.apache.org/licenses/LICENSE-2.0
16 #
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
22 # ============LICENSE_END=========================================================
23 */}}
24 apiVersion: apps/v1
25 kind: Deployment
26 metadata:
27   name: {{ include "common.fullname" . }}
28   namespace: {{ include "common.namespace" . }}
29   labels:
30     app: {{ include "common.name" . }}
31     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
32     release: {{ include "common.release" . }}
33     heritage: {{ .Release.Service }}
34 spec:
35   replicas: {{ .Values.replicaCount }}
36   minReadySeconds: {{ .Values.minReadySeconds }}
37   strategy:
38     type: {{ .Values.updateStrategy.type }}
39     rollingUpdate:
40       maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
41       maxSurge: {{ .Values.updateStrategy.maxSurge }}
42   selector:
43     matchLabels:
44       app: {{ include "common.name" . }}
45   template:
46     metadata:
47       labels:
48         app: {{ include "common.name" . }}
49         release: {{ include "common.release" . }}
50       name: {{ include "common.name" . }}
51       annotations:
52         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
53     spec:
54       hostname: aai-graphadmin
55       terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
56     {{ if .Values.global.initContainers.enabled }}
57       initContainers:
58       - command:
59       {{ if .Values.global.jobs.migration.enabled }}
60         - /app/ready.py
61         args:
62         - --job-name
63         - {{ include "common.release" . }}-aai-graphadmin-migration
64       {{  else if .Values.global.jobs.createSchema.enabled  }}
65         - /app/ready.py
66         args:
67         - --job-name
68         - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
69       {{  else }}
70         - /app/ready.py
71         args:
72         - --container-name
73         {{- if .Values.global.cassandra.localCluster }}
74         - aai-cassandra
75         {{- else }}
76         - cassandra
77         {{- end }}
78         - --container-name
79         - aai-schema-service
80       {{  end  }}
81         env:
82         - name: NAMESPACE
83           valueFrom:
84             fieldRef:
85               apiVersion: v1
86               fieldPath: metadata.namespace
87         image: {{ include "repositoryGenerator.image.readiness" . }}
88         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
89         name: {{ include "common.name" . }}-readiness
90       {{  end  }}
91       containers:
92       - name: {{ include "common.name" . }}
93         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
94         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
95         env:
96         - name: LOCAL_USER_ID
97           value: {{ .Values.securityContext.user_id | quote }}
98         - name: LOCAL_GROUP_ID
99           value: {{ .Values.securityContext.group_id | quote }}
100         - name: INTERNAL_PORT_1
101           value: {{ .Values.service.internalPort | quote }}
102         - name: INTERNAL_PORT_2
103           value: {{ .Values.service.internalPort2 | quote }}
104         - name: INTERNAL_PORT_3
105           value: {{ .Values.service.internalPort3 | quote }}
106         volumeMounts:
107         - mountPath: /etc/localtime
108           name: localtime
109           readOnly: true
110         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
111           name: config
112           subPath: janusgraph-realtime.properties
113         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
114           name: config
115           subPath: janusgraph-cached.properties
116         - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
117           name: properties
118           subPath: aaiconfig.properties
119         - mountPath: /opt/aai/logroot/AAI-RES
120           name: logs
121         - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
122           name: config
123           subPath: logback.xml
124         - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
125           name: config
126           subPath: localhost-access-logback.xml
127         - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties
128           name: config
129           subPath: realm.properties
130         - mountPath: /opt/app/aai-graphadmin/resources/application.properties
131           name: properties
132           subPath: application.properties
133         ports:
134         - containerPort: {{ .Values.service.internalPort }}
135         - containerPort: {{ .Values.service.internalPort2 }}
136         - containerPort: {{ .Values.service.internalPort3 }}
137         lifecycle:
138           # wait for active requests (long-running tasks) to be finished
139           # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
140           preStop:
141             exec:
142               command:
143                 - sh
144                 - -c
145                 - |
146                   while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2)
147                   do sleep 10
148                   done
149         # disable liveness probe when breakpoints set in debugger
150         # so K8s doesn't restart unresponsive container
151         {{ if .Values.liveness.enabled }}
152         livenessProbe:
153           tcpSocket:
154             port: {{ .Values.service.internalPort }}
155           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
156           periodSeconds: {{ .Values.liveness.periodSeconds }}
157         {{ end }}
158         readinessProbe:
159           tcpSocket:
160             port: {{ .Values.service.internalPort }}
161           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
162           periodSeconds: {{ .Values.readiness.periodSeconds }}
163         resources: {{ include "common.resources" . | nindent 10 }}
164       {{- if .Values.nodeSelector }}
165       nodeSelector:
166 {{ toYaml .Values.nodeSelector | indent 8 }}
167       {{- end -}}
168       {{- if .Values.affinity }}
169       affinity:
170 {{ toYaml .Values.affinity | indent 8 }}
171       {{- end }}
172
173       # side car containers
174       {{ include "common.log.sidecar" . | nindent 6 }}
175       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
176       volumes:
177       - name: localtime
178         hostPath:
179           path: /etc/localtime
180       - name: logs
181         emptyDir: {}
182       {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
183       - name: config
184         configMap:
185           name: {{ include "common.fullname" . }}
186       - name: properties
187         configMap:
188           name: {{ include "common.fullname" . }}-properties
189       restartPolicy: {{ .Values.restartPolicy }}
190       imagePullSecrets:
191       - name: {{ include "common.namespace" . }}-docker-registry-key