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========================================================= |
| 23 | |
| 24 | # In ONAP, the following job will always be run on each installation |
| 25 | # The following job will go through the latest oxm and |
| 26 | # create properties based on the data type defined in the oxm |
| 27 | # and create the required indexes for the appropriate properties |
| 28 | # This can be run multiple times as the code if the index or property already exists |
| 29 | # then the index or property won't be created again |
| 30 | # NOTE - During the execution of the createSchema job, there should |
| 31 | # be no other janusgraph connection to the graph as its the reason |
| 32 | # that resources traversal and graphadmin wait until this job is done |
| 33 | # If you are using an existing cassandra cluster not coming from oom |
| 34 | # 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] | 35 | */}} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 36 | |
| 37 | {{- if .Values.global.jobs.migration.enabled }} |
| 38 | --- |
| 39 | apiVersion: batch/v1 |
| 40 | kind: Job |
| 41 | metadata: |
| 42 | name: {{ include "common.fullname" . }}-db-backup |
| 43 | namespace: {{ include "common.namespace" . }} |
| 44 | labels: |
| 45 | app: {{ include "common.name" . }}-job |
| 46 | release: {{ include "common.release" . }} |
| 47 | heritage: {{ .Release.Service }} |
| 48 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 49 | annotations: |
| 50 | "helm.sh/hook": pre-upgrade,pre-install |
| 51 | "helm.sh/hook-weight": "2" |
| 52 | "helm.sh/hook-delete-policy": before-hook-creation |
| 53 | spec: |
| 54 | backoffLimit: 20 |
| 55 | template: |
| 56 | metadata: |
| 57 | labels: |
| 58 | app: {{ include "common.name" . }}-job |
| 59 | release: {{ include "common.release" . }} |
| 60 | name: {{ include "common.name" . }} |
| 61 | spec: |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame] | 62 | initContainers: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 63 | {{ if eq .Values.global.jobs.migration.remoteCassandra.enabled false }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 64 | - command: |
| 65 | - /bin/bash |
| 66 | - -c |
Andreas Geissler | cfd8434 | 2023-08-16 17:18:49 +0200 | [diff] [blame] | 67 | - /app/ready.py --app-name aai-cassandra --timeout 1 || /app/ready.py --app-name cassandra |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 68 | env: |
| 69 | - name: NAMESPACE |
| 70 | valueFrom: |
| 71 | fieldRef: |
| 72 | apiVersion: v1 |
| 73 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 74 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 75 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 76 | name: {{ include "common.name" . }}-db-backup-readiness |
Andreas Geissler | 4753743 | 2024-02-27 08:55:23 +0100 | [diff] [blame] | 77 | resources: |
| 78 | limits: |
| 79 | cpu: "100m" |
| 80 | memory: "0.5Gi" |
| 81 | requests: |
| 82 | cpu: "3m" |
| 83 | memory: "0.02Gi" |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 84 | {{- end }} |
| 85 | containers: |
| 86 | - name: {{ include "common.name" . }}-db-backup-job |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 87 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 88 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 89 | command: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 90 | - sh |
| 91 | args: |
osk11461 | 27fd7d8 | 2021-06-18 00:51:17 +0200 | [diff] [blame] | 92 | - -c |
| 93 | - | |
Andreas Geissler | 8624d22 | 2022-05-13 17:16:41 +0200 | [diff] [blame] | 94 | {{- if include "common.onServiceMesh" . }} |
| 95 | echo "waiting 15s for istio side cars to be up"; sleep 15s;{{- end }} |
| 96 | bash docker-entrypoint.sh dataSnapshot.sh; |
othman touijer | 5117667 | 2021-12-01 16:21:18 +0100 | [diff] [blame] | 97 | {{ include "common.serviceMesh.killSidecar" . | indent 11 | trim }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 98 | env: |
| 99 | - name: LOCAL_USER_ID |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 100 | value: {{ .Values.securityContext.user_id | quote }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 101 | - name: LOCAL_GROUP_ID |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 102 | value: {{ .Values.securityContext.group_id | quote }} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame] | 103 | volumeMounts: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 104 | - mountPath: /etc/localtime |
| 105 | name: localtime |
| 106 | readOnly: true |
| 107 | - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 108 | name: snapshots |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 109 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 110 | name: migration |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 111 | subPath: janusgraph-migration-real.properties |
| 112 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 113 | name: migration |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 114 | subPath: janusgraph-migration-cached.properties |
| 115 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 116 | name: properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 117 | subPath: aaiconfig.properties |
| 118 | - mountPath: /opt/aai/logroot/AAI-RES/ |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 119 | name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 120 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 121 | name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 122 | subPath: logback.xml |
| 123 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 124 | name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 125 | subPath: localhost-access-logback.xml |
| 126 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 127 | name: properties |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 128 | subPath: application.properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 129 | resources: {{ include "common.resources" . | nindent 10 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 130 | {{- if .Values.nodeSelector }} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 131 | nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 132 | {{- end }} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 133 | {{- if .Values.affinity }} |
| 134 | affinity: {{ toYaml .Values.affinity | nindent 8 }} |
| 135 | {{- end }} |
Andreas Geissler | ceac260 | 2023-07-17 18:55:54 +0200 | [diff] [blame] | 136 | serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}} |
efiacor | d12c167 | 2023-03-23 12:10:50 +0000 | [diff] [blame] | 137 | volumes: |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 138 | - name: localtime |
| 139 | hostPath: |
| 140 | path: /etc/localtime |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 141 | - name: logs |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 142 | emptyDir: {} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 143 | - name: config |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 144 | configMap: |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 145 | name: {{ include "common.fullname" . }} |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 146 | - name: properties |
othman touijer | 5117667 | 2021-12-01 16:21:18 +0100 | [diff] [blame] | 147 | configMap: |
| 148 | name: {{ include "common.fullname" . }}-properties |
Sylvain Desbureaux | c57b58d | 2021-02-23 18:07:34 +0100 | [diff] [blame] | 149 | - name: migration |
| 150 | configMap: |
| 151 | name: {{ include "common.fullname" . }}-migration |
| 152 | - name: snapshots |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 153 | persistentVolumeClaim: |
| 154 | claimName: {{ include "common.fullname" . }}-migration |
| 155 | restartPolicy: Never |
| 156 | imagePullSecrets: |
| 157 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 158 | {{ end }} |