Skip to content

Commit 11c5820

Browse files
committed
working dag
1 parent 28fe265 commit 11c5820

4 files changed

Lines changed: 88 additions & 14 deletions

File tree

demos/demos-v2.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ demos:
165165
- iceberg
166166
- minio
167167
- s3
168+
- airflow
168169
manifests: []
169170
supportedNamespaces: []
170171
trino-taxi-data:

stacks/stacks-v2.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,12 @@ stacks:
394394
manifests:
395395
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/stacks/_templates/minio-distributed-small-tls/rendered-chart.yaml
396396
- helmChart: https://raw.githubusercontent.com/stackabletech/demos/main/stacks/_templates/postgresql-hive-iceberg.yaml
397+
- helmChart: https://raw.githubusercontent.com/stackabletech/demos/main/stacks/_templates/postgresql-airflow.yaml
397398
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/stacks/trino-iceberg/s3-connection.yaml
398399
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/stacks/trino-iceberg/hive-metastores.yaml
399400
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/stacks/trino-iceberg/trino.yaml
400-
- plainYaml: https://raw.githubusercontent.com/stackabletech/demos/main/stacks/_templates/postgresql-airflow.yaml
401401
- plainYaml: stacks/trino-iceberg/airflow.yaml
402+
- helmChart: stacks/trino-iceberg/redis-airflow.yaml
402403
supportedNamespaces: ["default"]
403404
parameters:
404405
- name: trinoAdminPassword

stacks/trino-iceberg/airflow.yaml

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,87 @@ metadata:
55
name: airflow
66
spec:
77
image:
8-
productVersion: 3.0.6
8+
productVersion: 2.10.5
99
pullPolicy: IfNotPresent
1010
clusterConfig:
1111
loadExamples: false
1212
credentialsSecret: airflow-credentials
13+
volumes:
14+
- name: airflow-dags
15+
configMap:
16+
name: airflow-dags
17+
volumeMounts:
18+
- name: airflow-dags
19+
mountPath: /stackable/airflow/dags/dbt_trino.py
20+
subPath: dbt_trino.py
1321
webservers:
1422
roleConfig:
1523
listenerClass: external-stable
24+
envOverrides: &envOverrides
25+
TZ: "Europe/Berlin"
26+
#AIRFLOW_CONN_KUBERNETES_IN_CLUSTER: "kubernetes://?__extra__=%7B%22extra__kubernetes__in_cluster%22%3A+true%2C+%22extra__kubernetes__kube_config%22%3A+%22%22%2C+%22extra__kubernetes__kube_config_path%22%3A+%22%22%2C+%22extra__kubernetes__namespace%22%3A+%22%22%7D"
27+
#AIRFLOW_CONN_KUBERNETES_DEFAULT: "kubernetes://?__extra__=%7B%22extra__kubernetes__in_cluster%22%3A+true%2C+%22extra__kubernetes__kube_config%22%3A+%22%22%2C+%22extra__kubernetes__kube_config_path%22%3A+%22%22%2C+%22extra__kubernetes__namespace%22%3A+%22%22%7D"
1628
config:
1729
resources:
1830
cpu:
1931
min: "2"
2032
max: "3"
2133
memory:
2234
limit: 3Gi
23-
configOverrides:
24-
webserver_config.py:
25-
# Allow "POST /login/" without CSRF token
26-
WTF_CSRF_ENABLED: "False"
2735
roleGroups:
2836
default:
2937
replicas: 1
30-
kubernetesExecutors:
31-
config: {}
32-
schedulers:
33-
roleGroups:
34-
default:
35-
replicas: 1
36-
dagProcessors:
38+
celeryExecutors:
39+
envOverrides: *envOverrides
3740
roleGroups:
3841
default:
3942
replicas: 1
40-
triggerers:
43+
schedulers:
44+
envOverrides: *envOverrides
4145
roleGroups:
4246
default:
4347
replicas: 1
48+
# dagProcessors:
49+
# envOverrides: *envOverrides
50+
# roleGroups:
51+
# default:
52+
# replicas: 1
53+
# triggerers:
54+
# envOverrides: *envOverrides
55+
# roleGroups:
56+
# default:
57+
# replicas: 1
58+
---
59+
apiVersion: v1
60+
kind: ConfigMap
61+
metadata:
62+
name: airflow-dags
63+
data:
64+
dbt_trino.py: |
65+
from airflow import DAG
66+
from airflow.providers.cncf.kubernetes.operators.pod import KubernetesPodOperator
67+
import pendulum
68+
from datetime import datetime
69+
70+
with DAG(
71+
dag_id="run_dbt_check_via_pod_operator",
72+
schedule=None,
73+
start_date=pendulum.datetime(2024, 9, 1),
74+
tags=["Demo", "DBT"],
75+
catchup=False
76+
) as dag:
77+
run_dbt_check = KubernetesPodOperator(
78+
namespace="default",
79+
image="my-dbt-trino:0.0.1",
80+
image_pull_policy="IfNotPresent",
81+
cmds=["/bin/bash", "-x", "-euo", "pipefail", "-c"],
82+
arguments=["dbt debug"],
83+
name="run-dbt-debug",
84+
task_id="task",
85+
#on_finish_action="keep_pod",
86+
startup_timeout_seconds=600
87+
)
88+
run_dbt_check
4489
---
4590
apiVersion: v1
4691
kind: Secret
@@ -55,3 +100,5 @@ stringData:
55100
adminUser.password: "adminadmin"
56101
connections.secretKey: "airflowSecretKey"
57102
connections.sqlalchemyDatabaseUri: postgresql+psycopg2://airflow:airflow@postgresql-airflow/airflow
103+
connections.celeryResultBackend: db+postgresql://airflow:airflow@postgresql-airflow/airflow
104+
connections.celeryBrokerUrl: redis://:redis@redis-airflow-master:6379/0
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
releaseName: redis-airflow
3+
name: redis
4+
repo:
5+
name: bitnami
6+
url: https://charts.bitnami.com/bitnami/
7+
version: 17.11.3
8+
options:
9+
commonLabels:
10+
stackable.tech/vendor: Stackable
11+
auth:
12+
password: redis
13+
global:
14+
security:
15+
allowInsecureImages: true
16+
image:
17+
repository: bitnamilegacy/redis
18+
volumePermissions:
19+
image:
20+
repository: bitnamilegacy/os-shell
21+
metrics:
22+
image:
23+
repository: bitnamilegacy/redis-exporter
24+
replica:
25+
replicaCount: 1

0 commit comments

Comments
 (0)