Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 1 | # |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # org.onap.aai |
| 4 | # ================================================================================ |
| 5 | # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. |
| 6 | # Copyright (c) 2020 Nokia Intellectual Property. All rights reserved. |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 7 | # Copyright (c) 2020 Orange Intellectual Property. All rights reserved. |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 8 | # ================================================================================ |
| 9 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | # you may not use this file except in compliance with the License. |
| 11 | # You may obtain a copy of the License at |
| 12 | # |
| 13 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 14 | # |
| 15 | # Unless required by applicable law or agreed to in writing, software |
| 16 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | # See the License for the specific language governing permissions and |
| 19 | # limitations under the License. |
| 20 | # ============LICENSE_END========================================================= |
| 21 | |
| 22 | # In ONAP, the following job will always be run on each installation |
| 23 | # The following job will go through the latest oxm and |
| 24 | # create properties based on the data type defined in the oxm |
| 25 | # and create the required indexes for the appropriate properties |
| 26 | # This can be run multiple times as the code if the index or property already exists |
| 27 | # then the index or property won't be created again |
| 28 | # NOTE - During the execution of the createSchema job, there should |
| 29 | # be no other janusgraph connection to the graph as its the reason |
| 30 | # that resources traversal and graphadmin wait until this job is done |
| 31 | # If you are using an existing cassandra cluster not coming from oom |
| 32 | # then it is your job to ensure that there are no connections to the database |
| 33 | |
| 34 | {{- if .Values.global.jobs.migration.enabled }} |
| 35 | --- |
| 36 | apiVersion: batch/v1 |
| 37 | kind: Job |
| 38 | metadata: |
| 39 | name: {{ include "common.fullname" . }}-db-backup |
| 40 | namespace: {{ include "common.namespace" . }} |
| 41 | labels: |
| 42 | app: {{ include "common.name" . }}-job |
| 43 | release: {{ include "common.release" . }} |
| 44 | heritage: {{ .Release.Service }} |
| 45 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 46 | annotations: |
| 47 | "helm.sh/hook": pre-upgrade,pre-install |
| 48 | "helm.sh/hook-weight": "2" |
| 49 | "helm.sh/hook-delete-policy": before-hook-creation |
| 50 | spec: |
| 51 | backoffLimit: 20 |
| 52 | template: |
| 53 | metadata: |
| 54 | labels: |
| 55 | app: {{ include "common.name" . }}-job |
| 56 | release: {{ include "common.release" . }} |
| 57 | name: {{ include "common.name" . }} |
| 58 | spec: |
| 59 | {{ if eq .Values.global.jobs.migration.remoteCassandra.enabled false }} |
| 60 | initContainers: |
| 61 | - command: |
| 62 | - /bin/bash |
| 63 | - -c |
| 64 | - /app/ready.py --container-name aai-cassandra --timeout 1 || /app/ready.py --container-name cassandra |
| 65 | env: |
| 66 | - name: NAMESPACE |
| 67 | valueFrom: |
| 68 | fieldRef: |
| 69 | apiVersion: v1 |
| 70 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 71 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 72 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 73 | name: {{ include "common.name" . }}-db-backup-readiness |
| 74 | {{- end }} |
| 75 | containers: |
| 76 | - name: {{ include "common.name" . }}-db-backup-job |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 77 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 78 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 79 | command: |
| 80 | - /bin/bash |
| 81 | - docker-entrypoint.sh |
| 82 | - dataSnapshot.sh |
| 83 | env: |
| 84 | - name: LOCAL_USER_ID |
| 85 | value: {{ .Values.global.config.userId | quote }} |
| 86 | - name: LOCAL_GROUP_ID |
| 87 | value: {{ .Values.global.config.groupId | quote }} |
| 88 | volumeMounts: |
| 89 | - mountPath: /etc/localtime |
| 90 | name: localtime |
| 91 | readOnly: true |
| 92 | - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots |
| 93 | name: {{ include "common.fullname" . }}-snapshots |
| 94 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
| 95 | name: {{ include "common.fullname" . }}-migration |
| 96 | subPath: janusgraph-migration-real.properties |
| 97 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
| 98 | name: {{ include "common.fullname" . }}-migration |
| 99 | subPath: janusgraph-migration-cached.properties |
| 100 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
| 101 | name: {{ include "common.fullname" . }}-config |
| 102 | subPath: aaiconfig.properties |
| 103 | - mountPath: /opt/aai/logroot/AAI-RES/ |
| 104 | name: {{ include "common.fullname" . }}-logs |
| 105 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
| 106 | name: {{ include "common.fullname" . }}-config |
| 107 | subPath: logback.xml |
| 108 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
| 109 | name: {{ include "common.fullname" . }}-config |
| 110 | subPath: localhost-access-logback.xml |
| 111 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
| 112 | name: {{ include "common.fullname" . }}-config |
| 113 | subPath: application.properties |
| 114 | resources: |
| 115 | {{ include "common.resources" . | indent 10 }} |
| 116 | {{- if .Values.nodeSelector }} |
| 117 | nodeSelector: |
| 118 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 119 | {{- end -}} |
| 120 | {{- if .Values.affinity }} |
| 121 | affinity: |
| 122 | {{ toYaml .Values.affinity | indent 8 }} |
| 123 | {{- end }} |
| 124 | volumes: |
| 125 | - name: localtime |
| 126 | hostPath: |
| 127 | path: /etc/localtime |
| 128 | - name: {{ include "common.fullname" . }}-logs |
| 129 | emptyDir: {} |
| 130 | - name: {{ include "common.fullname" . }}-config |
| 131 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 132 | name: {{ include "common.fullname" . }}-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 133 | - name: {{ include "common.fullname" . }}-migration |
| 134 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 135 | name: {{ include "common.fullname" . }}-migration-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 136 | - name: {{ include "common.fullname" . }}-snapshots |
| 137 | persistentVolumeClaim: |
| 138 | claimName: {{ include "common.fullname" . }}-migration |
| 139 | restartPolicy: Never |
| 140 | imagePullSecrets: |
| 141 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 142 | {{ end }} |