From 0490b66756e9cbf6f2639aee5496a5e552805b83 Mon Sep 17 00:00:00 2001 From: John McCann Cunniff Jr Date: Thu, 17 Feb 2022 21:32:08 -0500 Subject: [PATCH] ADD k8s startup visual regen on chart upgrade --- k8s/chart/templates/migrate.yml | 22 ------------- k8s/chart/templates/startup-jobs.yml | 46 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 22 deletions(-) delete mode 100644 k8s/chart/templates/migrate.yml create mode 100644 k8s/chart/templates/startup-jobs.yml diff --git a/k8s/chart/templates/migrate.yml b/k8s/chart/templates/migrate.yml deleted file mode 100644 index 9bfb268bc..000000000 --- a/k8s/chart/templates/migrate.yml +++ /dev/null @@ -1,22 +0,0 @@ ---- -apiVersion: batch/v1 -kind: Job -metadata: - name: db-migrate-{{ .Release.Revision }} - namespace: {{ .Release.Namespace }} - labels: - {{- include "chart.labels" . | nindent 4 }} - component: db-migrate -spec: - backoffLimit: 4 - ttlSecondsAfterFinished: 30 - template: - spec: - restartPolicy: Never - containers: - - name: db-migrate - image: {{ .Values.api.image }}:{{ .Values.api.tag }} - imagePullPolicy: {{ .Values.imagePullPolicy }} - command: ["alembic", "upgrade", "head"] - env: - {{- include "api.env" . | nindent 12 }} diff --git a/k8s/chart/templates/startup-jobs.yml b/k8s/chart/templates/startup-jobs.yml new file mode 100644 index 000000000..00ab11e60 --- /dev/null +++ b/k8s/chart/templates/startup-jobs.yml @@ -0,0 +1,46 @@ +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: db-migrate-{{ .Release.Revision }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "chart.labels" . | nindent 4 }} + component: db-migrate +spec: + backoffLimit: 4 + ttlSecondsAfterFinished: 30 + template: + spec: + restartPolicy: Never + containers: + - name: db-migrate + image: {{ .Values.api.image }}:{{ .Values.api.tag }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + command: ["alembic", "upgrade", "head"] + env: + {{- include "api.env" . | nindent 12 }} +--- +apiVersion: batch/v1 +kind: Job +metadata: + name: db-visuals-{{ .Release.Revision }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "chart.labels" . | nindent 4 }} + component: visuals +spec: + backoffLimit: 4 + ttlSecondsAfterFinished: 30 + template: + spec: + restartPolicy: Never + containers: + - name: visuals + image: {{ .Values.api.image }}:{{ .Values.api.tag }} + imagePullPolicy: {{ .Values.imagePullPolicy }} + command: [ "python3", "jobs/visuals.py" ] + env: + - name: "JOB" + value: "1" + {{- include "api.env" . | nindent 12 }}