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