Sylvain Desbureaux | 47eb4d2 | 2020-12-10 12:15:27 +0100 | [diff] [blame] | 1 | {{/* |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 2 | # |
| 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 Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 8 | # Copyright (c) 2020-2021 Orange Intellectual Property. All rights reserved. |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame] | 9 | # Modifications Copyright © 2023 Nordix Foundation |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 10 | # ================================================================================ |
| 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 Desbureaux | 47eb4d2 | 2020-12-10 12:15:27 +0100 | [diff] [blame] | 23 | */}} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 24 | apiVersion: apps/v1 |
| 25 | kind: Deployment |
| 26 | metadata: |
| 27 | name: {{ include "common.fullname" . }} |
| 28 | namespace: {{ include "common.namespace" . }} |
| 29 | labels: |
| 30 | app: {{ include "common.name" . }} |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 31 | app.kubernetes.io/name: {{ include "common.name" . }} |
| 32 | {{- if .Chart.AppVersion }} |
Andreas Geissler | 85a5a34 | 2023-07-19 14:05:20 +0200 | [diff] [blame] | 33 | version: "{{ .Chart.AppVersion | replace "+" "_" }}" |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 34 | {{- else }} |
Andreas Geissler | 85a5a34 | 2023-07-19 14:05:20 +0200 | [diff] [blame] | 35 | version: "{{ .Chart.Version | replace "+" "_" }}" |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 36 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 37 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 38 | release: {{ include "common.release" . }} |
| 39 | heritage: {{ .Release.Service }} |
| 40 | spec: |
| 41 | replicas: {{ .Values.replicaCount }} |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 42 | minReadySeconds: {{ .Values.minReadySeconds }} |
| 43 | strategy: |
| 44 | type: {{ .Values.updateStrategy.type }} |
| 45 | rollingUpdate: |
| 46 | maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }} |
| 47 | maxSurge: {{ .Values.updateStrategy.maxSurge }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 48 | selector: |
| 49 | matchLabels: |
| 50 | app: {{ include "common.name" . }} |
| 51 | template: |
| 52 | metadata: |
| 53 | labels: |
| 54 | app: {{ include "common.name" . }} |
| 55 | release: {{ include "common.release" . }} |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 56 | app.kubernetes.io/name: {{ include "common.name" . }} |
| 57 | {{- if .Chart.AppVersion }} |
Andreas Geissler | 85a5a34 | 2023-07-19 14:05:20 +0200 | [diff] [blame] | 58 | version: "{{ .Chart.AppVersion | replace "+" "_" }}" |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 59 | {{- else }} |
Andreas Geissler | 85a5a34 | 2023-07-19 14:05:20 +0200 | [diff] [blame] | 60 | version: "{{ .Chart.Version | replace "+" "_" }}" |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 61 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 62 | name: {{ include "common.name" . }} |
| 63 | annotations: |
| 64 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 65 | spec: |
| 66 | hostname: aai-graphadmin |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 67 | terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 68 | {{ if .Values.global.initContainers.enabled }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame] | 69 | initContainers: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 70 | - command: |
| 71 | {{ if .Values.global.jobs.migration.enabled }} |
| 72 | - /app/ready.py |
| 73 | args: |
| 74 | - --job-name |
| 75 | - {{ include "common.release" . }}-aai-graphadmin-migration |
| 76 | {{ else if .Values.global.jobs.createSchema.enabled }} |
| 77 | - /app/ready.py |
| 78 | args: |
| 79 | - --job-name |
| 80 | - {{ include "common.release" . }}-aai-graphadmin-create-db-schema |
| 81 | {{ else }} |
| 82 | - /app/ready.py |
| 83 | args: |
Andreas Geissler | cfd8434 | 2023-08-16 17:18:49 +0200 | [diff] [blame] | 84 | - --app-name |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 85 | {{- if .Values.global.cassandra.localCluster }} |
| 86 | - aai-cassandra |
| 87 | {{- else }} |
| 88 | - cassandra |
| 89 | {{- end }} |
| 90 | - --container-name |
| 91 | - aai-schema-service |
| 92 | {{ end }} |
| 93 | env: |
| 94 | - name: NAMESPACE |
| 95 | valueFrom: |
| 96 | fieldRef: |
| 97 | apiVersion: v1 |
| 98 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 99 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 100 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 101 | name: {{ include "common.name" . }}-readiness |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 102 | resources: |
| 103 | limits: |
| 104 | cpu: "100m" |
| 105 | memory: "0.5Gi" |
| 106 | requests: |
| 107 | cpu: "3m" |
| 108 | memory: "0.02Gi" |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 109 | {{ end }} |
| 110 | containers: |
| 111 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 112 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 113 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 114 | env: |
| 115 | - name: LOCAL_USER_ID |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 116 | value: {{ .Values.securityContext.user_id | quote }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 117 | - name: LOCAL_GROUP_ID |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 118 | value: {{ .Values.securityContext.group_id | quote }} |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 119 | - name: INTERNAL_PORT_1 |
| 120 | value: {{ .Values.service.internalPort | quote }} |
| 121 | - name: INTERNAL_PORT_2 |
| 122 | value: {{ .Values.service.internalPort2 | quote }} |
leila | 46fb580 | 2022-11-15 11:33:21 -0500 | [diff] [blame] | 123 | - name: INTERNAL_PORT_3 |
| 124 | value: {{ .Values.service.internalPort3 | quote }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame] | 125 | volumeMounts: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 126 | - mountPath: /etc/localtime |
| 127 | name: localtime |
| 128 | readOnly: true |
| 129 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 130 | name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 131 | subPath: janusgraph-realtime.properties |
| 132 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 133 | name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 134 | subPath: janusgraph-cached.properties |
| 135 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 136 | name: properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 137 | subPath: aaiconfig.properties |
| 138 | - mountPath: /opt/aai/logroot/AAI-RES |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 139 | name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 140 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 141 | name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 142 | subPath: logback.xml |
| 143 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 144 | name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 145 | subPath: localhost-access-logback.xml |
| 146 | - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 147 | name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 148 | subPath: realm.properties |
| 149 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 150 | name: properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 151 | subPath: application.properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 152 | ports: |
| 153 | - containerPort: {{ .Values.service.internalPort }} |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 154 | name: {{ .Values.service.portName }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 155 | - containerPort: {{ .Values.service.internalPort2 }} |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 156 | name: {{ .Values.service.portName2 }} |
leila | 46fb580 | 2022-11-15 11:33:21 -0500 | [diff] [blame] | 157 | - containerPort: {{ .Values.service.internalPort3 }} |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 158 | name: {{ .Values.service.portName3 }} |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 159 | lifecycle: |
| 160 | # wait for active requests (long-running tasks) to be finished |
| 161 | # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod. |
| 162 | preStop: |
| 163 | exec: |
| 164 | command: |
| 165 | - sh |
| 166 | - -c |
| 167 | - | |
| 168 | while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2) |
| 169 | do sleep 10 |
| 170 | done |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 171 | # disable liveness probe when breakpoints set in debugger |
| 172 | # so K8s doesn't restart unresponsive container |
| 173 | {{ if .Values.liveness.enabled }} |
| 174 | livenessProbe: |
| 175 | tcpSocket: |
| 176 | port: {{ .Values.service.internalPort }} |
| 177 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 178 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 179 | {{ end }} |
| 180 | readinessProbe: |
| 181 | tcpSocket: |
| 182 | port: {{ .Values.service.internalPort }} |
| 183 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 184 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 185 | resources: {{ include "common.resources" . | nindent 10 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 186 | {{- if .Values.nodeSelector }} |
| 187 | nodeSelector: |
| 188 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 189 | {{- end -}} |
| 190 | {{- if .Values.affinity }} |
| 191 | affinity: |
| 192 | {{ toYaml .Values.affinity | indent 8 }} |
| 193 | {{- end }} |
| 194 | |
| 195 | # side car containers |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 196 | {{ include "common.log.sidecar" . | nindent 6 }} |
farida azmy | d893733 | 2021-03-09 12:20:42 +0200 | [diff] [blame] | 197 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame] | 198 | volumes: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 199 | - name: localtime |
| 200 | hostPath: |
| 201 | path: /etc/localtime |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 202 | - name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 203 | emptyDir: {} |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 204 | {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 205 | - name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 206 | configMap: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 207 | name: {{ include "common.fullname" . }} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 208 | - name: properties |
othman touijer | 5117667 | 2021-12-01 16:21:18 +0100 | [diff] [blame] | 209 | configMap: |
| 210 | name: {{ include "common.fullname" . }}-properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 211 | restartPolicy: {{ .Values.restartPolicy }} |
| 212 | imagePullSecrets: |
osk11461 | 27fd7d8 | 2021-06-18 00:51:17 +0200 | [diff] [blame] | 213 | - name: {{ include "common.namespace" . }}-docker-registry-key |