Skip to content

Commit bcd65ff

Browse files
committed
fix(airflow): Update manifests
- `credentialsSecret` -> `credentialsSecretName` - Change admin secret name - Add `metadataDatabase.postgresql`, add new secret - Move DB secrets - Remove legacy secret key
1 parent 7698e44 commit bcd65ff

5 files changed

Lines changed: 35 additions & 23 deletions

File tree

demos/airflow-scheduled-job/03-enable-and-run-spark-dag.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ spec:
2323
- |
2424
kubectl rollout status --watch statefulset/airflow-webserver-default
2525
kubectl rollout status --watch statefulset/airflow-scheduler-default
26-
AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-credentials/adminUser.password)
26+
AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-admin-credentials/adminUser.password)
2727
ACCESS_TOKEN=$(curl -XPOST http://airflow-webserver-default-headless:8080/auth/token -H 'Content-Type: application/json' -d '{"username": "admin", "password": "'$AIRFLOW_ADMIN_PASSWORD'"}' | jq -r .access_token)
2828
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' -XPATCH http://airflow-webserver-default-headless:8080/api/v2/dags/sparkapp_dag -d '{"is_paused": false}' | jq
2929
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' -XPOST http://airflow-webserver-default-headless:8080/api/v2/dags/sparkapp_dag/dagRuns -d '{"logical_date": null}' | jq
3030
volumeMounts:
31-
- name: airflow-credentials
32-
mountPath: /airflow-credentials
31+
- name: airflow-admin-credentials
32+
mountPath: /airflow-admin-credentials
3333
volumes:
34-
- name: airflow-credentials
34+
- name: airflow-admin-credentials
3535
secret:
36-
secretName: airflow-credentials
36+
secretName: airflow-admin-credentials
3737
restartPolicy: OnFailure
3838
backoffLimit: 20 # give some time for the Airflow cluster to be available

demos/airflow-scheduled-job/04-enable-and-run-date-dag.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ spec:
2323
- |
2424
kubectl rollout status --watch statefulset/airflow-webserver-default
2525
kubectl rollout status --watch statefulset/airflow-scheduler-default
26-
AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-credentials/adminUser.password)
26+
AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-admin-credentials/adminUser.password)
2727
ACCESS_TOKEN=$(curl -XPOST http://airflow-webserver-default-headless:8080/auth/token -H 'Content-Type: application/json' -d '{"username": "admin", "password": "'$AIRFLOW_ADMIN_PASSWORD'"}' | jq -r .access_token)
2828
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' -XPATCH http://airflow-webserver-default-headless:8080/api/v2/dags/date_demo -d '{"is_paused": false}' | jq
2929
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' -XPOST http://airflow-webserver-default-headless:8080/api/v2/dags/date_demo/dagRuns -d '{"logical_date": null}' | jq
3030
volumeMounts:
31-
- name: airflow-credentials
32-
mountPath: /airflow-credentials
31+
- name: airflow-admin-credentials
32+
mountPath: /airflow-admin-credentials
3333
volumes:
34-
- name: airflow-credentials
34+
- name: airflow-admin-credentials
3535
secret:
36-
secretName: airflow-credentials
36+
secretName: airflow-admin-credentials
3737
restartPolicy: OnFailure
3838
backoffLimit: 20 # give some time for the Airflow cluster to be available

demos/airflow-scheduled-job/05-enable-and-run-kafka-dag.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spec:
4747
kubectl rollout status --watch statefulset/airflow-scheduler-default
4848
4949
# Airflow: activate DAG
50-
AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-credentials/adminUser.password)
50+
AIRFLOW_ADMIN_PASSWORD=$(cat /airflow-admin-credentials/adminUser.password)
5151
ACCESS_TOKEN=$(curl -XPOST http://airflow-webserver-default-headless:8080/auth/token -H 'Content-Type: application/json' -d '{"username": "admin", "password": "'$AIRFLOW_ADMIN_PASSWORD'"}' | jq -r .access_token)
5252
curl -H "Authorization: Bearer $ACCESS_TOKEN" -H 'Content-Type: application/json' -XPATCH http://airflow-webserver-default-headless:8080/api/v2/dags/kafka_watcher -d '{"is_paused": false}' | jq
5353
@@ -58,11 +58,11 @@ spec:
5858
--producer.config /stackable/config/client.properties \
5959
--topic test-topic'
6060
volumeMounts:
61-
- name: airflow-credentials
62-
mountPath: /airflow-credentials
61+
- name: airflow-admin-credentials
62+
mountPath: /airflow-admin-credentials
6363
volumes:
64-
- name: airflow-credentials
64+
- name: airflow-admin-credentials
6565
secret:
66-
secretName: airflow-credentials
66+
secretName: airflow-admin-credentials
6767
restartPolicy: OnFailure
6868
backoffLimit: 20 # give some time for the Airflow cluster to be available

demos/airflow-scheduled-job/06-create-opa-users.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ spec:
4242
--password "richard.roe" \
4343
--role "User"
4444
volumeMounts:
45-
- name: airflow-credentials
46-
mountPath: /airflow-credentials
45+
- name: airflow-admin-credentials
46+
mountPath: /airflow-admin-credentials
4747
volumes:
48-
- name: airflow-credentials
48+
- name: airflow-admin-credentials
4949
secret:
50-
secretName: airflow-credentials
50+
secretName: airflow-admin-credentials
5151
restartPolicy: OnFailure
5252
backoffLimit: 20 # give some time for the Airflow cluster to be available

stacks/airflow/airflow.yaml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ spec:
99
productVersion: 3.2.2
1010
pullPolicy: IfNotPresent
1111
clusterConfig:
12+
metadataDatabase:
13+
postgresql:
14+
host: airflow-postgresql
15+
database: airflow
16+
credentialsSecretName: airflow-postgresql-credentials
1217
authorization:
1318
opa:
1419
configMapName: opa
@@ -17,7 +22,7 @@ spec:
1722
entryTimeToLive: 5s
1823
maxEntries: 10
1924
loadExamples: false
20-
credentialsSecret: airflow-credentials
25+
credentialsSecretName: airflow-admin-credentials
2126
volumes:
2227
- name: airflow-dags
2328
configMap:
@@ -571,13 +576,20 @@ data:
571576
apiVersion: v1
572577
kind: Secret
573578
metadata:
574-
name: airflow-credentials
579+
name: airflow-admin-credentials
575580
type: Opaque
576581
stringData:
577582
adminUser.username: admin
578583
adminUser.firstname: Airflow
579584
adminUser.lastname: Admin
580585
adminUser.email: airflow@airflow.com
581586
adminUser.password: "{{ airflowAdminPassword }}"
582-
connections.secretKey: "{{ airflowSecretKey }}"
583-
connections.sqlalchemyDatabaseUri: postgresql+psycopg2://airflow:airflow@postgresql-airflow/airflow
587+
---
588+
apiVersion: v1
589+
kind: Secret
590+
metadata:
591+
name: airflow-postgresql-credentials
592+
type: Opaque
593+
stringData:
594+
username: airflow
595+
password: airflow

0 commit comments

Comments
 (0)