blob: c3e36c2be6dab4e18a56a244834d4ba9d8ef6f09 [file] [log] [blame]
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +01001{{/*
Sylvain Desbureaux70070412020-11-09 21:58:48 +01002#
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.
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +01008# Copyright (c) 2020-2021 Orange Intellectual Property. All rights reserved.
efiacord12c1672023-03-23 12:10:50 +00009# Modifications Copyright © 2023 Nordix Foundation
Sylvain Desbureaux70070412020-11-09 21:58:48 +010010# ================================================================================
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=========================================================
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010023*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010024apiVersion: apps/v1
25kind: Deployment
26metadata:
27 name: {{ include "common.fullname" . }}
28 namespace: {{ include "common.namespace" . }}
29 labels:
30 app: {{ include "common.name" . }}
Andreas Geisslerceac2602023-07-17 18:55:54 +020031 app.kubernetes.io/name: {{ include "common.name" . }}
32 {{- if .Chart.AppVersion }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020033 version: "{{ .Chart.AppVersion | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020034 {{- else }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020035 version: "{{ .Chart.Version | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020036 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010037 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
38 release: {{ include "common.release" . }}
39 heritage: {{ .Release.Service }}
40spec:
41 replicas: {{ .Values.replicaCount }}
M.Hosnidokht6c806532021-08-25 09:19:41 -040042 minReadySeconds: {{ .Values.minReadySeconds }}
43 strategy:
44 type: {{ .Values.updateStrategy.type }}
45 rollingUpdate:
46 maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
47 maxSurge: {{ .Values.updateStrategy.maxSurge }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010048 selector:
49 matchLabels:
50 app: {{ include "common.name" . }}
51 template:
52 metadata:
53 labels:
54 app: {{ include "common.name" . }}
55 release: {{ include "common.release" . }}
Andreas Geisslerceac2602023-07-17 18:55:54 +020056 app.kubernetes.io/name: {{ include "common.name" . }}
57 {{- if .Chart.AppVersion }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020058 version: "{{ .Chart.AppVersion | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020059 {{- else }}
Andreas Geissler85a5a342023-07-19 14:05:20 +020060 version: "{{ .Chart.Version | replace "+" "_" }}"
Andreas Geisslerceac2602023-07-17 18:55:54 +020061 {{- end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010062 name: {{ include "common.name" . }}
63 annotations:
64 checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
65 spec:
66 hostname: aai-graphadmin
M.Hosnidokht6c806532021-08-25 09:19:41 -040067 terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010068 {{ if .Values.global.initContainers.enabled }}
efiacord12c1672023-03-23 12:10:50 +000069 initContainers:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010070 - command:
71 {{ if .Values.global.jobs.migration.enabled }}
72 - /app/ready.py
73 args:
74 - --job-name
75 - {{ include "common.release" . }}-aai-graphadmin-migration
76 {{ else if .Values.global.jobs.createSchema.enabled }}
77 - /app/ready.py
78 args:
79 - --job-name
80 - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
81 {{ else }}
82 - /app/ready.py
83 args:
Andreas Geisslercfd84342023-08-16 17:18:49 +020084 - --app-name
Sylvain Desbureaux70070412020-11-09 21:58:48 +010085 {{- if .Values.global.cassandra.localCluster }}
86 - aai-cassandra
87 {{- else }}
88 - cassandra
89 {{- end }}
90 - --container-name
91 - aai-schema-service
92 {{ end }}
93 env:
94 - name: NAMESPACE
95 valueFrom:
96 fieldRef:
97 apiVersion: v1
98 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010099 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100100 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
101 name: {{ include "common.name" . }}-readiness
102 {{ end }}
103 containers:
104 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100105 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100106 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
107 env:
108 - name: LOCAL_USER_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100109 value: {{ .Values.securityContext.user_id | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100110 - name: LOCAL_GROUP_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100111 value: {{ .Values.securityContext.group_id | quote }}
M.Hosnidokht6c806532021-08-25 09:19:41 -0400112 - name: INTERNAL_PORT_1
113 value: {{ .Values.service.internalPort | quote }}
114 - name: INTERNAL_PORT_2
115 value: {{ .Values.service.internalPort2 | quote }}
leila46fb5802022-11-15 11:33:21 -0500116 - name: INTERNAL_PORT_3
117 value: {{ .Values.service.internalPort3 | quote }}
efiacord12c1672023-03-23 12:10:50 +0000118 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100119 - mountPath: /etc/localtime
120 name: localtime
121 readOnly: true
122 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100123 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100124 subPath: janusgraph-realtime.properties
125 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100126 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100127 subPath: janusgraph-cached.properties
128 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100129 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100130 subPath: aaiconfig.properties
131 - mountPath: /opt/aai/logroot/AAI-RES
Maciej Wereskid523d122021-09-21 11:22:13 +0200132 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100133 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100134 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100135 subPath: logback.xml
136 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100137 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100138 subPath: localhost-access-logback.xml
139 - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100140 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100141 subPath: realm.properties
142 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100143 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100144 subPath: application.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100145 ports:
146 - containerPort: {{ .Values.service.internalPort }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200147 name: {{ .Values.service.portName }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100148 - containerPort: {{ .Values.service.internalPort2 }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200149 name: {{ .Values.service.portName2 }}
leila46fb5802022-11-15 11:33:21 -0500150 - containerPort: {{ .Values.service.internalPort3 }}
Andreas Geisslerceac2602023-07-17 18:55:54 +0200151 name: {{ .Values.service.portName3 }}
M.Hosnidokht6c806532021-08-25 09:19:41 -0400152 lifecycle:
153 # wait for active requests (long-running tasks) to be finished
154 # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
155 preStop:
156 exec:
157 command:
158 - sh
159 - -c
160 - |
161 while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2)
162 do sleep 10
163 done
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100164 # disable liveness probe when breakpoints set in debugger
165 # so K8s doesn't restart unresponsive container
166 {{ if .Values.liveness.enabled }}
167 livenessProbe:
168 tcpSocket:
169 port: {{ .Values.service.internalPort }}
170 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
171 periodSeconds: {{ .Values.liveness.periodSeconds }}
172 {{ end }}
173 readinessProbe:
174 tcpSocket:
175 port: {{ .Values.service.internalPort }}
176 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
177 periodSeconds: {{ .Values.readiness.periodSeconds }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100178 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100179 {{- if .Values.nodeSelector }}
180 nodeSelector:
181{{ toYaml .Values.nodeSelector | indent 8 }}
182 {{- end -}}
183 {{- if .Values.affinity }}
184 affinity:
185{{ toYaml .Values.affinity | indent 8 }}
186 {{- end }}
187
188 # side car containers
Maciej Wereskid523d122021-09-21 11:22:13 +0200189 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200190 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
efiacord12c1672023-03-23 12:10:50 +0000191 volumes:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100192 - name: localtime
193 hostPath:
194 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200195 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100196 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200197 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100198 - name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100199 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100200 name: {{ include "common.fullname" . }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100201 - name: properties
othman touijer51176672021-12-01 16:21:18 +0100202 configMap:
203 name: {{ include "common.fullname" . }}-properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100204 restartPolicy: {{ .Values.restartPolicy }}
205 imagePullSecrets:
osk1146127fd7d82021-06-18 00:51:17 +0200206 - name: {{ include "common.namespace" . }}-docker-registry-key