From 635d830055ac388c7a4a0dc06a839482cc420b8c Mon Sep 17 00:00:00 2001 From: BinamB Date: Tue, 2 Jul 2024 14:08:38 -0500 Subject: [PATCH] Indexd Migration Script --- .../jobs/indexd-single-table-migration.yaml | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 kube/services/jobs/indexd-single-table-migration.yaml diff --git a/kube/services/jobs/indexd-single-table-migration.yaml b/kube/services/jobs/indexd-single-table-migration.yaml new file mode 100644 index 000000000..5d576fa53 --- /dev/null +++ b/kube/services/jobs/indexd-single-table-migration.yaml @@ -0,0 +1,76 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: indexd-single-table-migration +spec: + template: + metadata: + labels: + app: gen3job + spec: + affinity: + nodeAffinity: + preferredDuringSchedulingIgnoredDuringExecution: + - weight: 100 + preference: + matchExpressions: + - key: karpenter.sh/capacity-type + operator: In + values: + - on-demand + - weight: 99 + preference: + matchExpressions: + - key: eks.amazonaws.com/capacityType + operator: In + values: + - ONDEMAND + automountServiceAccountToken: false + volumes: + - name: config-volume + secret: + secretName: "indexd-secret" # pragma: allowlist secret + - name: "indexd-creds-volume" + secret: + secretName: "indexd-creds" # pragma: allowlist secret + - name: config-helper + configMap: + name: config-helper + - name: creds-volume-bk + secret: + secretName: "indexd-bk-creds" # pragma: allowlist secret + containers: + - name: indexd + GEN3_INDEXD_IMAGE + env: + - name: START_DID + GEN3_START_DID|-value: ""-| + volumeMounts: + - name: "config-volume" + readOnly: true + mountPath: "/var/www/indexd/local_settings.py" + subPath: "local_settings.py" + - name: "indexd-creds-volume" + readOnly: true + mountPath: "/var/www/indexd/creds.json" + subPath: creds.json + - name: "config-helper" + readOnly: true + mountPath: "/var/www/indexd/config_helper.py" + subPath: config_helper.py + - name: "creds-volume-bk" + readOnly: true + mountPath: /var/www/indexd/creds_bk.json"" + subPath: creds.json + imagePullPolicy: Always + command: ["/bin/bash"] + args: + - "-c" + - | + flags="--creds-path /var/www/indexd/creds_bk.json" + if [[ -n "$START_DID" ]]; then + flags="$flags --start-did $START_DID" + fi + time python /indexd/bin/migrate_to_single_table.py $flags + echo "Exit code: $?" + restartPolicy: Never