blob: 6de34e9be7ca997452ed451927b238da3d7d0690 [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 Desbureaux5b651322020-12-07 15:34:15 +01008# Copyright (c) 2020 Orange Intellectual Property. All rights reserved.
Sylvain Desbureaux70070412020-11-09 21:58:48 +01009# ================================================================================
10# Licensed under the Apache License, Version 2.0 (the "License");
11# you may not use this file except in compliance with the License.
12# You may obtain a copy of the License at
13#
14# http://www.apache.org/licenses/LICENSE-2.0
15#
16# Unless required by applicable law or agreed to in writing, software
17# distributed under the License is distributed on an "AS IS" BASIS,
18# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19# See the License for the specific language governing permissions and
20# limitations under the License.
21# ============LICENSE_END=========================================================
Sylvain Desbureaux47eb4d22020-12-10 12:15:27 +010022*/}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010023apiVersion: apps/v1
24kind: Deployment
25metadata:
26 name: {{ include "common.fullname" . }}
27 namespace: {{ include "common.namespace" . }}
28 labels:
29 app: {{ include "common.name" . }}
30 chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
31 release: {{ include "common.release" . }}
32 heritage: {{ .Release.Service }}
33spec:
34 replicas: {{ .Values.replicaCount }}
M.Hosnidokht6c806532021-08-25 09:19:41 -040035 minReadySeconds: {{ .Values.minReadySeconds }}
36 strategy:
37 type: {{ .Values.updateStrategy.type }}
38 rollingUpdate:
39 maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
40 maxSurge: {{ .Values.updateStrategy.maxSurge }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010041 selector:
42 matchLabels:
43 app: {{ include "common.name" . }}
44 template:
45 metadata:
46 labels:
47 app: {{ include "common.name" . }}
48 release: {{ include "common.release" . }}
49 name: {{ include "common.name" . }}
50 annotations:
51 checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
52 spec:
53 hostname: aai-graphadmin
M.Hosnidokht6c806532021-08-25 09:19:41 -040054 terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010055 {{ if .Values.global.initContainers.enabled }}
56 initContainers:
57 - command:
58 {{ if .Values.global.jobs.migration.enabled }}
59 - /app/ready.py
60 args:
61 - --job-name
62 - {{ include "common.release" . }}-aai-graphadmin-migration
63 {{ else if .Values.global.jobs.createSchema.enabled }}
64 - /app/ready.py
65 args:
66 - --job-name
67 - {{ include "common.release" . }}-aai-graphadmin-create-db-schema
68 {{ else }}
69 - /app/ready.py
70 args:
71 - --container-name
72 {{- if .Values.global.cassandra.localCluster }}
73 - aai-cassandra
74 {{- else }}
75 - cassandra
76 {{- end }}
77 - --container-name
78 - aai-schema-service
79 {{ end }}
80 env:
81 - name: NAMESPACE
82 valueFrom:
83 fieldRef:
84 apiVersion: v1
85 fieldPath: metadata.namespace
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010086 image: {{ include "repositoryGenerator.image.readiness" . }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010087 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
88 name: {{ include "common.name" . }}-readiness
89 {{ end }}
90 containers:
91 - name: {{ include "common.name" . }}
Sylvain Desbureaux5b651322020-12-07 15:34:15 +010092 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +010093 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
94 env:
95 - name: LOCAL_USER_ID
96 value: {{ .Values.global.config.userId | quote }}
97 - name: LOCAL_GROUP_ID
98 value: {{ .Values.global.config.groupId | quote }}
M.Hosnidokht6c806532021-08-25 09:19:41 -040099 - name: INTERNAL_PORT_1
100 value: {{ .Values.service.internalPort | quote }}
101 - name: INTERNAL_PORT_2
102 value: {{ .Values.service.internalPort2 | quote }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100103 volumeMounts:
104 - mountPath: /etc/localtime
105 name: localtime
106 readOnly: true
107 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties
108 name: {{ include "common.fullname" . }}-config
109 subPath: janusgraph-realtime.properties
110 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties
111 name: {{ include "common.fullname" . }}-config
112 subPath: janusgraph-cached.properties
113 - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties
114 name: {{ include "common.fullname" . }}-config
115 subPath: aaiconfig.properties
116 - mountPath: /opt/aai/logroot/AAI-RES
Maciej Wereskid523d122021-09-21 11:22:13 +0200117 name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100118 - mountPath: /opt/app/aai-graphadmin/resources/logback.xml
119 name: {{ include "common.fullname" . }}-config
120 subPath: logback.xml
121 - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml
122 name: {{ include "common.fullname" . }}-config
123 subPath: localhost-access-logback.xml
124 - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties
125 name: {{ include "common.fullname" . }}-config
126 subPath: realm.properties
127 - mountPath: /opt/app/aai-graphadmin/resources/application.properties
128 name: {{ include "common.fullname" . }}-config
129 subPath: application.properties
130 {{ $global := . }}
131 {{ range $job := .Values.global.config.auth.files }}
132 - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }}
133 name: {{ include "common.fullname" $global }}-auth-truststore-sec
134 subPath: {{ . }}
135 {{ end }}
136 ports:
137 - containerPort: {{ .Values.service.internalPort }}
138 - containerPort: {{ .Values.service.internalPort2 }}
M.Hosnidokht6c806532021-08-25 09:19:41 -0400139 lifecycle:
140 # wait for active requests (long-running tasks) to be finished
141 # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
142 preStop:
143 exec:
144 command:
145 - sh
146 - -c
147 - |
148 while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2)
149 do sleep 10
150 done
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100151 # disable liveness probe when breakpoints set in debugger
152 # so K8s doesn't restart unresponsive container
153 {{ if .Values.liveness.enabled }}
154 livenessProbe:
155 tcpSocket:
156 port: {{ .Values.service.internalPort }}
157 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
158 periodSeconds: {{ .Values.liveness.periodSeconds }}
159 {{ end }}
160 readinessProbe:
161 tcpSocket:
162 port: {{ .Values.service.internalPort }}
163 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
164 periodSeconds: {{ .Values.readiness.periodSeconds }}
165 resources:
166{{ include "common.resources" . }}
167 {{- if .Values.nodeSelector }}
168 nodeSelector:
169{{ toYaml .Values.nodeSelector | indent 8 }}
170 {{- end -}}
171 {{- if .Values.affinity }}
172 affinity:
173{{ toYaml .Values.affinity | indent 8 }}
174 {{- end }}
175
176 # side car containers
Maciej Wereskid523d122021-09-21 11:22:13 +0200177 {{ include "common.log.sidecar" . | nindent 6 }}
farida azmyd8937332021-03-09 12:20:42 +0200178 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100179 volumes:
180 - name: localtime
181 hostPath:
182 path: /etc/localtime
Maciej Wereskid523d122021-09-21 11:22:13 +0200183 - name: logs
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100184 emptyDir: {}
Maciej Wereskid523d122021-09-21 11:22:13 +0200185 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100186 - name: {{ include "common.fullname" . }}-config
187 configMap:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100188 name: {{ include "common.fullname" . }}-configmap
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100189 - name: {{ include "common.fullname" . }}-auth-truststore-sec
190 secret:
Sylvain Desbureaux5b651322020-12-07 15:34:15 +0100191 secretName: aai-common-truststore
192 items:
193 {{ range $job := .Values.global.config.auth.files }}
194 - key: {{ . }}
195 path: {{ . }}
196 {{ end }}
Sylvain Desbureaux70070412020-11-09 21:58:48 +0100197 restartPolicy: {{ .Values.restartPolicy }}
198 imagePullSecrets:
osk1146127fd7d82021-06-18 00:51:17 +0200199 - name: {{ include "common.namespace" . }}-docker-registry-key