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 |
| 133 | - bash docker-entrypoint.sh run_Migrations.sh -e UpdateAaiUriIndexMigration --commit --skipPreMigrationSnapShot --runDisabled RebuildAllEdges |
| 134 | env: |
| 135 | - name: LOCAL_USER_ID |
| 136 | value: {{ .Values.global.config.userId | quote }} |
| 137 | - name: LOCAL_GROUP_ID |
| 138 | value: {{ .Values.global.config.groupId | quote }} |
| 139 | volumeMounts: |
| 140 | - mountPath: /etc/localtime |
| 141 | name: localtime |
| 142 | readOnly: true |
| 143 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
| 144 | name: {{ include "common.fullname" . }}-config |
| 145 | subPath: janusgraph-realtime.properties |
| 146 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
| 147 | name: {{ include "common.fullname" . }}-config |
| 148 | subPath: janusgraph-cached.properties |
| 149 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
| 150 | name: {{ include "common.fullname" . }}-config |
| 151 | subPath: aaiconfig.properties |
| 152 | - mountPath: /opt/aai/logroot/AAI-GA |
| 153 | name: {{ include "common.fullname" . }}-logs |
| 154 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
| 155 | name: {{ include "common.fullname" . }}-config |
| 156 | subPath: logback.xml |
| 157 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
| 158 | name: {{ include "common.fullname" . }}-config |
| 159 | subPath: localhost-access-logback.xml |
| 160 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
| 161 | name: {{ include "common.fullname" . }}-config |
| 162 | subPath: application.properties |
| 163 | {{ $global := . }} |
| 164 | {{ range $job := .Values.global.config.auth.files }} |
| 165 | - mountPath: /opt/app/aai-graphadmin/resources/etc/auth/{{ . }} |
| 166 | name: {{ include "common.fullname" $global }}-auth-truststore-sec |
| 167 | subPath: {{ . }} |
| 168 | {{ end }} |
| 169 | resources: |
| 170 | {{ include "common.resources" . }} |
| 171 | {{- if .Values.nodeSelector }} |
| 172 | nodeSelector: |
| 173 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 174 | {{- end -}} |
| 175 | {{- if .Values.affinity }} |
| 176 | affinity: |
| 177 | {{ toYaml .Values.affinity | indent 8 }} |
| 178 | {{- end }} |
| 179 | volumes: |
| 180 | - name: localtime |
| 181 | hostPath: |
| 182 | path: /etc/localtime |
| 183 | - name: filebeat-conf |
| 184 | configMap: |
| 185 | name: aai-filebeat |
| 186 | - name: {{ include "common.fullname" . }}-logs |
| 187 | emptyDir: {} |
| 188 | - name: {{ include "common.fullname" . }}-config |
| 189 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 190 | name: {{ include "common.fullname" . }}-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 191 | - name: {{ include "common.fullname" . }}-snapshots |
| 192 | persistentVolumeClaim: |
| 193 | claimName: {{ include "common.fullname" . }}-migration |
| 194 | - name: {{ include "common.fullname" . }}-auth-truststore-sec |
| 195 | secret: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 196 | secretName: aai-common-truststore |
| 197 | items: |
| 198 | {{ range $job := .Values.global.config.auth.files }} |
| 199 | - key: {{ . }} |
| 200 | path: {{ . }} |
| 201 | {{ end }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 202 | restartPolicy: Never |
| 203 | imagePullSecrets: |
| 204 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 205 | --- |
| 206 | apiVersion: batch/v1 |
| 207 | kind: Job |
| 208 | metadata: |
| 209 | name: {{ include "common.fullname" . }}-db-backup-job |
| 210 | namespace: {{ include "common.namespace" . }} |
| 211 | labels: |
| 212 | app: {{ include "common.name" . }}-db-backup-job |
| 213 | release: {{ include "common.release" . }} |
| 214 | heritage: {{ .Release.Service }} |
| 215 | chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} |
| 216 | annotations: |
| 217 | "helm.sh/hook": pre-upgrade,pre-install |
| 218 | "helm.sh/hook-weight": "2" |
| 219 | "helm.sh/hook-delete-policy": before-hook-creation |
| 220 | spec: |
| 221 | backoffLimit: 20 |
| 222 | template: |
| 223 | metadata: |
| 224 | labels: |
| 225 | app: {{ include "common.name" . }}-db-backup-job |
| 226 | release: {{ include "common.release" . }} |
| 227 | name: {{ include "common.name" . }} |
| 228 | spec: |
| 229 | {{ if eq .Values.global.jobs.migration.remoteCassandra.enabled false }} |
| 230 | initContainers: |
| 231 | - command: |
| 232 | - /bin/bash |
| 233 | - -c |
| 234 | - /app/ready.py --container-name aai-cassandra --timeout 1 || /app/ready.py --container-name cassandra |
| 235 | env: |
| 236 | - name: NAMESPACE |
| 237 | valueFrom: |
| 238 | fieldRef: |
| 239 | apiVersion: v1 |
| 240 | fieldPath: metadata.namespace |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 241 | image: {{ include "repositoryGenerator.image.readiness" . }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 242 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 243 | name: {{ include "common.name" . }}-db-backup-readiness |
| 244 | {{- end }} |
| 245 | containers: |
| 246 | - name: {{ include "common.name" . }}-db-backup-job |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 247 | image: {{ include "repositoryGenerator.repository" . }}/{{ .Values.image }} |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 248 | imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} |
| 249 | command: |
| 250 | - /bin/bash |
| 251 | - docker-entrypoint.sh |
| 252 | - dataSnapshot.sh |
| 253 | env: |
| 254 | - name: LOCAL_USER_ID |
| 255 | value: {{ .Values.global.config.userId | quote }} |
| 256 | - name: LOCAL_GROUP_ID |
| 257 | value: {{ .Values.global.config.groupId | quote }} |
| 258 | volumeMounts: |
| 259 | - mountPath: /etc/localtime |
| 260 | name: localtime |
| 261 | readOnly: true |
| 262 | - mountPath: /opt/app/aai-graphadmin/logs/data/dataSnapshots |
| 263 | name: {{ include "common.fullname" . }}-snapshots |
| 264 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-realtime.properties |
| 265 | name: {{ include "common.fullname" . }}-migration |
| 266 | subPath: janusgraph-migration-real.properties |
| 267 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/janusgraph-cached.properties |
| 268 | name: {{ include "common.fullname" . }}-migration |
| 269 | subPath: janusgraph-migration-cached.properties |
| 270 | - mountPath: /opt/app/aai-graphadmin/resources/etc/appprops/aaiconfig.properties |
| 271 | name: {{ include "common.fullname" . }}-config |
| 272 | subPath: aaiconfig.properties |
| 273 | - mountPath: /opt/aai/logroot/AAI-RES/ |
| 274 | name: {{ include "common.fullname" . }}-logs |
| 275 | - mountPath: /opt/app/aai-graphadmin/resources/logback.xml |
| 276 | name: {{ include "common.fullname" . }}-config |
| 277 | subPath: logback.xml |
| 278 | - mountPath: /opt/app/aai-graphadmin/resources/localhost-access-logback.xml |
| 279 | name: {{ include "common.fullname" . }}-config |
| 280 | subPath: localhost-access-logback.xml |
| 281 | - mountPath: /opt/app/aai-graphadmin/resources/application.properties |
| 282 | name: {{ include "common.fullname" . }}-config |
| 283 | subPath: application.properties |
| 284 | resources: |
| 285 | {{ include "common.resources" . | indent 10 }} |
| 286 | {{- if .Values.nodeSelector }} |
| 287 | nodeSelector: |
| 288 | {{ toYaml .Values.nodeSelector | indent 8 }} |
| 289 | {{- end -}} |
| 290 | {{- if .Values.affinity }} |
| 291 | affinity: |
| 292 | {{ toYaml .Values.affinity | indent 8 }} |
| 293 | {{- end }} |
| 294 | volumes: |
| 295 | - name: localtime |
| 296 | hostPath: |
| 297 | path: /etc/localtime |
| 298 | - name: {{ include "common.fullname" . }}-logs |
| 299 | emptyDir: {} |
| 300 | - name: {{ include "common.fullname" . }}-config |
| 301 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 302 | name: {{ include "common.fullname" . }}-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 303 | - name: {{ include "common.fullname" . }}-migration |
| 304 | configMap: |
Sylvain Desbureaux | 5b65132 | 2020-12-07 15:34:15 +0100 | [diff] [blame] | 305 | name: {{ include "common.fullname" . }}-migration-configmap |
Sylvain Desbureaux | 7007041 | 2020-11-09 21:58:48 +0100 | [diff] [blame] | 306 | - name: {{ include "common.fullname" . }}-snapshots |
| 307 | persistentVolumeClaim: |
| 308 | claimName: {{ include "common.fullname" . }}-migration |
| 309 | restartPolicy: Never |
| 310 | imagePullSecrets: |
| 311 | - name: "{{ include "common.namespace" . }}-docker-registry-key" |
| 312 | {{ end }} |