Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / aai / components / aai-schema-service / templates / deployment.yaml
1 {{/*
2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T
4 # Modifications Copyright © 2020 Orange
5 # Modifications Copyright © 2023 Nordix Foundation
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     app.kubernetes.io/name: {{ include "common.name" . }}
28     {{- if .Chart.AppVersion }}
29     version: "{{ .Chart.AppVersion | replace "+" "_" }}"
30     {{- else }}
31     version: "{{ .Chart.Version | replace "+" "_" }}"
32     {{- end }}
33     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
34     release: {{ include "common.release" . }}
35     heritage: {{ .Release.Service }}
36 spec:
37   replicas: {{ .Values.replicaCount }}
38   strategy:
39     type: {{ .Values.updateStrategy.type }}
40     {{- if (eq "RollingUpdate" .Values.updateStrategy.type) }}
41     rollingUpdate:
42       maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
43       maxSurge: {{ .Values.updateStrategy.maxSurge }}
44     {{- end }}
45   selector:
46     matchLabels:
47       app: {{ include "common.name" . }}
48   template:
49     metadata:
50       labels:
51         app: {{ include "common.name" . }}
52         release: {{ include "common.release" . }}
53         app.kubernetes.io/name: {{ include "common.name" . }}
54         {{- if .Chart.AppVersion }}
55         version: "{{ .Chart.AppVersion | replace "+" "_" }}"
56         {{- else }}
57         version: "{{ .Chart.Version | replace "+" "_" }}"
58         {{- end }}
59       name: {{ include "common.name" . }}
60       annotations:
61         checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
62     spec:
63       containers:
64       - name: {{ include "common.name" . }}
65         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
66         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
67         env:
68         - name: LOCAL_USER_ID
69           value: {{ .Values.securityContext.user_id | quote }}
70         - name: LOCAL_GROUP_ID
71           value: {{ .Values.securityContext.group_id | quote }}
72         volumeMounts:
73         - mountPath: /opt/app/aai-schema-service/resources/etc/appprops/aaiconfig.properties
74           name: aaiconfig-conf
75           subPath: aaiconfig.properties
76         - mountPath: /opt/aai/logroot/AAI-SS
77           name: logs
78         - mountPath: /opt/app/aai-schema-service/resources/logback.xml
79           name: log-conf
80           subPath: logback.xml
81         - mountPath: /opt/app/aai-schema-service/resources/localhost-access-logback.xml
82           name: localhost-access-log-conf
83           subPath: localhost-access-logback.xml
84         - mountPath: /opt/app/aai-schema-service/resources/etc/auth/realm.properties
85           name: realm-conf
86           subPath: realm.properties
87         - mountPath: /opt/app/aai-schema-service/resources/application.properties
88           name: springapp-conf
89           subPath: application.properties
90         ports:
91         - containerPort: {{ .Values.service.internalPort }}
92           name: {{ .Values.service.portName }}
93         - containerPort: {{ .Values.service.internalPort2 }}
94           name: {{ .Values.service.portName2 }}
95         # disable liveness probe when breakpoints set in debugger
96         # so K8s doesn't restart unresponsive container
97         {{ if .Values.liveness.enabled }}
98         livenessProbe:
99           tcpSocket:
100             port: {{ .Values.service.internalPort }}
101           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
102           periodSeconds: {{ .Values.liveness.periodSeconds }}
103         {{ end }}
104         readinessProbe:
105           tcpSocket:
106             port: {{ .Values.service.internalPort }}
107           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
108           periodSeconds: {{ .Values.readiness.periodSeconds }}
109         resources: {{ include "common.resources" . | nindent 10 }}
110       {{- if .Values.nodeSelector }}
111       nodeSelector:
112 {{ toYaml .Values.nodeSelector | indent 8 }}
113       {{- end -}}
114       {{- if .Values.affinity }}
115       affinity:
116 {{ toYaml .Values.affinity | indent 8 }}
117       {{- end }}
118
119       # side car containers
120       {{ include "common.log.sidecar" . | nindent 6 }}
121       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
122       volumes:
123       - name: aai-common-aai-auth-mount
124         secret:
125           secretName: aai-common-aai-auth
126       - name: logs
127         emptyDir: {}
128       {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
129       - name: log-conf
130         configMap:
131           name: {{ include "common.fullname" . }}-log
132       - name: localhost-access-log-conf
133         configMap:
134           name: {{ include "common.fullname" . }}-localhost-access-log
135       - name: springapp-conf
136         configMap:
137           name: {{ include "common.fullname" . }}-springapp
138       - name: aaiconfig-conf
139         configMap:
140           name: {{ include "common.fullname" . }}-aaiconfig
141       - name: realm-conf
142         configMap:
143           name: {{ include "common.fullname" . }}-realm
144       restartPolicy: {{ .Values.restartPolicy }}
145       {{- include "common.imagePullSecrets" . | nindent 6 }}