2 # Copyright © 2017 Amdocs, Bell Canada
3 # Modifications Copyright © 2018 AT&T
4 # Modifications Copyright © 2020 Nokia, Orange
5 # Modifications Copyright © 2021 Orange
6 # Modifications Copyright © 2023 Nordix Foundation
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
23 metadata: {{- include "common.resourceMetadata" (dict "annotations" .Values.annotations "dot" .) | nindent 2 }}
25 {{- if or .Values.config.debug.enabled .Values.config.profiling.enabled }}
28 {{- if not .Values.autoscaling.enabled }}
29 replicas: {{ .Values.replicaCount }}
32 revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
33 minReadySeconds: {{ .Values.minReadySeconds }}
35 type: {{ .Values.updateStrategy.type }}
37 maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }}
38 maxSurge: {{ .Values.updateStrategy.maxSurge }}
41 app: {{ include "common.name" . }}
43 metadata: {{- include "common.templateMetadata" . | nindent 6 }}
45 hostname: aai-traversal
46 terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }}
48 {{- if .Values.global.jobs.migration.enabled }}
49 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_migration) | nindent 8 }}
50 {{- else if .Values.global.jobs.createSchema.enabled }}
51 {{ include "aai.waitForSchemaCreation" . | nindent 6 }}
53 {{ include "common.readinessCheck.waitFor" (dict "dot" . "wait_for" .Values.readinessCheck.wait_for_cassandra) | nindent 8 }}
55 {{ include "common.podSecurityContext" . | indent 6 | trim }}
57 - name: {{ include "common.name" . }}
58 image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }}
59 imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
60 {{ include "common.containerSecurityContext" . | indent 8 | trim }}
62 {{- if .Values.config.env }}
63 {{- range $key,$value := .Values.config.env }}
64 - name: {{ $key | upper | quote}}
65 value: {{ $value | quote}}
68 {{- if eq .Values.flavor "small" }}
70 value: {{ .Values.small.maxHeapSize | quote }}
71 {{- else if eq .Values.flavor "large" }}
73 value: {{ .Values.large.maxHeapSize | quote }}
75 {{- if .Values.config.profiling.enabled }}
77 value: '{{ join " " .Values.config.profiling.args }}'
79 {{- if .Values.config.debug.enabled }}
81 value: {{ .Values.config.debug.args | quote }}
83 - name: DISABLE_UPDATE_QUERY
84 value: {{ .Values.config.disableUpdateQuery | quote }}
85 - name: INTERNAL_PORT_1
86 value: {{ .Values.service.traversalPort | quote }}
87 - name: INTERNAL_PORT_2
88 value: {{ .Values.service.debugPort | quote }}
89 - name: INTERNAL_PORT_3
90 value: {{ .Values.service.metricsPort | quote }}
91 - name: BOOTSTRAP_SERVERS
92 value: {{ include "common.release" . }}-strimzi-kafka-bootstrap:9092
96 name: {{ include "common.release" . }}-{{ .Values.global.aaiTravKafkaUser }}
99 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties
100 name: {{ include "common.fullname" . }}-config
101 subPath: janusgraph-realtime.properties
102 - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties
103 name: {{ include "common.fullname" . }}-config
104 subPath: aaiconfig.properties
105 - mountPath: /opt/aai/logroot/AAI-GQ
107 - mountPath: /opt/aai/logroot/AAI-GQ/misc
108 name: {{ include "common.fullname" . }}-logs-misc
109 - mountPath: /opt/app/aai-traversal/resources/logback.xml
110 name: {{ include "common.fullname" . }}-config
112 - mountPath: /opt/app/aai-traversal/resources/application.properties
113 name: {{ include "common.fullname" . }}-config
114 subPath: application.properties
118 - containerPort: {{ .Values.service.traversalPort }}
119 name: {{ .Values.service.traversalPortName }}
120 {{- if .Values.config.debug.enabled }}
121 - containerPort: {{ .Values.service.debugPort }}
122 name: {{ .Values.service.debugPortName }}
124 - containerPort: {{ .Values.service.metricsPort }}
125 name: {{ .Values.service.metricsPortName }}
126 {{- if .Values.config.profiling.enabled }}
127 - containerPort: {{ .Values.service.profilingPort }}
128 name: {{ .Values.service.profilingPortName }}
131 # wait for active requests (long-running tasks) to be finished
132 # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod.
139 while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1)
142 # disable liveness probe when
143 # debugging.enable=true or profiling.enabled=true
144 {{- if and .Values.liveness.enabled (not (or .Values.config.debug.enabled .Values.config.profiling.enabled)) }}
147 port: {{ .Values.service.metricsPort }}
148 path: {{ .Values.liveness.path }}
149 {{- if .Values.liveness.initialDelaySeconds }}
150 initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
152 periodSeconds: {{ .Values.liveness.periodSeconds }}
156 port: {{ .Values.service.metricsPort }}
157 path: {{ .Values.readiness.path }}
158 {{- if .Values.readiness.initialDelaySeconds }}
159 initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
161 periodSeconds: {{ .Values.readiness.periodSeconds }}
162 resources: {{ include "common.resources" . | nindent 10 }}
163 {{- if .Values.nodeSelector }}
164 nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }}
166 {{- if .Values.affinity }}
167 affinity: {{ toYaml .Values.affinity | indent 8 }}
170 # side car containers
171 {{ include "common.log.sidecar" . | nindent 6 }}
172 serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
176 sizeLimit: {{ .Values.volumes.logSizeLimit }}
179 sizeLimit: {{ .Values.volumes.tmpSizeLimit }}
180 - name: {{ include "common.fullname" . }}-logs-misc
182 sizeLimit: {{ .Values.volumes.logmiscSizeLimit }}
183 {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }}
184 - name: {{ include "common.fullname" . }}-config
186 name: {{ include "common.fullname" . }}
187 restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }}
188 {{- include "common.imagePullSecrets" . | nindent 6 }}