Merge "[AAI] Add model-loader tracing config"
[oom.git] / kubernetes / aai / components / aai-sparky-be / templates / deployment.yaml
1 {{/*
2 # Copyright (c) 2017 Amdocs, Bell Canada
3 # Modifications Copyright (c) 2018 AT&T
4 # Modifications Copyright (c) 2020 Nokia
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: {{- include "common.resourceMetadata" . | nindent 2 }}
23 spec:
24   selector: {{- include "common.selectors" . | nindent 4 }}
25   replicas: {{ .Values.replicaCount }}
26   strategy:
27     type: {{ .Values.updateStrategy.type }}
28     {{- if (eq "RollingUpdate" .Values.updateStrategy.type) }}
29     rollingUpdate:
30       maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
31       maxSurge: {{ .Values.updateStrategy.maxSurge }}
32     {{- end }}
33   template:
34     metadata: {{- include "common.templateMetadata" . | nindent 6 }}
35     spec:
36       initContainers:
37       - command:
38         - /app/ready.py
39         args:
40         - --service-name
41         - aai
42         env:
43         - name: NAMESPACE
44           valueFrom:
45             fieldRef:
46               apiVersion: v1
47               fieldPath: metadata.namespace
48         image: {{ include "repositoryGenerator.image.readiness" . }}
49         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
50         name: {{ include "common.name" . }}-readiness
51         resources:
52           limits:
53             cpu: "100m"
54             memory: "500Mi"
55           requests:
56             cpu: "3m"
57             memory: "20Mi"
58       containers:
59       - name: {{ include "common.name" . }}
60         image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
61         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
62         command:
63         - sh
64         args:
65         - -c
66         - |
67           echo "*** actual launch of AAI Sparky BE"
68           /opt/app/sparky/bin/start.sh
69         volumeMounts:
70         - mountPath: {{ .Values.log.path }}
71           name: logs
72         - mountPath:  /opt/app/sparky/config/application.properties
73           name: config
74           subPath: application.properties
75         - mountPath:  /opt/app/sparky/config/application-resources.properties
76           name: config
77           subPath: application-resources.properties
78         - mountPath:  /opt/app/sparky/config/application-ssl.properties
79           name: config
80           subPath: application-ssl.properties
81         - mountPath:  /opt/app/sparky/config/application-oxm-default.properties
82           name: config
83           subPath: application-oxm-default.properties
84         - mountPath:  /opt/app/sparky/config/application-oxm-override.properties
85           name: config
86           subPath: application-oxm-override.properties
87         - mountPath:  /opt/app/sparky/config/application-oxm-schema-prod.properties
88           name: config
89           subPath: application-oxm-schema-prod.properties
90         - mountPath:  /opt/app/sparky/config/roles.config
91           name: config
92           subPath: roles.config
93         - mountPath:  /opt/app/sparky/config/users.config
94           name: config
95           subPath: users.config
96         - mountPath:  /opt/app/sparky/config/logging/logback.xml
97           name: config
98           subPath: logback.xml
99         ports: {{ include "common.containerPorts" . | nindent 10  }}
100         # disable liveness probe when breakpoints set in debugger
101         # so K8s doesn't restart unresponsive container
102         {{- if eq .Values.liveness.enabled true }}
103         livenessProbe:
104           tcpSocket:
105             port: {{ .Values.service.internalPort }}
106           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
107           periodSeconds: {{ .Values.liveness.periodSeconds }}
108         {{ end -}}
109         readinessProbe:
110           tcpSocket:
111             port: {{ .Values.service.internalPort }}
112           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
113           periodSeconds: {{ .Values.readiness.periodSeconds }}
114         resources: {{ include "common.resources" . | nindent 10 }}
115       {{- if .Values.nodeSelector }}
116       nodeSelector:
117 {{ toYaml .Values.nodeSelector | indent 8 }}
118       {{- end -}}
119       {{- if .Values.affinity }}
120       affinity:
121 {{ toYaml .Values.affinity | indent 8 }}
122       {{- end }}
123
124       # side car containers
125       {{ include "common.log.sidecar" . | nindent 6 }}
126       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
127       volumes:
128       - name: config
129         configMap:
130           name: {{ include "common.fullname" . }}
131       - name: logs
132         emptyDir: {}
133         {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
134       - name: modeldir
135         emptyDir: {}
136       restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
137       {{- include "common.imagePullSecrets" . | nindent 6 }}