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 |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 4 | # Modifications Copyright (c) 2020 Nokia, Orange |
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 | 15fea93 | 2021-08-25 09:08:40 -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": "8446", |
| 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": "8446", |
| 72 | "enable_ssl": true, |
| 73 | "lb_policy":"ip_hash", |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 74 | "visualRange": "1" |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 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 | { |
| 79 | "serviceName": "_aai-named-query", |
| 80 | "url": "/aai/search", |
| 81 | "protocol": "REST", |
| 82 | "port": "8446", |
| 83 | "enable_ssl": true, |
| 84 | "lb_policy":"ip_hash", |
| 85 | "visualRange": "1", |
| 86 | "path": "/aai/search" |
| 87 | }, |
| 88 | { |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 89 | "serviceName": "aai-named-query", |
| 90 | "url": "/aai/search", |
| 91 | "protocol": "REST", |
| 92 | "port": "8446", |
| 93 | "enable_ssl": true, |
| 94 | "lb_policy":"ip_hash", |
| 95 | "visualRange": "1" |
| 96 | } |
| 97 | ]' |
Sylvain Desbureaux | 331f004 | 2021-01-18 11:38:49 +0100 | [diff] [blame] | 98 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 99 | spec: |
| 100 | hostname: aai-traversal |
M.Hosnidokht | 15fea93 | 2021-08-25 09:08:40 -0400 | [diff] [blame] | 101 | terminationGracePeriodSeconds: {{ .Values.service.terminationGracePeriodSeconds }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 102 | initContainers: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 103 | - command: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 104 | - /app/ready.py |
| 105 | args: |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 106 | {{- if .Values.global.jobs.migration.enabled }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 107 | - --job-name |
| 108 | - {{ include "common.release" . }}-aai-graphadmin-migration |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 109 | {{- else }} |
| 110 | {{- if .Values.global.jobs.createSchema.enabled }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 111 | - --job-name |
| 112 | - {{ include "common.release" . }}-aai-graphadmin-create-db-schema |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 113 | {{- else }} |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 114 | - --container-name |
| 115 | {{- if .Values.global.cassandra.localCluster }} |
| 116 | - aai-cassandra |
| 117 | {{- else }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 118 | - cassandra |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 119 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 120 | - --container-name |
| 121 | - aai-schema-service |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 122 | {{- end }} |
| 123 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 124 | env: |
| 125 | - name: NAMESPACE |
| 126 | valueFrom: |
| 127 | fieldRef: |
| 128 | apiVersion: v1 |
| 129 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 130 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 131 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 132 | name: {{ include "common.name" . }}-readiness |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 133 | containers: |
| 134 | - name: {{ include "common.name" . }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 135 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 136 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 137 | command: |
| 138 | - sh |
| 139 | args: |
| 140 | - -c |
| 141 | - | |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 142 | echo "*** actual launch of AAI Resources" |
| 143 | /bin/bash /opt/app/aai-traversal/docker-entrypoint.sh |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 144 | env: |
| 145 | - name: DISABLE_UPDATE_QUERY |
| 146 | value: {{ .Values.config.disableUpdateQuery | quote }} |
| 147 | - name: LOCAL_USER_ID |
| 148 | value: {{ .Values.global.config.userId | quote }} |
| 149 | - name: LOCAL_GROUP_ID |
| 150 | value: {{ .Values.global.config.groupId | quote }} |
M.Hosnidokht | 15fea93 | 2021-08-25 09:08:40 -0400 | [diff] [blame] | 151 | - name: INTERNAL_PORT_1 |
| 152 | value: {{ .Values.service.internalPort | quote }} |
| 153 | - name: INTERNAL_PORT_2 |
| 154 | value: {{ .Values.service.internalPort2 | quote }} |
leila | 46fb580 | 2022-11-15 11:33:21 -0500 | [diff] [blame] | 155 | - name: INTERNAL_PORT_3 |
| 156 | value: {{ .Values.service.internalPort3 | quote }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 157 | volumeMounts: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 158 | - mountPath: /etc/localtime |
| 159 | name: localtime |
| 160 | readOnly: true |
| 161 | - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-realtime.properties |
| 162 | name: {{ include "common.fullname" . }}-config |
| 163 | subPath: janusgraph-realtime.properties |
| 164 | - mountPath: /opt/app/aai-traversal/resources/etc/appprops/janusgraph-cached.properties |
| 165 | name: {{ include "common.fullname" . }}-config |
| 166 | subPath: janusgraph-cached.properties |
| 167 | - mountPath: /opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties |
| 168 | name: {{ include "common.fullname" . }}-config |
| 169 | subPath: aaiconfig.properties |
| 170 | - mountPath: /opt/aai/logroot/AAI-GQ |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 171 | name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 172 | - mountPath: /opt/aai/logroot/AAI-GQ/misc |
| 173 | name: {{ include "common.fullname" . }}-logs-misc |
| 174 | - mountPath: /opt/app/aai-traversal/resources/logback.xml |
| 175 | name: {{ include "common.fullname" . }}-config |
| 176 | subPath: logback.xml |
| 177 | - mountPath: /opt/app/aai-traversal/resources/localhost-access-logback.xml |
| 178 | name: {{ include "common.fullname" . }}-config |
| 179 | subPath: localhost-access-logback.xml |
| 180 | - mountPath: /opt/app/aai-traversal/resources/etc/auth/realm.properties |
| 181 | name: {{ include "common.fullname" . }}-config |
| 182 | subPath: realm.properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 183 | - mountPath: /opt/app/aai-traversal/resources/application.properties |
| 184 | name: {{ include "common.fullname" . }}-config |
| 185 | subPath: application.properties |
Sam Huang | 56a6dd4 | 2021-03-26 13:27:17 -0600 | [diff] [blame] | 186 | - mountPath: /opt/app/aai-traversal/resources/application-keycloak.properties |
| 187 | name: {{ include "common.fullname" . }}-config |
| 188 | subPath: application-keycloak.properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 189 | ports: |
| 190 | - containerPort: {{ .Values.service.internalPort }} |
| 191 | - containerPort: {{ .Values.service.internalPort2 }} |
leila | 46fb580 | 2022-11-15 11:33:21 -0500 | [diff] [blame] | 192 | - containerPort: {{ .Values.service.internalPort3 }} |
M.Hosnidokht | 15fea93 | 2021-08-25 09:08:40 -0400 | [diff] [blame] | 193 | lifecycle: |
| 194 | # wait for active requests (long-running tasks) to be finished |
| 195 | # Before the SIGTERM is invoked, Kubernetes exposes a preStop hook in the Pod. |
| 196 | preStop: |
| 197 | exec: |
| 198 | command: |
| 199 | - sh |
| 200 | - -c |
| 201 | - | |
| 202 | while (netstat -an | grep ESTABLISHED | grep -e $INTERNAL_PORT_1 -e $INTERNAL_PORT_2) |
| 203 | do sleep 10 |
| 204 | done |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 205 | # disable liveness probe when breakpoints set in debugger |
| 206 | # so K8s doesn't restart unresponsive container |
| 207 | {{ if .Values.liveness.enabled }} |
| 208 | livenessProbe: |
Fiete Ostkamp | c113ef3 | 2022-10-12 09:50:46 +0200 | [diff] [blame] | 209 | httpGet: |
| 210 | path: /aai/util/echo?action=checkDB |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 211 | port: {{ .Values.service.internalPort }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 212 | scheme: HTTP |
Fiete Ostkamp | c113ef3 | 2022-10-12 09:50:46 +0200 | [diff] [blame] | 213 | httpHeaders: |
| 214 | - name: X-FromAppId |
| 215 | value: LivenessCheck |
| 216 | - name: X-TransactionId |
| 217 | value: LiveCheck_TID |
| 218 | - name: Accept |
| 219 | value: application/json |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 220 | initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }} |
| 221 | periodSeconds: {{ .Values.liveness.periodSeconds }} |
| 222 | {{ end }} |
| 223 | readinessProbe: |
Fiete Ostkamp | c113ef3 | 2022-10-12 09:50:46 +0200 | [diff] [blame] | 224 | httpGet: |
| 225 | path: /aai/util/echo?action=checkDB |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 226 | port: {{ .Values.service.internalPort }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 227 | scheme: HTTP |
Fiete Ostkamp | c113ef3 | 2022-10-12 09:50:46 +0200 | [diff] [blame] | 228 | httpHeaders: |
| 229 | - name: X-FromAppId |
| 230 | value: ReadinessCheck |
| 231 | - name: X-TransactionId |
| 232 | value: ReadinessCheck_TID |
| 233 | - name: Accept |
| 234 | value: application/json |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 235 | initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }} |
| 236 | periodSeconds: {{ .Values.readiness.periodSeconds }} |
miroslavmasaryk | a7ac7f0 | 2023-03-01 14:12:26 +0100 | [diff] [blame] | 237 | resources: {{ include "common.resources" . | nindent 10 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 238 | {{- if .Values.nodeSelector }} |
| 239 | nodeSelector: |
| 240 | {{ toYaml .Values.nodeSelector | indent 8 }} |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 241 | {{- end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 242 | {{- if .Values.affinity }} |
| 243 | affinity: |
| 244 | {{ toYaml .Values.affinity | indent 8 }} |
| 245 | {{- end }} |
| 246 | |
| 247 | # side car containers |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 248 | {{ include "common.log.sidecar" . | nindent 6 }} |
farida azmy | d893733 | 2021-03-09 12:20:42 +0200 | [diff] [blame] | 249 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame^] | 250 | volumes: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 251 | - name: localtime |
| 252 | hostPath: |
| 253 | path: /etc/localtime |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 254 | - name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 255 | emptyDir: {} |
| 256 | - name: {{ include "common.fullname" . }}-logs-misc |
| 257 | emptyDir: {} |
Maciej Wereski | d523d12 | 2021-09-21 11:22:13 +0200 | [diff] [blame] | 258 | {{ include "common.log.volumes" (dict "dot" . "configMapNamePrefix" (tpl .Values.logConfigMapNamePrefix .)) | nindent 6 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 259 | - name: {{ include "common.fullname" . }}-config |
| 260 | configMap: |
Sylvain Desbureaux | a41dfc0 | 2021-02-15 10:14:22 +0100 | [diff] [blame] | 261 | name: {{ include "common.fullname" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 262 | restartPolicy: {{ .Values.global.restartPolicy | default .Values.restartPolicy }} |
| 263 | imagePullSecrets: |
| 264 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |