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 | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 8 | # Copyright (c) 2020 Orange Intellectual Property. All rights reserved. |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 9 | # ================================================================================ |
| 10 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | # you may not use this file except in compliance with the License. |
| 12 | # You may obtain a copy of the License at |
| 13 | # |
| 14 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | # |
| 16 | # Unless required by applicable law or agreed to in writing, software |
| 17 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | # See the License for the specific language governing permissions and |
| 20 | # limitations under the License. |
| 21 | # ============LICENSE_END========================================================= |
Sylvain Desbureaux | 47eb4d2 | 2020-12-10 12:15:27 +0100 | [diff] [blame] | 22 | */}} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 23 | apiVersion: apps/v1 |
| 24 | kind: Deployment |
| 25 | metadata: |
| 26 | name: {{ include "common.fullname" . }} |
| 27 | namespace: {{ include "common.namespace" . }} |
| 28 | labels: |
| 29 | app: {{ include "common.name" . }} |
| 30 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 31 | release: {{ include "common.release" . }} |
| 32 | heritage: {{ .Release.Service }} |
| 33 | spec: |
| 34 | replicas: {{ .Values.replicaCount }} |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 35 | minReadySeconds: {{ .Values.minReadySeconds }} |
| 36 | strategy: |
| 37 | type: {{ .Values.updateStrategy.type }} |
| 38 | rollingUpdate: |
| 39 | maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }} |
| 40 | maxSurge: {{ .Values.updateStrategy.maxSurge }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 41 | selector: |
| 42 | matchLabels: |
| 43 | app: {{ include "common.name" . }} |
| 44 | template: |
| 45 | metadata: |
| 46 | labels: |
| 47 | app: {{ include "common.name" . }} |
| 48 | release: {{ include "common.release" . }} |
| 49 | name: {{ include "common.name" . }} |
| 50 | annotations: |
| 51 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
| 52 | spec: |
| 53 | hostname: aai-graphadmin |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 54 | terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 55 | {{ if .Values.global.initContainers.enabled }} |
| 56 | initContainers: |
| 57 | - command: |
| 58 | {{ if .Values.global.jobs.migration.enabled }} |
| 59 | - /app/ready.py |
| 60 | args: |
| 61 | - --job-name |
| 62 | - {{ include "common.release" . }}-aai-graphadmin-migration |
| 63 | {{ else if .Values.global.jobs.createSchema.enabled }} |
| 64 | - /app/ready.py |
| 65 | args: |
| 66 | - --job-name |
| 67 | - {{ include "common.release" . }}-aai-graphadmin-create-db-schema |
| 68 | {{ else }} |
| 69 | - /app/ready.py |
| 70 | args: |
| 71 | - --container-name |
| 72 | {{- if .Values.global.cassandra.localCluster }} |
| 73 | - aai-cassandra |
| 74 | {{- else }} |
| 75 | - cassandra |
| 76 | {{- end }} |
| 77 | - --container-name |
| 78 | - aai-schema-service |
| 79 | {{ end }} |
| 80 | env: |
| 81 | - name: NAMESPACE |
| 82 | valueFrom: |
| 83 | fieldRef: |
| 84 | apiVersion: v1 |
| 85 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 86 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 87 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 88 | name: {{ include "common.name" . }}-readiness |
| 89 | {{ end }} |
| 90 | containers: |
| 91 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 92 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 93 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 94 | env: |
| 95 | - name: LOCAL_USER_ID |
| 96 | value: {{ .Values.global.config.userId | quote }} |
| 97 | - name: LOCAL_GROUP_ID |
| 98 | value: {{ .Values.global.config.groupId | quote }} |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 99 | - name: INTERNAL_PORT_1 |
| 100 | value: {{ .Values.service.internalPort | quote }} |
| 101 | - name: INTERNAL_PORT_2 |
| 102 | value: {{ .Values.service.internalPort2 | quote }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 103 | volumeMounts: |
| 104 | - mountPath: /etc/localtime |
| 105 | name: localtime |
| 106 | readOnly: true |
| 107 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
| 108 | name: {{ include "common.fullname" . }}-config |
| 109 | subPath: janusgraph-realtime.properties |
| 110 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
| 111 | name: {{ include "common.fullname" . }}-config |
| 112 | subPath: janusgraph-cached.properties |
| 113 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
| 114 | name: {{ include "common.fullname" . }}-config |
| 115 | subPath: aaiconfig.properties |
| 116 | - mountPath: /opt/aai/logroot/AAI-RES |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame^] | 117 | name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 118 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
| 119 | name: {{ include "common.fullname" . }}-config |
| 120 | subPath: logback.xml |
| 121 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
| 122 | name: {{ include "common.fullname" . }}-config |
| 123 | subPath: localhost-access-logback.xml |
| 124 | - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/realm.properties |
| 125 | name: {{ include "common.fullname" . }}-config |
| 126 | subPath: realm.properties |
| 127 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
| 128 | name: {{ include "common.fullname" . }}-config |
| 129 | subPath: application.properties |
| 130 | {{ $global := . }} |
| 131 | {{ range $job := .Values.global.config.auth.files }} |
| 132 | - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }} |
| 133 | name: {{ include "common.fullname" $global }}-auth-truststore-sec |
| 134 | subPath: {{ . }} |
| 135 | {{ end }} |
| 136 | ports: |
| 137 | - containerPort: {{ .Values.service.internalPort }} |
| 138 | - containerPort: {{ .Values.service.internalPort2 }} |
M.Hosnidokht | 6c80653 | 2021-08-25 09:19:41 -0400 | [diff] [blame] | 139 | lifecycle: |
| 140 | # wait for active requests (long-running tasks) to be finished |
| 141 | # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod. |
| 142 | preStop: |
| 143 | exec: |
| 144 | command: |
| 145 | - sh |
| 146 | - -c |
| 147 | - | |
| 148 | while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2) |
| 149 | do sleep 10 |
| 150 | done |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 151 | # disable liveness probe when breakpoints set in debugger |
| 152 | # so K8s doesn't restart unresponsive container |
| 153 | {{ if .Values.liveness.enabled }} |
| 154 | livenessProbe: |
| 155 | tcpSocket: |
| 156 | port: {{ .Values.service.internalPort }} |
| 157 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 158 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 159 | {{ end }} |
| 160 | readinessProbe: |
| 161 | tcpSocket: |
| 162 | port: {{ .Values.service.internalPort }} |
| 163 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 164 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
| 165 | resources: |
| 166 | {{ include "common.resources" . }} |
| 167 | {{- if .Values.nodeSelector }} |
| 168 | nodeSelector: |
| 169 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 170 | {{- end -}} |
| 171 | {{- if .Values.affinity }} |
| 172 | affinity: |
| 173 | {{ toYaml .Values.affinity | indent 8 }} |
| 174 | {{- end }} |
| 175 | |
| 176 | # side car containers |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame^] | 177 | {{ include "common.log.sidecar" . | nindent 6 }} |
farida azmy | d893733 | 2021-03-09 12:20:42 +0200 | [diff] [blame] | 178 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 179 | volumes: |
| 180 | - name: localtime |
| 181 | hostPath: |
| 182 | path: /etc/localtime |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame^] | 183 | - name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 184 | emptyDir: {} |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame^] | 185 | {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 186 | - name: {{ include "common.fullname" . }}-config |
| 187 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 188 | name: {{ include "common.fullname" . }}-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 189 | - name: {{ include "common.fullname" . }}-auth-truststore-sec |
| 190 | secret: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 191 | secretName: aai-common-truststore |
| 192 | items: |
| 193 | {{ range $job := .Values.global.config.auth.files }} |
| 194 | - key: {{ . }} |
| 195 | path: {{ . }} |
| 196 | {{ end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 197 | restartPolicy: {{ .Values.restartPolicy }} |
| 198 | imagePullSecrets: |
osk11461 | 27fd7d8 | 2021-06-18 00:51:17 +0200 | [diff] [blame] | 199 | - name: {{ include "common.namespace" . }}-docker-registry-key |