blob: 033cfa02bc66f40d746ac7d51b3f634a963a341f [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" . }}
31 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
32 release: {{ include "common.release" . }}
33 heritage: {{ .Release.Service }}
34spec:
35 replicas: {{ .Values.replicaCount }}
M.Hosnidokht6c806532021-08-25 09:19:41 -040036 minReadySeconds: {{ .Values.minReadySeconds }}
37 strategy:
38 type: {{ .Values.updateStrategy.type }}
39 rollingUpdate:
40 maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
41 maxSurge: {{ .Values.updateStrategy.maxSurge }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010042 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
M.Hosnidokht6c806532021-08-25 09:19:41 -040055 terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010056 {{ if .Values.global.initContainers.enabled }}
efiacord12c1672023-03-23 12:10:50 +000057 initContainers:
Sylvain Desbureaux70070412020-11-09 21:58:48 +010058 - 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
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010087 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010088 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
89 name: {{ include "common.name" . }}-readiness
90 {{ end }}
91 containers:
92 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010093 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010094 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
95 env:
96 - name: LOCAL_USER_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010097 value: {{ .Values.securityContext.user_id | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010098 - name: LOCAL_GROUP_ID
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +010099 value: {{ .Values.securityContext.group_id | quote }}
M.Hosnidokht6c806532021-08-25 09:19:41 -0400100 - name: INTERNAL_PORT_1
101 value: {{ .Values.service.internalPort | quote }}
102 - name: INTERNAL_PORT_2
103 value: {{ .Values.service.internalPort2 | quote }}
leila46fb5802022-11-15 11:33:21 -0500104 - name: INTERNAL_PORT_3
105 value: {{ .Values.service.internalPort3 | quote }}
efiacord12c1672023-03-23 12:10:50 +0000106 volumeMounts:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100107 - mountPath: /etc/localtime
108 name: localtime
109 readOnly: true
110 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100111 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100112 subPath: janusgraph-realtime.properties
113 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100114 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100115 subPath: janusgraph-cached.properties
116 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100117 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100118 subPath: aaiconfig.properties
119 - mountPath: /opt/aai/logroot/AAI-RES
Maciej Wereskid523d122021-09-21 11:22:13 +0200120 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100121 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100122 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100123 subPath: logback.xml
124 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100125 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100126 subPath: localhost-access-logback.xml
127 - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100128 name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100129 subPath: realm.properties
130 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100131 name: properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100132 subPath: application.properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100133 ports:
134 - containerPort: {{ .Values.service.internalPort }}
135 - containerPort: {{ .Values.service.internalPort2 }}
leila46fb5802022-11-15 11:33:21 -0500136 - containerPort: {{ .Values.service.internalPort3 }}
M.Hosnidokht6c806532021-08-25 09:19:41 -0400137 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
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100149 # 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 }}
miroslavmasaryka7ac7f02023-03-01 14:12:26 +0100163 resources: {{ include "common.resources" . | nindent 10 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100164 {{- 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
Maciej Wereskid523d122021-09-21 11:22:13 +0200174 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200175 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
efiacord12c1672023-03-23 12:10:50 +0000176 volumes:
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100177 - name: localtime
178 hostPath:
179 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200180 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100181 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200182 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100183 - name: config
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100184 configMap:
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100185 name: {{ include "common.fullname" . }}
Sylvain Desbureauxc57b58d2021-02-23 18:07:34 +0100186 - name: properties
othman touijer51176672021-12-01 16:21:18 +0100187 configMap:
188 name: {{ include "common.fullname" . }}-properties
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100189 restartPolicy: {{ .Values.restartPolicy }}
190 imagePullSecrets:
osk1146127fd7d82021-06-18 00:51:17 +0200191 - name: {{ include "common.namespace" . }}-docker-registry-key