-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathairflow-api-deployment.yaml
More file actions
73 lines (73 loc) · 2.3 KB
/
Copy pathairflow-api-deployment.yaml
File metadata and controls
73 lines (73 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
apiVersion: apps/v1
kind: Deployment
metadata:
name: airflow-api
labels:
app: airflow-api
spec:
replicas: 1
selector:
matchLabels:
app: airflow-api
template:
metadata:
labels:
app: airflow-api
spec:
containers:
- name: airflow
image: airflow-local
imagePullPolicy: Never
command: ["airflow", "api-server"]
args: ["--port", "8080"]
ports:
- containerPort: 8080
env:
- name: AIRFLOW__DATABASE__SQL_ALCHEMY_CONN
value: postgresql+psycopg2://mlflow:mlflowpass@postgres-service:5432/airflow
- name: AIRFLOW__CORE__EXECUTOR
value: LocalExecutor
- name: AIRFLOW__CORE__FERNET_KEY
valueFrom:
secretKeyRef:
name: airflow-secrets
key: fernet-key
- name: MINIO_ENDPOINT
value: "http://minio.default.svc.cluster.local:9000"
- name: ACCESS_KEY
valueFrom:
secretKeyRef:
name: minio-creds
key: AWS_ACCESS_KEY_ID
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: minio-creds
key: AWS_SECRET_ACCESS_KEY
- name: BUCKET_NAME
value: "crop-yields"
lifecycle:
postStart:
exec:
command:
- /bin/bash
- -c
- |
echo "Initializing Airflow DB..."
set -e
if ! airflow db check; then
echo "Running migration..."
airflow db migrate
fi
if ! airflow users list | grep -q admin; then
echo "Creating default admin user..."
airflow users create \
--username admin \
--firstname admin \
--lastname admin \
--role Admin \
--email admin@example.com \
--password admin
fi
echo "Airflow DB initialization complete."
restartPolicy: Always