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========================================================= |
| 22 | |
| 23 | # In ONAP, the following job will always be run on each installation |
| 24 | # The following job will go through the latest oxm and |
| 25 | # create properties based on the data type defined in the oxm |
| 26 | # and create the required indexes for the appropriate properties |
| 27 | # This can be run multiple times as the code if the index or property already exists |
| 28 | # then the index or property won't be created again |
| 29 | # NOTE - During the execution of the createSchema job, there should |
| 30 | # be no other janusgraph connection to the graph as its the reason |
| 31 | # that resources traversal and graphadmin wait until this job is done |
| 32 | # If you are using an existing cassandra cluster not coming from oom |
| 33 | # then it is your job to ensure that there are no connections to the database |
Sylvain Desbureaux | 47eb4d2 | 2020-12-10 12:15:27 +0100 | [diff] [blame] | 34 | */}} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 35 | |
| 36 | {{- if .Values.global.jobs.migration.enabled }} |
| 37 | --- |
| 38 | apiVersion: batch/v1 |
| 39 | kind: Job |
| 40 | metadata: |
| 41 | name: {{ include "common.fullname" . }}-migration |
| 42 | namespace: {{ include "common.namespace" . }} |
| 43 | labels: |
| 44 | app: {{ include "common.name" . }}-job |
| 45 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 46 | release: {{ include "common.release" . }} |
| 47 | heritage: {{ .Release.Service }} |
| 48 | annotations: |
| 49 | "helm.sh/hook": post-upgrade,post-rollback,post-install |
| 50 | "helm.sh/hook-weight": "1" |
| 51 | "helm.sh/hook-delete-policy": before-hook-creation |
| 52 | spec: |
| 53 | backoffLimit: 20 |
| 54 | template: |
| 55 | metadata: |
| 56 | labels: |
| 57 | app: {{ include "common.name" . }}-job |
| 58 | release: {{ include "common.release" . }} |
| 59 | name: {{ include "common.name" . }} |
| 60 | spec: |
| 61 | initContainers: |
| 62 | - command: |
| 63 | - /app/ready.py |
| 64 | args: |
| 65 | - --container-name |
| 66 | {{- if .Values.global.cassandra.localCluster }} |
| 67 | - aai-cassandra |
| 68 | {{- else }} |
| 69 | - cassandra |
| 70 | {{- end }} |
| 71 | - --container-name |
| 72 | - aai-schema-service |
| 73 | env: |
| 74 | - name: NAMESPACE |
| 75 | valueFrom: |
| 76 | fieldRef: |
| 77 | apiVersion: v1 |
| 78 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 79 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 80 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 81 | name: {{ include "common.name" . }}-readiness |
| 82 | - command: |
| 83 | - /bin/bash |
| 84 | - -c |
| 85 | - bash docker-entrypoint.sh dataRestoreFromSnapshot.sh `ls -t /opt/app/aai-graphadmin/logs/data/dataSnapshots|head -1|awk -F".P" '{ print $1 }'` |
| 86 | env: |
| 87 | - name: LOCAL_USER_ID |
| 88 | value: {{ .Values.global.config.userId | quote }} |
| 89 | - name: LOCAL_GROUP_ID |
| 90 | value: {{ .Values.global.config.groupId | quote }} |
| 91 | volumeMounts: |
| 92 | - mountPath: /etc/localtime |
| 93 | name: localtime |
| 94 | readOnly: true |
| 95 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
| 96 | name: {{ include "common.fullname" . }}-config |
| 97 | subPath: janusgraph-realtime.properties |
| 98 | - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots |
| 99 | name: {{ include "common.fullname" . }}-snapshots |
| 100 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
| 101 | name: {{ include "common.fullname" . }}-config |
| 102 | subPath: janusgraph-cached.properties |
| 103 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
| 104 | name: {{ include "common.fullname" . }}-config |
| 105 | subPath: aaiconfig.properties |
| 106 | - mountPath: /opt/aai/logroot/AAI-GA |
| 107 | name: {{ include "common.fullname" . }}-logs |
| 108 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
| 109 | name: {{ include "common.fullname" . }}-config |
| 110 | subPath: logback.xml |
| 111 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
| 112 | name: {{ include "common.fullname" . }}-config |
| 113 | subPath: localhost-access-logback.xml |
| 114 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
| 115 | name: {{ include "common.fullname" . }}-config |
| 116 | subPath: application.properties |
| 117 | {{ $global := . }} |
| 118 | {{ range $job := .Values.global.config.auth.files }} |
| 119 | - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }} |
| 120 | name: {{ include "common.fullname" $global }}-auth-truststore-sec |
| 121 | subPath: {{ . }} |
| 122 | {{ end }} |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 123 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 124 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 125 | name: {{ include "common.name" . }}-restore-backup |
| 126 | containers: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 127 | - image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 128 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 129 | name: {{ include "common.name" . }}-perform-migration |
| 130 | command: |
| 131 | - /bin/bash |
| 132 | - -c |
osk11461 | 27fd7d8 | 2021-06-18 00:51:17 +0200 | [diff] [blame] | 133 | - | |
| 134 | bash docker-entrypoint.sh run_Migrations.sh -e UpdateAaiUriIndexMigration --commit --skipPreMigrationSnapShot --runDisabled RebuildAllEdges ; |
| 135 | {{- include "common.serviceMesh.killSidecar" . | indent 11 | trim }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 136 | env: |
| 137 | - name: LOCAL_USER_ID |
| 138 | value: {{ .Values.global.config.userId | quote }} |
| 139 | - name: LOCAL_GROUP_ID |
| 140 | value: {{ .Values.global.config.groupId | quote }} |
| 141 | volumeMounts: |
| 142 | - mountPath: /etc/localtime |
| 143 | name: localtime |
| 144 | readOnly: true |
| 145 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
| 146 | name: {{ include "common.fullname" . }}-config |
| 147 | subPath: janusgraph-realtime.properties |
| 148 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
| 149 | name: {{ include "common.fullname" . }}-config |
| 150 | subPath: janusgraph-cached.properties |
| 151 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
| 152 | name: {{ include "common.fullname" . }}-config |
| 153 | subPath: aaiconfig.properties |
| 154 | - mountPath: /opt/aai/logroot/AAI-GA |
| 155 | name: {{ include "common.fullname" . }}-logs |
| 156 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
| 157 | name: {{ include "common.fullname" . }}-config |
| 158 | subPath: logback.xml |
| 159 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
| 160 | name: {{ include "common.fullname" . }}-config |
| 161 | subPath: localhost-access-logback.xml |
| 162 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
| 163 | name: {{ include "common.fullname" . }}-config |
| 164 | subPath: application.properties |
| 165 | {{ $global := . }} |
| 166 | {{ range $job := .Values.global.config.auth.files }} |
| 167 | - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }} |
| 168 | name: {{ include "common.fullname" $global }}-auth-truststore-sec |
| 169 | subPath: {{ . }} |
| 170 | {{ end }} |
| 171 | resources: |
| 172 | {{ include "common.resources" . }} |
| 173 | {{- if .Values.nodeSelector }} |
| 174 | nodeSelector: |
| 175 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 176 | {{- end -}} |
| 177 | {{- if .Values.affinity }} |
| 178 | affinity: |
| 179 | {{ toYaml .Values.affinity | indent 8 }} |
| 180 | {{- end }} |
| 181 | volumes: |
| 182 | - name: localtime |
| 183 | hostPath: |
| 184 | path: /etc/localtime |
| 185 | - name: filebeat-conf |
| 186 | configMap: |
| 187 | name: aai-filebeat |
| 188 | - name: {{ include "common.fullname" . }}-logs |
| 189 | emptyDir: {} |
| 190 | - name: {{ include "common.fullname" . }}-config |
| 191 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 192 | name: {{ include "common.fullname" . }}-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 193 | - name: {{ include "common.fullname" . }}-snapshots |
| 194 | persistentVolumeClaim: |
| 195 | claimName: {{ include "common.fullname" . }}-migration |
| 196 | - name: {{ include "common.fullname" . }}-auth-truststore-sec |
| 197 | secret: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 198 | secretName: aai-common-truststore |
| 199 | items: |
| 200 | {{ range $job := .Values.global.config.auth.files }} |
| 201 | - key: {{ . }} |
| 202 | path: {{ . }} |
| 203 | {{ end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 204 | restartPolicy: Never |
| 205 | imagePullSecrets: |
| 206 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 207 | --- |
| 208 | apiVersion: batch/v1 |
| 209 | kind: Job |
| 210 | metadata: |
| 211 | name: {{ include "common.fullname" . }}-db-backup-job |
| 212 | namespace: {{ include "common.namespace" . }} |
| 213 | labels: |
| 214 | app: {{ include "common.name" . }}-db-backup-job |
| 215 | release: {{ include "common.release" . }} |
| 216 | heritage: {{ .Release.Service }} |
| 217 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 218 | annotations: |
| 219 | "helm.sh/hook": pre-upgrade,pre-install |
| 220 | "helm.sh/hook-weight": "2" |
| 221 | "helm.sh/hook-delete-policy": before-hook-creation |
| 222 | spec: |
| 223 | backoffLimit: 20 |
| 224 | template: |
| 225 | metadata: |
| 226 | labels: |
| 227 | app: {{ include "common.name" . }}-db-backup-job |
| 228 | release: {{ include "common.release" . }} |
| 229 | name: {{ include "common.name" . }} |
| 230 | spec: |
| 231 | {{ if eq .Values.global.jobs.migration.remoteCassandra.enabled false }} |
| 232 | initContainers: |
| 233 | - command: |
| 234 | - /bin/bash |
| 235 | - -c |
| 236 | - /app/ready.py --container-name aai-cassandra --timeout 1 || /app/ready.py --container-name cassandra |
| 237 | env: |
| 238 | - name: NAMESPACE |
| 239 | valueFrom: |
| 240 | fieldRef: |
| 241 | apiVersion: v1 |
| 242 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 243 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 244 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 245 | name: {{ include "common.name" . }}-db-backup-readiness |
| 246 | {{- end }} |
| 247 | containers: |
| 248 | - name: {{ include "common.name" . }}-db-backup-job |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 249 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 250 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 251 | command: |
| 252 | - /bin/bash |
osk11461 | 27fd7d8 | 2021-06-18 00:51:17 +0200 | [diff] [blame] | 253 | - -c |
| 254 | - | |
| 255 | bash docker-entrypoint.sh dataSnapshot.sh ; |
| 256 | {{- include "common.serviceMesh.killSidecar" . | indent 11 | trim }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 257 | env: |
| 258 | - name: LOCAL_USER_ID |
| 259 | value: {{ .Values.global.config.userId | quote }} |
| 260 | - name: LOCAL_GROUP_ID |
| 261 | value: {{ .Values.global.config.groupId | quote }} |
| 262 | volumeMounts: |
| 263 | - mountPath: /etc/localtime |
| 264 | name: localtime |
| 265 | readOnly: true |
| 266 | - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots |
| 267 | name: {{ include "common.fullname" . }}-snapshots |
| 268 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
| 269 | name: {{ include "common.fullname" . }}-migration |
| 270 | subPath: janusgraph-migration-real.properties |
| 271 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
| 272 | name: {{ include "common.fullname" . }}-migration |
| 273 | subPath: janusgraph-migration-cached.properties |
| 274 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
| 275 | name: {{ include "common.fullname" . }}-config |
| 276 | subPath: aaiconfig.properties |
| 277 | - mountPath: /opt/aai/logroot/AAI-RES/ |
| 278 | name: {{ include "common.fullname" . }}-logs |
| 279 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
| 280 | name: {{ include "common.fullname" . }}-config |
| 281 | subPath: logback.xml |
| 282 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
| 283 | name: {{ include "common.fullname" . }}-config |
| 284 | subPath: localhost-access-logback.xml |
| 285 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
| 286 | name: {{ include "common.fullname" . }}-config |
| 287 | subPath: application.properties |
| 288 | resources: |
| 289 | {{ include "common.resources" . | indent 10 }} |
| 290 | {{- if .Values.nodeSelector }} |
| 291 | nodeSelector: |
| 292 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 293 | {{- end -}} |
| 294 | {{- if .Values.affinity }} |
| 295 | affinity: |
| 296 | {{ toYaml .Values.affinity | indent 8 }} |
| 297 | {{- end }} |
| 298 | volumes: |
| 299 | - name: localtime |
| 300 | hostPath: |
| 301 | path: /etc/localtime |
| 302 | - name: {{ include "common.fullname" . }}-logs |
| 303 | emptyDir: {} |
| 304 | - name: {{ include "common.fullname" . }}-config |
| 305 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 306 | name: {{ include "common.fullname" . }}-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 307 | - name: {{ include "common.fullname" . }}-migration |
| 308 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 309 | name: {{ include "common.fullname" . }}-migration-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 310 | - name: {{ include "common.fullname" . }}-snapshots |
| 311 | persistentVolumeClaim: |
| 312 | claimName: {{ include "common.fullname" . }}-migration |
| 313 | restartPolicy: Never |
| 314 | imagePullSecrets: |
| 315 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 316 | {{ end }} |