Skip to content

Commit 681ea16

Browse files
authored
Merge pull request #213 from bcgov/chore/update-to-v3
chore: upgrade to Airflow 3
2 parents bf5d35d + d73c262 commit 681ea16

16 files changed

Lines changed: 65 additions & 26 deletions

File tree

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
context: .
5353
dockerfile_path: Dockerfile
5454
github_token: ${{ secrets.GITHUB_TOKEN }}
55-
chart_version: 2.2.1
55+
chart_version: 3.0.0
5656
is_chart_release: true
5757
cas-airflow-dag-trigger-build:
5858
needs: [release]
@@ -65,5 +65,5 @@ jobs:
6565
context: dag-trigger
6666
dockerfile_path: dag-trigger/Dockerfile
6767
github_token: ${{ secrets.GITHUB_TOKEN }}
68-
chart_version: 1.2.1
68+
chart_version: 1.2.2
6969
is_chart_release: true

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM apache/airflow:2.10.5
1+
FROM apache/airflow:3.1.2
22

33
# Install the standard providers for Airflow 2 -- can be removed when we upgrade to Airflow 3
44
RUN pip install --no-cache-dir "apache-airflow==${AIRFLOW_VERSION}" apache-airflow-providers-standard

dag-trigger/airflow-dag-trigger.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ if [ "$AIRFLOW_API_VERSION" = "v2" ]; then
8181
-d "{\"username\": \"$AIRFLOW_USERNAME\", \"password\": \"$AIRFLOW_PASSWORD\"}" \
8282
| jq -r .access_token)
8383
auth_params=(-H "Authorization: Bearer $jwt_token")
84+
extra_arguments="\"logical_date\": null, "
8485
elif [ "$AIRFLOW_API_VERSION" = "v1" ]; then
8586
dag_url="$AIRFLOW_ENDPOINT/api/v1/dags/${dag_id}"
8687
auth_params=(-u "$AIRFLOW_USERNAME:$AIRFLOW_PASSWORD")
88+
extra_arguments=""
8789
fi
8890

8991
is_paused=$(_curl "${auth_params[@]}" "$dag_url" | jq .is_paused)
@@ -100,7 +102,7 @@ run_json=$(_curl "${auth_params[@]}" -X POST \
100102
"$dag_run_url" \
101103
-H 'Cache-Control: no-cache' \
102104
-H 'Content-Type: application/json' \
103-
-d "{\"conf\": $dag_config}")
105+
-d "{$extra_arguments\"conf\": $dag_config}")
104106
dag_run_id=$(echo "$run_json" | jq -r .dag_run_id)
105107

106108
echo "Started dag run ID: $dag_run_id"

dags/fetch_and_save_dag_from_github.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from airflow.decorators import dag, task
1+
from airflow.sdk import dag, task
22
from airflow import settings
33
from dag_configuration import default_dag_args
44
from datetime import datetime, timedelta

deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ helm upgrade --install \
1818
helm upgrade --install --timeout 900s \
1919
--namespace "$AIRFLOW_NAMESPACE_PREFIX-$ENVIRONMENT" \
2020
-f ./helm/cas-airflow/values.yaml \
21-
--set-file airflow.webserver.webserverConfig=./helm/cas-airflow/webserver_config.py \
21+
--set-file airflow.apiServer.apiServerConfig=./helm/cas-airflow/webserver_config.py \
2222
-f "./helm/cas-airflow/values-$ENVIRONMENT.yaml" \
2323
--set namespaces.airflow="$AIRFLOW_NAMESPACE_PREFIX-$ENVIRONMENT" \
2424
--set namespaces.ggircs="$GGIRCS_NAMESPACE_PREFIX-$ENVIRONMENT" \

helm/cas-airflow-dag-trigger/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ apiVersion: v2
22
name: cas-airflow-dag-trigger
33
description: A Helm chart for triggering remote DAGs on an existing airflow instance
44
type: application
5-
version: 1.2.1 # Changing this requires updating the image tag in .github/workflows/release.yaml
5+
version: 1.2.2 # Changing this requires updating the image tag in .github/workflows/release.yaml

helm/cas-airflow-postgres-cluster/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ postgresCluster:
2121
options: "SUPERUSER"
2222
databases:
2323
- postgres
24+
password:
25+
type: AlphaNumeric
2426
- name: airflow
27+
password:
28+
type: AlphaNumeric
2529
databases:
2630
- postgres
2731

helm/cas-airflow/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v2
22
name: cas-airflow
33
type: application
4-
version: 2.2.1 # Changing this requires updating the image tag in .github/workflows/release.yaml
5-
appVersion: 2.10.5 # The airflow version
4+
version: 3.0.0 # Changing this requires updating the image tag in .github/workflows/release.yaml
5+
appVersion: 3.1.2 # The airflow version
66
description: Helm chart to deploy cas' flavour of airflow, compatible with OpenShift 4. This chart uses the vanilla airflow chart and adds cas' own templates and values.
77
icon: https://www.astronomer.io/static/airflowNewA.png
88
keywords:

helm/cas-airflow/templates/routes/route.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ spec:
88
host: {{ .Release.Name }}-{{ include "cas-airflow.namespaceSuffix" . }}.{{ .Values.route.clusterDomain }}
99
to:
1010
kind: Service
11-
name: {{ .Release.Name }}-webserver
11+
name: {{ .Release.Name }}-api-server
1212
weight: 100
1313
port:
14-
targetPort: airflow-ui
14+
targetPort: api-server
1515
tls:
1616
termination: edge
1717
insecureEdgeTerminationPolicy: Allow

helm/cas-airflow/templates/secrets/webserver.yaml renamed to helm/cas-airflow/templates/secrets/api.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
{{- $webserverSecret := (randAlphaNum 32) | b64enc | quote }}
1+
{{- $apiSecret := (randAlphaNum 32) | b64enc | quote }}
22

3-
{{- $secretName := printf "%s-%s" .Release.Name "webserver-secret" }}
3+
{{- $secretName := printf "%s-%s" .Release.Name "api-secret" }}
44
{{- $secret := (lookup "v1" "Secret" .Release.Namespace $secretName ) }}
55
{{- if $secret }}
6-
{{- $webserverSecret = index $secret.data "webserver-secret-key" }}
6+
{{- $apiSecret = index $secret.data "api-secret-key" }}
77
{{- end -}}
88

99

@@ -16,4 +16,4 @@ metadata:
1616
"helm.sh/hook": "pre-install,pre-upgrade"
1717
type: Opaque
1818
data:
19-
webserver-secret-key: {{ $webserverSecret }}
19+
api-secret-key: {{ $apiSecret }}

0 commit comments

Comments
 (0)