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 | # Copyright (c) 2017 Amdocs, Bell Canada |
| 3 | # Modifications Copyright (c) 2018 AT&T |
| 4 | # Modifications Copyright (c) 2020 Nokia |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 5 | # Modifications Copyright (c) 2021 Orange |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 6 | # Modifications Copyright © 2023 Nordix Foundation |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 7 | # |
| 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 |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 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. |
Sylvain Desbureaux | 47eb4d2 | 2020-12-10 12:15:27 +0100 | [diff] [blame] | 19 | */}} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 20 | |
| 21 | apiVersion: apps/v1 |
| 22 | kind: Deployment |
| 23 | metadata: |
| 24 | name: {{ include "common.fullname" . }} |
| 25 | namespace: {{ include "common.namespace" . }} |
| 26 | labels: |
| 27 | app: {{ include "common.name" . }} |
| 28 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 29 | release: {{ include "common.release" . }} |
| 30 | heritage: {{ .Release.Service }} |
| 31 | spec: |
| 32 | replicas: {{ .Values.replicaCount }} |
M.Hosnidokht | 09523be | 2021-08-24 09:00:42 -0400 | [diff] [blame] | 33 | minReadySeconds: {{ .Values.minReadySeconds }} |
| 34 | strategy: |
| 35 | type: {{ .Values.updateStrategy.type }} |
| 36 | rollingUpdate: |
| 37 | maxUnavailable: {{ .Values.updateStrategy.maxUnavailable }} |
| 38 | maxSurge: {{ .Values.updateStrategy.maxSurge }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 39 | selector: |
| 40 | matchLabels: |
| 41 | app: {{ include "common.name" . }} |
| 42 | template: |
| 43 | metadata: |
| 44 | labels: |
| 45 | app: {{ include "common.name" . }} |
| 46 | release: {{ include "common.release" . }} |
| 47 | name: {{ include "common.name" . }} |
| 48 | annotations: |
| 49 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 50 | {{- if .Values.global.msbEnabled }} |
| 51 | {{ $values := .Values }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 52 | msb.onap.org/service-info: '[ |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 53 | {{- range $api_endpoint := $values.aai_enpoints -}} |
| 54 | {{- range $api_version := $values.api_list }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 55 | { |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 56 | "serviceName": "_{{ $api_endpoint.name }}", |
| 57 | "version": "v{{ $api_version }}", |
| 58 | "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}", |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 59 | "protocol": "REST", |
| 60 | "port": "8447", |
| 61 | "enable_ssl": true, |
| 62 | "lb_policy":"ip_hash", |
| 63 | "visualRange": "1", |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 64 | "path": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}" |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 65 | }, |
| 66 | { |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 67 | "serviceName": "{{ $api_endpoint.name }}", |
| 68 | "version": "v{{ $api_version }}", |
| 69 | "url": "/aai/v{{ $api_version }}/{{ $api_endpoint.url }}", |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 70 | "protocol": "REST", |
| 71 | "port": "8447", |
| 72 | "enable_ssl": true, |
| 73 | "lb_policy":"ip_hash", |
| 74 | "visualRange": "1" |
| 75 | }, |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 76 | {{- end }} |
| 77 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 78 | ]' |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 79 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 80 | spec: |
| 81 | hostname: aai-resources |
M.Hosnidokht | 09523be | 2021-08-24 09:00:42 -0400 | [diff] [blame] | 82 | terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 83 | initContainers: |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 84 | - name: {{ include "common.name" . }}-readiness |
| 85 | command: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 86 | - /app/ready.py |
| 87 | args: |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 88 | {{- if .Values.global.jobs.migration.enabled }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 89 | - --job-name |
| 90 | - {{ include "common.release" . }}-aai-graphadmin-migration |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 91 | {{- else }} |
| 92 | {{- if .Values.global.jobs.createSchema.enabled }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 93 | - --job-name |
| 94 | - {{ include "common.release" . }}-aai-graphadmin-create-db-schema |
Sylvain Desbureaux | 6212bb2 | 2021-01-18 11:43:33 +0100 | [diff] [blame] | 95 | {{- else }} |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 96 | - --container-name |
| 97 | {{- if .Values.global.cassandra.localCluster }} |
| 98 | - aai-cassandra |
| 99 | {{- else }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 100 | - cassandra |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 101 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 102 | - --container-name |
| 103 | - aai-schema-service |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 104 | {{- end }} |
Sylvain Desbureaux | 6212bb2 | 2021-01-18 11:43:33 +0100 | [diff] [blame] | 105 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 106 | env: |
| 107 | - name: NAMESPACE |
| 108 | valueFrom: |
| 109 | fieldRef: |
| 110 | apiVersion: v1 |
| 111 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 112 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 113 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 114 | containers: |
| 115 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 116 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 117 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 118 | command: |
| 119 | - sh |
| 120 | args: |
| 121 | - -c |
| 122 | - | |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 123 | echo "*** actual launch of AAI Resources" |
| 124 | /bin/bash /opt/app/aai-resources/docker-entrypoint.sh |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 125 | env: |
| 126 | - name: LOCAL_USER_ID |
| 127 | value: {{ .Values.global.config.userId | quote }} |
| 128 | - name: LOCAL_GROUP_ID |
| 129 | value: {{ .Values.global.config.groupId | quote }} |
M.Hosnidokht | 09523be | 2021-08-24 09:00:42 -0400 | [diff] [blame] | 130 | - name: INTERNAL_PORT_1 |
| 131 | value: {{ .Values.service.internalPort | quote }} |
| 132 | - name: INTERNAL_PORT_2 |
| 133 | value: {{ .Values.service.internalPort2 | quote }} |
leila | 46fb580 | 2022-11-15 11:33:21 -0500 | [diff] [blame] | 134 | - name: INTERNAL_PORT_3 |
| 135 | value: {{ .Values.service.internalPort3 | quote }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 136 | volumeMounts: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 137 | - mountPath: /etc/localtime |
| 138 | name: localtime |
| 139 | readOnly: true |
| 140 | - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-realtime.properties |
| 141 | name: {{ include "common.fullname" . }}-config |
| 142 | subPath: janusgraph-realtime.properties |
| 143 | - mountPath: /opt/app/aai-resources/resources/etc/appprops/janusgraph-cached.properties |
| 144 | name: {{ include "common.fullname" . }}-config |
| 145 | subPath: janusgraph-cached.properties |
| 146 | - mountPath: /opt/app/aai-resources/resources/etc/appprops/aaiconfig.properties |
| 147 | name: {{ include "common.fullname" . }}-config |
| 148 | subPath: aaiconfig.properties |
| 149 | - mountPath: /opt/aai/logroot/AAI-RES |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 150 | name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 151 | - mountPath: /opt/app/aai-resources/resources/logback.xml |
| 152 | name: {{ include "common.fullname" . }}-config |
| 153 | subPath: logback.xml |
| 154 | - mountPath: /opt/app/aai-resources/resources/localhost-access-logback.xml |
| 155 | name: {{ include "common.fullname" . }}-config |
| 156 | subPath: localhost-access-logback.xml |
| 157 | - mountPath: /opt/app/aai-resources/resources/etc/auth/realm.properties |
| 158 | name: {{ include "common.fullname" . }}-config |
| 159 | subPath: realm.properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 160 | - mountPath: /opt/app/aai-resources/resources/application.properties |
| 161 | name: {{ include "common.fullname" . }}-config |
| 162 | subPath: application.properties |
| 163 | - mountPath: /opt/app/aai-resources/resources/application-keycloak.properties |
| 164 | name: {{ include "common.fullname" . }}-config |
| 165 | subPath: application-keycloak.properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 166 | ports: |
| 167 | - containerPort: {{ .Values.service.internalPort }} |
| 168 | - containerPort: {{ .Values.service.internalPort2 }} |
leila | 46fb580 | 2022-11-15 11:33:21 -0500 | [diff] [blame] | 169 | - containerPort: {{ .Values.service.internalPort3 }} |
M.Hosnidokht | 09523be | 2021-08-24 09:00:42 -0400 | [diff] [blame] | 170 | lifecycle: |
| 171 | # wait for active requests (long-running tasks) to be finished |
| 172 | # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod. |
| 173 | preStop: |
| 174 | exec: |
| 175 | command: |
| 176 | - sh |
| 177 | - -c |
| 178 | - | |
| 179 | while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2) |
| 180 | do sleep 10 |
| 181 | done |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 182 | # disable liveness probe when breakpoints set in debugger |
| 183 | # so K8s doesn't restart unresponsive container |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 184 | {{- if .Values.liveness.enabled }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 185 | livenessProbe: |
Rommel Pawar | c8845ef | 2022-09-22 14:04:14 -0700 | [diff] [blame] | 186 | httpGet: |
| 187 | path: /aai/util/echo?action=checkDB |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 188 | port: {{ .Values.service.internalPort }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 189 | scheme: HTTP |
Rommel Pawar | c8845ef | 2022-09-22 14:04:14 -0700 | [diff] [blame] | 190 | httpHeaders: |
| 191 | - name: X-FromAppId |
| 192 | value: LivenessCheck |
| 193 | - name: X-TransactionId |
| 194 | value: LiveCheck_TID |
| 195 | - name: Accept |
| 196 | value: application/json |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 197 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 198 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 199 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 200 | readinessProbe: |
Rommel Pawar | c8845ef | 2022-09-22 14:04:14 -0700 | [diff] [blame] | 201 | httpGet: |
| 202 | path: /aai/util/echo?action=checkDB |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 203 | port: {{ .Values.service.internalPort }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 204 | scheme: HTTP |
Rommel Pawar | c8845ef | 2022-09-22 14:04:14 -0700 | [diff] [blame] | 205 | httpHeaders: |
| 206 | - name: X-FromAppId |
| 207 | value: ReadinessCheck |
| 208 | - name: X-TransactionId |
| 209 | value: ReadinessCheck_TID |
| 210 | - name: Accept |
| 211 | value: application/json |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 212 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 213 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 214 | resources: {{ include "common.resources" . | nindent 10 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 215 | {{- if .Values.nodeSelector }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 216 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 217 | {{- end }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 218 | {{- if .Values.affinity }} |
| 219 | affinity: {{ toYaml .Values.affinity | nindent 8 }} |
| 220 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 221 | # side car containers |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 222 | {{ include "common.log.sidecar" . | nindent 6 }} |
farida azmy | d893733 | 2021-03-09 12:20:42 +0200 | [diff] [blame] | 223 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 224 | volumes: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 225 | - name: localtime |
| 226 | hostPath: |
| 227 | path: /etc/localtime |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 228 | - name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 229 | emptyDir: {} |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 230 | {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 231 | - name: {{ include "common.fullname" . }}-config |
| 232 | configMap: |
Sylvain Desbureaux | b4e038d | 2020-12-15 12:00:26 +0100 | [diff] [blame] | 233 | name: {{ include "common.fullname" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 234 | restartPolicy: {{ .Values.restartPolicy }} |
| 235 | imagePullSecrets: |
| 236 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |