Skip to content

Add 'breeze k8s dev' command for hot-reloading DAGs and core sources (#40005)#59747

Merged
potiuk merged 5 commits intoapache:mainfrom
nailo2c:feat-40005-add_breeze_k8s_dev_command
Dec 25, 2025
Merged

Add 'breeze k8s dev' command for hot-reloading DAGs and core sources (#40005)#59747
potiuk merged 5 commits intoapache:mainfrom
nailo2c:feat-40005-add_breeze_k8s_dev_command

Conversation

@nailo2c
Copy link
Contributor

@nailo2c nailo2c commented Dec 23, 2025

Closes: #40005

Why

Based on my experience resolving k8s-related bugs, it's quite inconvenience to build and upload a k8s image when I only make a small change.

How

After some research, I decided integrate Skaffold into breeze k8s to improve the development experience.

I added a new command, breeze k8s dev, to sync Airflow source code to K8s pods in seconds.

What

1. /dags folder synchronization

airflow_40005_demo_output.mp4

2. Airflow Core synchronization

2.1. Scheduler

Exec into the pod with kubectl exec -n airflow -c scheduler -it airflow-scheduler-0 -- /bin/bash, and modify the log message to "Starting the scheduler [hot-reload]":

self.log.info("Starting the scheduler")

Use the following command to verify the synchronization: grep -n "Starting the scheduler" airflow-core/src/airflow/jobs/scheduler_job_runner.py

截圖 2025-12-24 下午11 30 58

2.2. Triggerer

I used kubectl logs -n airflow -l component=triggerer -c triggerer -f to observe the logs. After I modified the file at airflow-core/src/airflow/jobs/triggerer_job_runner.py, the logs showed:

2025-12-23T02:04:41.298585Z [info     ] Detected changes: {(<Change.deleted: 3>, '/opt/airflow/airflow-core/src/airflow/cli/commands/dag_processor_command.py'), (<Change.added: 1>, '/opt/airflow/airflow-core/src/airflow/cli/commands/dag_processor_command.py')} [airflow.cli.hot_reload] loc=hot_reload.py:187
2025-12-23T02:04:41.304871Z [info     ] Reloading...                   [airflow.cli.hot_reload] loc=hot_reload.py:188
triggerer

2.3. Dag-Processor

I used kubectl logs -n airflow -l component=dag-processor -c dag-processor -f to observe the logs. After I modified the file at airflow-core/src/airflow/cli/commands/dag_processor_command.py, the logs showed:

2025-12-23T02:04:40.964319Z [info     ] Detected changes: {(<Change.deleted: 3>, '/opt/airflow/airflow-core/src/airflow/cli/commands/dag_processor_command.py'), (<Change.added: 1>, '/opt/airflow/airflow-core/src/airflow/cli/commands/dag_processor_command.py')} [airflow.cli.hot_reload] loc=hot_reload.py:187
2025-12-23T02:04:40.970835Z [info     ] Reloading...                   [airflow.cli.hot_reload] loc=hot_reload.py:188
dag-processor

@boring-cyborg boring-cyborg bot added area:dev-tools backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch labels Dec 23, 2025
@potiuk
Copy link
Member

potiuk commented Dec 23, 2025

WOWOWOWOWOW !

@potiuk
Copy link
Member

potiuk commented Dec 23, 2025

One comment here - (might be follow-up) - if we run airflow commands in the chart with --dev flags , we could also simply synchronize airflow's source code - not only Dags. We already have built-in hot-reload in airflow components when they are run in --dev mode, so all we need is to sync the source change to the right folder.

- Updated output_k8s.txt with new hash value.
- Added output_k8s_dev.svg for visual representation of the 'k8s dev' command usage.
- Created output_k8s_dev.txt with corresponding hash for the new SVG output.
@nailo2c
Copy link
Contributor Author

nailo2c commented Dec 24, 2025

Yes, exactly. That's why I chose Skaffold, it handles syncing the source code directly to the running containers without rebuilding images. Combined with the --dev flag, this should give us the fast iteration experience we need :)

Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. That's why I chose Skaffold, it handles syncing the source code directly to the running containers without rebuilding images. Combined with the --dev flag, this should give us the fast iteration experience we need :)

Yes, this is super nice feature for improving k8s test iteration! Very appreciate it!

The current PR should also close #44508.

@potiuk potiuk merged commit 9f874c3 into apache:main Dec 25, 2025
243 checks passed
@github-actions
Copy link

Backport failed to create: v3-1-test. View the failure log Run details

Status Branch Result
v3-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker 9f874c3 v3-1-test

This should apply the commit to the v3-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

@potiuk
Copy link
Member

potiuk commented Dec 26, 2025

No backorting needed

amoghrajesh pushed a commit to astronomer/airflow that referenced this pull request Dec 29, 2025
…pache#40005) (apache#59747)

* Add 'breeze k8s dev' command for hot-reloading DAGs and core sources (apache#40005)

* fix CI test error

* Add Kubernetes development output files and update documentation

- Updated output_k8s.txt with new hash value.
- Added output_k8s_dev.svg for visual representation of the 'k8s dev' command usage.
- Created output_k8s_dev.txt with corresponding hash for the new SVG output.

* Update documentation for Breeze test commands

* update output files and add log level parameter to Kubernetes commands
@Lee-W
Copy link
Member

Lee-W commented Dec 30, 2025

#protm

@jason810496
Copy link
Member

#protm

for me as well.
I forgot to add the tag while reviewing the PR.

Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Jan 2, 2026
…pache#40005) (apache#59747)

* Add 'breeze k8s dev' command for hot-reloading DAGs and core sources (apache#40005)

* fix CI test error

* Add Kubernetes development output files and update documentation

- Updated output_k8s.txt with new hash value.
- Added output_k8s_dev.svg for visual representation of the 'k8s dev' command usage.
- Created output_k8s_dev.txt with corresponding hash for the new SVG output.

* Update documentation for Breeze test commands

* update output files and add log level parameter to Kubernetes commands
stegololz pushed a commit to stegololz/airflow that referenced this pull request Jan 9, 2026
…pache#40005) (apache#59747)

* Add 'breeze k8s dev' command for hot-reloading DAGs and core sources (apache#40005)

* fix CI test error

* Add Kubernetes development output files and update documentation

- Updated output_k8s.txt with new hash value.
- Added output_k8s_dev.svg for visual representation of the 'k8s dev' command usage.
- Created output_k8s_dev.txt with corresponding hash for the new SVG output.

* Update documentation for Breeze test commands

* update output files and add log level parameter to Kubernetes commands
jhgoebbert pushed a commit to jhgoebbert/airflow_Owen-CH-Leung that referenced this pull request Feb 8, 2026
…pache#40005) (apache#59747)

* Add 'breeze k8s dev' command for hot-reloading DAGs and core sources (apache#40005)

* fix CI test error

* Add Kubernetes development output files and update documentation

- Updated output_k8s.txt with new hash value.
- Added output_k8s_dev.svg for visual representation of the 'k8s dev' command usage.
- Created output_k8s_dev.txt with corresponding hash for the new SVG output.

* Update documentation for Breeze test commands

* update output files and add log level parameter to Kubernetes commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dev-tools backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve development experience for breeze k8s suite of commands

4 participants