Page MenuHomePhabricator

Upgrade airflow-sre to 3.3.x
Closed, ResolvedPublic

Description

We are upgrading Airflow to version 3.3.x, mostly for security reasons, as Airflow 2.x is not supported anymore. Unfortunately, there are lots of APIs changes. This task is tracking the upgrade of sre instance, as defined in Gitlab in airflow-dags/sre and Gerrit in deployment-charts/.../airflow-sre.

Most of the changes are tracked as subtasks of T423248.

Stages

  • Testing the Dags in airflow-devenv to figure out the scope (see Accessing Airflow 3).
  • Validation of the sre instance in airflow-devenv
  • Switchover
  • Validation that the DAGs are working

PoCs for the sre instance are:

Related Objects

StatusSubtypeAssignedTask
ResolvedBTullis
In Progressatsuko
Resolvedatsuko

Event Timeline

atsuko triaged this task as Medium priority.

Hi @elukey! Can you please help me figuring out how to safely test-run webrequest_blocked_requests_requestctl Dag?

Hi! @atsuko is it ok if I do it? As far as I can see it should be straightforward, I'll report back my findings during the next days. Wdyt?

atsuko changed the task status from Open to In Progress.Aug 25 2026, 4:57 PM

This will work, too. The command to run Airflow will be something like

$ airflow-devenv create --branch main_airflow_3.3 --extra-values values-airflow3.yaml -d sre

I've put the task in In Progress status so I can track the responses.

@atsuko before starting I have a doubt: I usually create a branch for my tests, in which I modify the sre's webrequest Python file with elukey-dev values so I don't override anything in prod. In this case I see that there is a branch called main_airflow_3.3, so what I'd do is to branch from it to a new custom branch, and only then I'd apply my changes. Does it sound ok?

@atsuko I did the above in a dev-env, removing the last bit of the dag related to rsync to puppetservers as precaution to avoid overriding files etc.. All good!

@atsuko before starting I have a doubt: I usually create a branch for my tests, in which I modify the sre's webrequest Python file with elukey-dev values so I don't override anything in prod. In this case I see that there is a branch called main_airflow_3.3, so what I'd do is to branch from it to a new custom branch, and only then I'd apply my changes. Does it sound ok?

Uh, I remember answering to this question somewhere, and I missed this one. Sorry to leave you with no answer. Yes, this is the correct way. I sync main_airflow_3.3 with main periodically, and keep it so it can work with Airflow 3. For doing fixes on-top, branching on top of it is the correct way. When you will create a pull-request, Gitlab allows a branch to compare against.

@atsuko I did the above in a dev-env, removing the last bit of the dag related to rsync to puppetservers as precaution to avoid overriding files etc.. All good!

I'll mark that instance as tested, thanks!

@elukey we are fairly confident that Airflow 3 works well. Considering that airflow-sre instance is quite small and independent, I'd like to upgrade it in a second wave. Gonna ping you on Monday about it.

@elukey we are fairly confident that Airflow 3 works well. Considering that airflow-sre instance is quite small and independent, I'd like to upgrade it in a second wave. Gonna ping you on Monday about it.

+1

atsuko added a subscriber: CDanis.

Change #1355636 had a related patch set uploaded (by Atsuko; author: Atsuko):

[operations/deployment-charts@master] helmfile/airflow-sre: upgrading to Airflow 3.3

https://gerrit.wikimedia.org/r/1355636

Upgrade plan

Pre-requisite

Upgrade

Cleanup

  • Re-enable all DAGs

Change #1355636 merged by jenkins-bot:

[operations/deployment-charts@master] helmfile/airflow-sre: upgrading to Airflow 3.3

https://gerrit.wikimedia.org/r/1355636

Change #1355662 had a related patch set uploaded (by Atsuko; author: Atsuko):

[operations/deployment-charts@master] helmfile/airflow-sre: set branch to main_airflow_3.3

https://gerrit.wikimedia.org/r/1355662

Change #1355662 merged by jenkins-bot:

[operations/deployment-charts@master] helmfile/airflow-sre: set branch to main_airflow_3.3

https://gerrit.wikimedia.org/r/1355662

Checked the results of webrequest_blocked_requests_requestctl DAG on 16.10 and it failed on spark, fixing it now. Thanks @brouberol for the investigation:

we can see the yarn spec containing that file:
files:

airflow.keytab:
  size: 0
  source: file:///etc/kerberos/keytabs/airflow.keytab
  timestamp: 0
  type: FILE
  visibility: APPLICATION[7:41 AM]the spark-submit CLI invocation using it:

script: "spark3-submit --driver-cores 8 --conf spark.executorEnv.SPARK_HOME=/usr/lib/spark3\

...
 \ --executor-cores 4 --executor-memory 16G --driver-memory 16G --keytab /etc/kerberos/keytabs/airflow.keytab\[7:41 AM]but I think something is wrong here

I think it should be --keytab airflow.keytab
confirmed, from the logs of a previous successful run
I think https://gitlab.wikimedia.org/repos/data-engineering/airflow-dags/-/commit/cf604d018bdc64277707c16d68761811b273a902?file_path=wmf_airflow_common%2Fhooks%2Fspark.py#line_e4e006fa6_A198 is the issue
Use Spark 3.5.8 for SparkSubmitOperator jobs (cf604d01) · Commits · repos / data-engineering / Airflow DAGs · GitLab* switching to the new API * fix connection paramerters if conn_id is not defined Upstream airflow/providers/apache/spark/hooks/spark_submit.py:_resolve_connection has changed behaviour and now passes principal and keytab to self._connection. * use...GitLabBalthazar Rouberol  [7:58 AM]
so, what happens here is that we run a spark-submit command through skein, so we bundle a bunch of files into an archive, that finds its way accross the network, on an an-worker host, gets unzipped and that becomes a "container"
to run the spark job
so here, we have a discrepancy between where skein mounts the keytab file (pwd) and the path in the spark-submit cli invokation (edited) 
so, what I think we should do here, is within wmf_airflow_common/operators/spark.SparkSubmitOperator._get_hook, we should  add "keytab": Path(self.keytab).name within the hook_kwargs.update(...) call
with a comment explaining that this file will be mounted in the cwd of the skein env, and so we're only taking its basename

Change #1356322 had a related patch set uploaded (by Atsuko; author: Atsuko):

[operations/deployment-charts@master] helmfile/airflow: generalising airflow3 config

https://gerrit.wikimedia.org/r/1356322

Change #1356322 merged by jenkins-bot:

[operations/deployment-charts@master] helmfile/airflow: generalising airflow3 config

https://gerrit.wikimedia.org/r/1356322

webrequest_blocked_requests_requestctl DAG has finished without errors after fix and restart.