Skip to content

Tech Debt: Upgrade to Airflow 3 #210

@joshgamache

Description

@joshgamache

Airflow 3 is available. We are on version 2.10.5 as of this ticket. As this is a major release, there may be multiple steps required by us in order to handle the upgrade. This ticket will be used to catch sub-tickets for what is needed.

  1. Pre-update tasks

    • Update dag-trigger/airflow-dag-trigger.sh to use API-V2.

    • Update helm/cas-airflow/webserver_config.py to handle Auth/FAB changes.

    • Check backups

      • On the pgbackrest pod pgbackrest info to ensure there is a recent full backup.
    • Run DB clean commands on the Airflow pod

      • airflow db clean --clean-before-timestamp '$TIMESTAMP' where $TIMESTAMP is 2025-06-01 for dev/test and 2023-09-01 for prod
    • Check dag processing errors on the Airflow pod

      • airflow dags reserialize
    • Run ruff to do an upgrade check on all dags and correct any identified issues. See the upgrade docs

      • ruff check dag/ --select AIR301 --fix --preview to execute automated fixes
      • ruff check dag/ --select AIR301 --show-fixes --preview to show recommended fixes afterward
        • cas-airflow/dags/
        • cas-bciers/dags/
        • cas-cif/dags/
        • cas-ciip-portal/dags/
        • cas-data-warehouse/dags/
        • cas-ggircs/dags/
        • cas-metabase/dags/
    • Install apache-airflow-providers-standard package, see step 4

      • Update dags using PythonOperator, BatchPythonOperator, TriggerDagRunOperator to import from the new package (backwards compatible with Airflow 2)
    • The auth_backend option in [api] has been renamed to auth_backends - the old setting has been used, but please update your config.

    • The auth_backends setting in [api] has had airflow.api.auth.backend.session added in the running config, which is needed by the UI. Please update your config before Apache Airflow 3.0.

    • Update airflow helm chart to 1.18.0

      • No breaking changes. Ensure that values.airflow.airflowVersion is set, as it now defaults to 3.0.2 in the chart values.
  2. Update tasks

    • Spin down airflow-scheduler and airflow-webserver deployments.
    • On the pgbackrest pod, run pgbackrest backup to create a cold backup.
    • Push changes to helm values with values.airflow.airflowVersion set to latest 3.0.6
    • Deploy to OpenShift
    • On an airflow pod, run airflow config update to check configuration. Automated fixes will be applied with airflow config update --fix.
    • Ensure database migrations are correct with airflow db migrate.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions