File tree Expand file tree Collapse file tree
helm/cas-bciers/templates Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ def should_cycle_backend(**context):
7474
7575
7676ROLLOUT_DAG_DOC = """
77- DAG to wait for the backend rollout to complete. Intended to be triggered after the DB reset.
77+ DAG to wait for the backend rollout to complete, then recreate the django superuser that was
78+ dropped along with the database. Intended to be triggered after the DB reset.
7879"""
7980
8081
@@ -99,7 +100,12 @@ def wait_for_backend_rollout():
99100 wait_until_job_complete = True ,
100101 )
101102
102- wait_for_backend_rollout_task # NOSONAR
103+ # Must run after the rollout completes, since it hits the backend over its route
104+ @task
105+ def add_django_admin_task ():
106+ trigger_k8s_cronjob ("add-django-admin" , BCIERS_NAMESPACE )
107+
108+ wait_for_backend_rollout_task >> add_django_admin_task ()
103109
104110
105111reset_data () # NOSONAR
Load diff This file was deleted.
Original file line number Diff line number Diff line change 1+ {{- if or (hasSuffix "-dev" .Release.Namespace) (hasSuffix "-test" .Release.Namespace) }}
2+
3+ apiVersion : batch/v1
4+ kind : CronJob
5+ metadata :
6+ labels : {{- include "cas-bciers.labels" . | nindent 4 }}
7+ component : job-with-database-access
8+ name : add-django-admin
9+ namespace : {{ .Release.Namespace }}
10+ annotations :
11+ " helm.sh/hook " : " pre-install,pre-upgrade"
12+ " helm.sh/hook-weight " : " -10"
13+ spec :
14+ suspend : true # This cron job is intended to be triggered manually by Airflow
15+ schedule : " 0 * * * *"
16+ jobTemplate :
17+ spec :
18+ template :
19+ metadata :
20+ name : {{ template "cas-bciers.fullname" . }}-add-django-admin
21+ spec :
22+ activeDeadlineSeconds : 300
23+ containers :
24+ - name : {{ template "cas-bciers.fullname" . }}-add-django-admin
25+ image : curlimages/curl
26+ env :
27+ - name : BACKEND_HOST
28+ value : {{ .Values.backend.route.host }}
29+ - name : DJANGO_SUPERUSER_USERNAME
30+ valueFrom :
31+ secretKeyRef :
32+ key : username
33+ name : django-superuser
34+ - name : DJANGO_SUPERUSER_PASSWORD
35+ valueFrom :
36+ secretKeyRef :
37+ key : password
38+ name : django-superuser
39+ command :
40+ - /bin/sh
41+ - -ec
42+ - " curl --fail-with-body https://$(BACKEND_HOST)/api/common/create-superuser"
43+ restartPolicy : Never
44+ {{ end }}
You can’t perform that action at this time.
0 commit comments