Skip to content

Helm: Add Dag processor sets to run separate processors per bundle - #75945

Open
xchwan wants to merge 12 commits into
apache:mainfrom
xchwan:chart-dag-processor-sets
Open

xchwan wants to merge 12 commits into
apache:mainfrom
xchwan:chart-dag-processor-sets

Conversation

@xchwan

@xchwan xchwan commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

A single Dag processor parses every Dag bundle, so a heavy or failing bundle cannot be scaled, sized or scheduled apart from the others. Sets mirror workers.celery.sets, so each set can override any dagProcessor setting and parse only the bundles it selects, while bundles stay defined once in dagBundleConfigList.

closes: #61037
related: #74849

Why

The chart runs a single Dag processor Deployment that parses every Dag bundle. A heavy or failing
bundle cannot be scaled, sized, scheduled or isolated apart from the others, and every replica shares
one configuration. The core already supports parsing a subset of bundles
(airflow dag-processor --bundle-name ..., repeatable), so only the chart is missing.

This takes over the work started in #61039 (closed after going stale while waiting for a chart design
direction) and applies the direction agreed in that discussion: follow workers.celery.sets rather than
introducing a parallel configuration tree. The original author is credited as co-author on the commit.

What changed compared to #61039

Review feedback on #61039 and how it is handled here:

Feedback on #61039 Handling
Two parallel lists (bundles and deployPerBundle.bundleOverrides) can drift apart Bundles are defined once in dagProcessor.dagBundleConfigList; a set selects them with bundleNames and the chart fails when a name is not defined
Do not expose yet another args parameter No new args knob; --bundle-name flags are appended to the last item of the existing dagProcessor.args
Drop the extra deploymentOverride level and model it on workers.celery.sets dagProcessor.sets / enableDefault mirror the worker sets values (except the enableDefault default, see below) and reuse the same merge helper (workersMergeValues) and naming scheme
Wait for Airflow 2 removal / Chart 2.0 so the structure can be simplified Implemented on current main, after the workers deprecation removal and sets simplification (#66671)
A single Dag processor should still be possible next to dedicated ones enableDefault keeps the existing Deployment when sets is empty, and can be set to true to run it next to the sets (see below)

enableDefault logic (differs from workers.celery.enableDefault)

enableDefault is not a plain true default. When it is not set, the default Dag processor is created only
if sets is empty; an explicit true or false is always respected.

Worker sets split work by queue, but the default Dag processor parses all bundles unless bundleNames
is set. Keeping it enabled next to sets that select bundles would silently make those bundles be parsed
twice, with no error to point at the cause. With sets: [] nothing changes for existing users.

Documentation only and failing the render were considered, but the first relies on users noticing the
warning and the second blocks valid setups. If maintainers prefer exact parity with
workers.celery.enableDefault, restoring enableDefault: true is a small change.

The #61039 implementation (helper templates dag-processor.deployment / dag-processor.poddisruptionbudget,
deployPerBundle, bundleOverrides) is not reused; this PR is a fresh implementation on the sets pattern.

What it does

  • New dagProcessor.enableDefault, dagProcessor.bundleNames and dagProcessor.sets values (with schema).
  • Each item of sets requires a name and can override any dagProcessor value. It renders its own
    Deployment <release>-dag-processor-<name> and, when enabled, its own PodDisruptionBudget
    <release>-dag-processor-pdb-<name>, selected by a dag-processor-set label.
  • bundleNames is validated against dagBundleConfigList and turned into --bundle-name flags.
  • A set cannot define its own dagBundleConfigList (the Airflow config is shared by all Dag processors, so
    the override would be silently ignored); the chart fails with an explanation instead.
  • With defaults (sets: []) the rendered Deployment and PodDisruptionBudget are identical to main.
  • Docs: new section in chart/docs/manage-dag-files.rst.

Not included: a per-set image (requested in #74849). It is a separate change on top of this structure.

Note: the default Dag processor parses all bundles unless bundleNames is set on it, so when
enableDefault is set to true next to sets, a bundle selected by a set is parsed twice. This is documented
in values.yaml, the schema and the docs.

Testing

Executed:

  • New chart/tests/helm_tests/airflow_core/test_dag_processor_sets.py (19 tests): default output, enableDefault
    derived from sets (5 combinations), naming with/without default, set labels and selectors, value overrides, --bundle-name args (single, multiple,
    on the default processor), args untouched without bundleNames, all bundles still present in the shared
    config, failures (unknown bundle, missing name, dagBundleConfigList in a set), per-set PDB, disabled
    Dag processor.
  • Together with the existing test_dag_processor.py and test_worker_sets.py: 241 tests passed.
  • prek run --stage pre-commit on the changed files: all hooks passed.
  • helm template output of the Dag processor Deployment and PodDisruptionBudget with default values,
    compared against main: no differences.
  • Render time (helm template, clean chart directory): about 0.75s on main, 0.9s with this change and
    default values, 0.95s with 10 sets and 1.2s with 30 sets (about 10ms per set).
  • Manual check on a local kind cluster (Airflow 3.3.2, two LocalDagBundles, one set per bundle): the
    Deployments, PodDisruptionBudgets and --bundle-name args were as expected, and the logs of each Dag
    processor show it only refreshing and scanning its own bundle.

Not verified:

  • Dag runs and the UI end to end. My local machine could not run the full chart stably: Docker is capped at
    8 CPUs (12 GB memory after raising it), and a single-node kind cluster running the migration job, API
    server, scheduler and several Dag processors at once saturated the CPU. The startup/liveness probes
    (each of which starts a full airflow process) timed out and kept restarting the API server and
    scheduler, even after relaxing the probe timeouts and dropping the log-groomer sidecars. The Dag
    processors themselves stayed up, so only they were checked (Deployments, PodDisruptionBudgets, args and
    logs). A run on a machine with more CPU would be welcome.
  • The complete Helm unit test suite, and other Kubernetes versions than the test default.

No newsfragment: the feature is opt-in and the chart only takes newsfragments for major or breaking changes.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Sonnet 5.5) following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

A single Dag processor parses every Dag bundle, so a heavy or failing bundle cannot be scaled, sized or scheduled apart from the others. Sets mirror workers.celery.sets, so each set can override any dagProcessor setting and parse only the bundles it selects, while bundles stay defined once in dagBundleConfigList.

related: apache#61037

Co-authored-by: SeonghwanLee <[email protected]>
Signed-off-by: Xch1 <[email protected]>
The default Dag processor parses every Dag bundle, so keeping it enabled next to sets that select bundles silently parses those bundles twice. Unlike worker queues, the default Dag processor does not take a separate share of the work, so deriving enableDefault from sets avoids a misconfiguration that gives no error. An explicit true or false is still honoured.

related: apache#61037

Co-authored-by: SeonghwanLee <[email protected]>
Signed-off-by: Xch1 <[email protected]>
@kaxil

kaxil commented Nov 4, 2026

Copy link
Copy Markdown
Member

Dag runs and the UI end to end. My local machine could not run the full chart stably: Docker is capped at
8 CPUs (12 GB memory after raising it), and a single-node kind cluster running the migration job, API
server, scheduler and several Dag processors at once saturated the CPU. The startup/liveness probes
(each of which starts a full airflow process) timed out and kept restarting the API server and
scheduler, even after relaxing the probe timeouts and dropping the log-groomer sidecars. The Dag
processors themselves stayed up, so only they were checked (Deployments, PodDisruptionBudgets, args and
logs). A run on a machine with more CPU would be welcome.

Can't review if you haven't tested it e2e and show screenshot, gifs, videos of that

@xchwan

xchwan commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

@kaxil
I ran this end to end on another machine (16 CPUs, 32 GB RAM) and recorded it.
ui-dags-list

recording-b-isolation.mp4

What I ran: the whole chart on kind (Kubernetes v1.31.12) with an image built from this checkout, not only the
Dag processors: migration job, API server, scheduler, PostgreSQL and two Dag processor sets, with the Dags visible
in the UI and Dag runs executed.

Setup: two LocalDagBundles defined once in dagProcessor.dagBundleConfigList, one small Dag each, and two sets:

dagProcessor:
  sets:
    - {name: set-a, bundleNames: [bundle_a]}
    - {name: set-b, bundleNames: [bundle_b]}

Deployment and UI

  • Two Deployments, set-a and set-b, running airflow dag-processor --bundle-name 'bundle_a' and
    --bundle-name 'bundle_b'; no default Deployment when only sets is used.
  • airflow dags list shows bundle_a_dag under bundle_a and bundle_b_dag under bundle_b; both appear in
    the UI (screenshot) and the Dag Processor health check is green.
  • Both Dags ran to success, each task included.
  • Stability: 10 samples over 9 minutes, one per minute. The API server, scheduler, PostgreSQL and both Dag
    processor Pods were ready in every sample with 0 restarts.

Chart behaviour

  • enableDefault=true adds the default Deployment next to both sets.
  • PDB enabled on one set renders only that set's PDB, selecting dag-processor-set: set-a.
  • Bad configs (undefined bundle in bundleNames, dagBundleConfigList inside a set) fail helm template with a
    clear message.
  • replicas: 2 on set-a gives two Pods, both on bundle_a.

Isolation

  • Recording: with a 40Mi memory limit on set-b, the new set-b Pod goes through Init:OOMKilled and
    Init:CrashLoopBackOff while both set-a Pods are Running (set-a is scaled to 2 replicas here). I then add a
    Dag to bundle_a and it shows up in the UI next to bundle_b_dag. The recording is cut where I waited for the
    Dag to be parsed and reconnected the port-forward, so the new Dag does not appear instantly.
  • A 200Mi limit on set-b makes the dag-processor container itself OOMKilled on every start (5 restarts,
    CrashLoopBackOff), with no running set-b Pod. A Dag added to bundle_a in that state was parsed by set-a and
    its run finished with success.
  • With bundle_b pointed at a path that does not exist, set-b keeps running and finds nothing; a Dag added to
    bundle_a was still parsed by set-a.

Tests

  • test_dag_processor_sets.py: 19 passed, with uv run --project chart pytest and inside the breeze CI image.
  • Full chart suite, breeze testing helm-tests --use-xdist: 2278 passed.

Drafted-by: Claude Code (Sonnet 5.5)

@aaron-y-chen aaron-y-chen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the contribution! Great job :)

@xchwan

xchwan commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@aaron-y-chen
Thanks for the review. I fixed the three points and checked each one on a kind cluster, with the chart from
before the fix and the fixed chart, using the same values:

dagProcessor:                                                                                                                 
  enableDefault: true                                                                                                         
  podDisruptionBudget: {enabled: true}                                                                                        
  sets:                                                                                                                       
    - name: set-a                                                                                                             
      command: [airflow]                                                                                                      
      args: [dag-processor, --bundle-name, bundle_a]                                                                          
      bundleNames: [bundle_a]                                                                                                 
    - name: set-b                                                                                                             
      bundleNames: [bundle_b]                                                                                                 
      serviceAccount: {create: true, name: team-b}                                                                            

1. Default PDB also selected the sets' Pods

  • Before: the default PDB selected all 3 Pods (expectedPods: 3), and evicting the set-a Pod failed with
    This pod has more than one PodDisruptionBudget, which the eviction subresource does not support.
  • After: the default PDB excludes sets that have their own PDB (NotIn on dag-processor-set). Each PDB selects
    exactly one Pod (expectedPods: 1 for all three), and evicting the default, set-a and set-b Pods all succeeds.
  • Test: test_each_pod_is_selected_by_one_pdb matches every Deployment's Pod labels against every PDB selector.

2. A set's serviceAccount override was never created

  • Before: set-b's Deployment referenced team-b, no such ServiceAccount existed, and a new Pod could not be
    created: error looking up service account airflow/team-b: serviceaccount "team-b" not found.
  • After: the ServiceAccount template renders one account per distinct name, so team-b is created and set-b runs.
    Sets that use the same name with the same settings share one object; the same name with different annotations
    or automountServiceAccountToken fails at render time with a "conflicting configuration" error.
  • Tests: test_set_service_account_override_is_created, test_shared_service_account_is_rendered_once,
    test_conflicting_service_account_config_fails.

3. bundleNames assumed the last arg is a shell command

  • Before: with command: [airflow] the args became ["dag-processor", "--bundle-name", "bundle_a --bundle-name 'bundle_a'"]
    and the Pod went into CrashLoopBackOff.
  • After: the flags are part of the default args in values.yaml, like workers.celery.queue, so custom
    command and args are passed through untouched. The Pod runs and parses only bundle_a. If bundleNames is
    set and args has no --bundle-name, the render fails instead of parsing every bundle:
    `dagProcessor.args` does not select bundle "bundle_a".
  • Tests: test_custom_command_and_args_are_passed_through, test_bundle_names_not_passed_by_custom_args_fail.

Other cases I ran on the cluster with the fixed chart

  • No sets: the default PDB selector is unchanged (no NotIn), evicting the Pod succeeds, and the processor parses
    both bundles.
  • Sets only (enableDefault: false): no default Deployment or PDB; each set has its own PDB selecting one Pod, and
    evicting each set's Pod succeeds.
  • Only the default and set-a have a PDB (set-b has none): the default PDB selects 2 Pods (default and set-b), set-a's
    PDB selects 1, and evicting the set-a and set-b Pods succeeds.
  • A set overriding its own PDB (maxUnavailable: 0 on set-a): evicting the set-a Pod is refused (429), while
    evicting the set-b and default Pods succeeds.
  • Two sets sharing one ServiceAccount name with the same settings: one shared-sa is created and both Deployments
    use it. A set with its own name and annotation gets that ServiceAccount created with the annotation. A set with
    create: false pointing at an existing account creates nothing extra.
  • Custom args containing a template expression ({{ .Release.Name }}): it is rendered into the args and the Pod
    runs and parses only bundle_a.
  • Rejected at upgrade time: a bundleNames entry that is not defined, dagBundleConfigList inside a set,
    conflicting ServiceAccount settings, and custom args without --bundle-name.
  • After restoring the original values, both Dags (one per bundle) ran to success.

Stability and tests

  • No restarts: the API server, scheduler, PostgreSQL and the three Dag processor Pods were ready with 0 restarts
    in 6 samples over 5 minutes.
  • test_dag_processor_sets.py: 29 passed. Full chart suite: 2307 passed. Both were run after the last change.
  • breeze build-docs helm-chart succeeds, and the updated section of manage-dag-files renders.

Generated-by: Claude Code (Sonnet 5.5)

@aaron-y-chen aaron-y-chen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@stegololz stegololz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for picking this up!

I proposed triggerer and dag processor sets on dev@ (https://lists.apache.org/thread/gbyh213vy957bn63nvhfh884j83tvzcv), and this PR covers the dag processor side well, so I'll only do triggerer.sets separately, following the conventions here (enableDefault, dag-processor-set label, PDB exclusion, SA handling) so both can later move onto one shared set helper.

We run per-team dag processors on a multi-team setup with one processor per bundle through a wrapper chart, and checked this branch against the cases we hit there. A few inline notes, all reproduced with helm template on ea54876e.

{{- $dagProcessor := include "workersMergeValues" (list $.Values.dagProcessor $dagProcessorSet) | fromYaml -}}
{{- $_ := set $globals.Values "dagProcessor" $dagProcessor -}}
{{- with $globals -}}
{{- if .Values.dagProcessor.serviceAccount.create -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A set ServiceAccount is created here, but rbac/security-context-constraint-rolebinding.yaml (L113-116) still binds only dagProcessor.serviceAccountName of the parent values. With rbac.createSCCRoleBinding: true, enableDefault: false and a set using serviceAccount: {create: true, name: team-a}, the rolebinding lists t-airflow-dag-processor but never team-a, so that set's pods lose the SCC binding on OpenShift. Looping over the rendered SA names there would fix it.

(Worker sets on main have the same gap in that file and in pod-launcher-rolebinding.yaml. Fine to keep that out of scope here.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I will loop over the Dag processor ServiceAccount names the chart actually renders in the SCC rolebinding, using the same name resolution as the ServiceAccount template, and add a test for it. Agreed to leave the worker sets out of this PR.


Drafted-by: Claude Code (Sonnet 5.5)

{{- if $enableDefault -}}
{{- $dagProcessorSets = concat (list (dict "name" "default")) $dagProcessorSets -}}
{{- end -}}
{{- range $dagProcessorSet := $dagProcessorSets -}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Set names aren't validated, and these all render without error:

  • two sets named x give two Deployments t-dag-processor-x;
  • a set named default with enableDefault: true gives two t-dag-processor;
  • team_a gives t-dag-processor-team_a, which the API server rejects (not DNS-1123).

A fail on duplicate names, on default, and on names that aren't DNS-1123 labels would catch these at render time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I will add a render-time fail for duplicate set names, a set named default, and names that are not DNS-1123 labels, with a test for each.


Drafted-by: Claude Code (Sonnet 5.5)

{{- end }}
{{- $renderedArgs := tpl (toYaml $args) $dagProcessorContext }}
{{- range . }}
{{- if not (has . $definedBundles) }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two things here:

  • Same bundle in two sets: bundleNames: [b1] in two sets renders both, so b1 gets parsed by two processors. A check that each bundle is claimed by at most one set would help; we hit this in our own setup.
  • Substring match (nit): the contains . $renderedArgs check on L64 matches substrings, so a bundle b1 passes when args only contain --bundle-name 'b10'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The substring match is a bug in my check. I will compare the full --bundle-name value and add a test.

For the same bundle in two sets, I would not make it a hard fail. The chart already allows one bundle on several Pods (replicas: 2), moving a bundle between sets needs a short overlap, and workers.celery.sets does not forbid two sets on one queue either.

Instead I suggest a warning in NOTES.txt. I checked it on a kind cluster with helm install --dry-run and helm upgrade --dry-run=server: with set-a and set-b both selecting bundle_a it prints Dag bundle "bundle_a" is selected by more than one Dag processor set (set-a, set-b), so it is parsed by each of them., and nothing without overlap or without sets. It is only shown on install/upgrade (not helm template) and chart tests cannot cover it, so fail stays for the cases that can never work (point 2).

I am fine with a hard fail if you prefer, as long as both set types follow the same rule.


Drafted-by: Claude Code (Sonnet 5.5)

…or SCC

A set name ends up in the Deployment name and in a Pod label, so duplicate,
`default` or non-DNS-1123 names rendered manifests that collided with each
other or were rejected by the API server. They now fail at render time.

The OpenShift SCC role binding only listed the parent Dag processor
ServiceAccount, so a set that uses its own ServiceAccount lost the SCC
binding. It now lists the ServiceAccount of every Dag processor Deployment.

The check that custom `args` select each bundle compared substrings, so
bundle `b1` was accepted when the args only selected `b10`. It now matches
the whole `--bundle-name` value.

A bundle selected by more than one set is only reported with a warning on
`helm install` and `helm upgrade`, not rejected, because parsing a bundle in
several processors is already possible with `replicas` and is needed while
moving a bundle between sets.
Helm reports a missing required property as "missing property 'name'" or "name is required" depending on its version, so the test matched only one of them.
The default Dag processor is not created next to sets unless enableDefault is true, so the cases that expected its ServiceAccount did not set it.
@xchwan

xchwan commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

@stegololz Thanks for the review. Summary of what this update changes and how it was tested.

What changed

  • dagProcessor.sets names are validated: default is reserved, names must be valid DNS-1123 labels, and duplicates are rejected.
  • ServiceAccounts of the sets are bound once each in the SCC role binding.
  • Fixes for the PDB overlap, ServiceAccount handling and custom args with sets.
  • NOTES.txt warns when a Dag bundle is selected by more than one set.

What was tested

  • Helm unit tests (test_dag_processor_sets.py, test_scc_rolebinding.py): 135 passed.
  • Real install on kind (k8s v1.31.12, LocalExecutor) with 3 bundles and two sets:
    • one Deployment per set and no default one, with the expected --bundle-name args; each processor only parsed its own bundles
    • correct ServiceAccounts (including a custom one), PDBs per set, rollout restart works
    • enableDefault=true next to sets adds the default processor and its PDB
    • invalid set names (default, Team_A) fail at render, before anything is created
    • /api/v2/dags returns the right bundle_name per Dag; all three Dags ran to success
  • Upgrade without sets: the chart from upstream-main and this branch render identical Dag processor Deployment, ServiceAccount, PDB
    and SCC role binding for the default setup, a custom ServiceAccount + PDB, custom replicas/args, and SCC enabled.

Help needed: OpenShift SCC
I could not test this on a real OpenShift cluster (kind has no SCC admission). What is verified: with createSCCRoleBinding=true, the
role binding lists each ServiceAccount (including the sets' ones) exactly once, all of them exist in the namespace, and the unit tests
cover the enableDefault/custom ServiceAccount combinations.
Could someone with access to an OpenShift cluster check that the Dag processor pods of the sets are admitted and start under the anyuid
SCC?


Generated-by: Claude Code (Sonnet 5.5);

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for taking this over and for the end-to-end recording. The design follows workers.celery.sets closely, and the tests cover the earlier review rounds well. Two things need work before this can go in: a sets-only deployment never deactivates a removed bundle (inline), and the set-expansion logic is copied into four templates and needs to move into one shared helper (below). The rest are smaller edge cases. stegololz's three threads look handled by 24fa057. Please resolve them or reply once stegololz confirms, especially the NOTES.txt warning versus a hard failure for a bundle shared by two sets.

Quality signals to check (chart/templates/dag-processor/dag-processor-deployment.yaml:42)

Document the removed-bundle limitation of sets-only deployments, or address it in core.

Flagged by both the primary and adversarial reviewers.

Code quality (chart/templates/dag-processor/)

Please de-duplicate: move the set expansion, the enableDefault derivation and the set validation into one _helpers.yaml helper, and use it from the Deployment, PDB, ServiceAccount, SCC RoleBinding and NOTES.txt. Today the block is copied four times (plus a fifth variant in NOTES.txt), and several findings in this review come from those copies already disagreeing. One helper keeps them consistent and gives triggerer.sets a base to reuse instead of a sixth copy.

Smaller observations

  • See inline comments on chart/templates/dag-processor/dag-processor-poddisruptionbudget.yaml:69, chart/templates/dag-processor/dag-processor-deployment.yaml:110, chart/templates/dag-processor/dag-processor-deployment.yaml:42, chart/templates/dag-processor/dag-processor-deployment.yaml:112, chart/templates/NOTES.txt:156, chart/templates/dag-processor/dag-processor-deployment.yaml:78, chart/values.yaml:2196, chart/values.yaml:2153.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Airflow maintainer. The findings
below are observations, not blockers; an Apache Airflow
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.

More on how Apache Airflow handles maintainer review:
Contributing guide.

{{- end -}}
{{- $enableDefault := .Values.dagProcessor.enableDefault -}}
{{- if kindIs "invalid" $enableDefault -}}
{{- $enableDefault = not .Values.dagProcessor.sets -}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When sets is non-empty, enableDefault now defaults to false, so a typical "one set per bundle" setup has no Dag processor running without --bundle-name. In core, DagFileProcessorManager.sync_bundles calls sync_bundles_to_db(deactivate_missing=not self.bundle_names_to_parse) (airflow-core/src/airflow/dag_processing/manager.py:334), so every set-scoped processor skips deactivating bundles that were removed from dagBundleConfigList. If a bundle and its set are later removed, the bundle is never marked inactive, deactivate_stale_dags never takes its "bundle no longer active" branch, and nothing parses those files any more, so their Dags stay active in the UI. Please document this in manage-dag-files.rst (and say how to clean up, e.g. a one-off run or temporarily enabling the default processor), or cover it on the core side.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Documented in a new "Removing a Dag bundle" section of manage-dag-files.rst. After removing a
bundle and its set, run airflow dags reserialize --bundle-name <bundle> once in the
dag-processor container of a remaining set. It calls sync_bundles_to_db() with the full
config, so bundles that are no longer configured are marked inactive. The alternative is to set
enableDefault: true until the Dags are gone. The scheduler then marks the Dags stale
(cleanup_processor_metadata, every scheduler.parsing_cleanup_interval).

Checked on kind (sets-only, set-a → bundle_a, set-b → bundle_b,
parsing_cleanup_interval: 30):

Step dag_bundle.active (a / b) is_stale (a / b)
Before t / t f / f
90s after removing bundle_b and set-b t / t f / f
After reserialize --bundle-name bundle_a (exit 0) t / f f / f
90s later t / f f / t

The scheduler logged Deactivating Dag because its bundle is no longer active bundle_name=bundle_b.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

dag-processor-set: {{ .Values.dagProcessor.name }}
{{- end }}
{{- if and (eq .Values.dagProcessor.name "default") $setsWithPdb }}
matchExpressions:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NotIn only excludes sets that have their own PDB. A set with podDisruptionBudget.enabled: false is still selected by the default PDB, so its Pods count toward the default Deployment's maxUnavailable / minAvailable. An unhealthy opt-out Pod can then block node drains of healthy default Pods, which is the opposite of what the set asked for and differs from the docs ("A PodDisruptionBudget selects the Pods of a single Deployment"). When sets is non-empty, key: dag-processor-set, operator: DoesNotExist would keep the default PDB to its own Pods, and the selector stays unchanged when there are no sets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done: when sets is not empty, the default PDB uses dag-processor-set DoesNotExist. The
selector is unchanged without sets. On kind with enableDefault: true and set-b opting out, the
default, set-a and set-b Pods all ran. The default PDB and set-a's PDB each reported
expectedPods: 1, and set-b had no PDB, so no PDB counts the set-b Pod.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

component: dag-processor
release: {{ .Release.Name }}
{{- if ne .Values.dagProcessor.name "default" }}
dag-processor-set: {{ .Values.dagProcessor.name }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The set name is written unquoted into the label. A name such as 123 passes the DNS-1123 check but renders dag-processor-set: 123, a YAML integer, and the API server rejects it because label values must be strings (checked with helm template). The same applies at L122 and in the PDB selector. {{ .Values.dagProcessor.name | quote }} fixes all three.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Quoted in the Deployment selector, the Pod labels and the PDB selector. A set named 123 renders
dag-processor-set: "123", and the Deployment was accepted and ran on kind.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

{{- end -}}
{{- $enableDefault := .Values.dagProcessor.enableDefault -}}
{{- if kindIs "invalid" $enableDefault -}}
{{- $enableDefault = not .Values.dagProcessor.sets -}}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

With enableDefault: false and sets: [], nothing is rendered and there is no error, while dagProcessor.enabled: true still makes the scheduler skip its Dag mounts. A render-time fail for this case would catch the misconfiguration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This now fails at render time: "dagProcessor.enableDefault is false and dagProcessor.sets is
empty, so no Dag processor would run; …".


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

{{- if ne .Values.dagProcessor.name "default" }}
dag-processor-set: {{ .Values.dagProcessor.name }}
{{- end }}
{{- if .Values.dagProcessor.strategy }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

strategy is not in the workersMergeValues full-overwrite list, so it is deep-merged. A set with strategy: {type: Recreate} renders type: Recreate together with the inherited rollingUpdate block (checked with helm template), which the API server rejects. Either document that a set must also set rollingUpdate: null, or overwrite strategy as a whole for sets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A set's strategy now replaces the parent's as a whole, which is documented. On kind, a set with
strategy: {type: Recreate} renders {"type":"Recreate"} and is accepted.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

Comment thread chart/templates/NOTES.txt Outdated

{{- $bundleClaims := dict }}
{{- if .Values.dagProcessor.enabled }}
{{- range .Values.dagProcessor.sets | default list }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The overlap warning only compares raw sets[*].bundleNames. It says nothing for the default processor running next to sets with no bundleNames (the double-parse case the PR description calls out), for sets inheriting the parent bundleNames, or for a set with no bundleNames (which parses everything). It also reports a single set that repeats a bundle as (a, a). Building it from the merged values would cover these cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The warning is now built from the merged values of every Dag processor (dagProcessor.bundleOverlaps).
It covers the default processor next to sets, sets that inherit the parent bundleNames, and sets
without bundleNames (which parse every bundle), and it de-duplicates a bundle repeated in one set.
Since helm template does not render NOTES.txt, the helper is tested through a copy of the chart.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

{{- if not (has . $definedBundles) }}
{{- fail (printf "Bundle %q is not defined in `dagProcessor.dagBundleConfigList`" .) }}
{{- end }}
{{- if not (regexMatch (printf "--bundle-name(=|\\s+(-\\s+)?)['\"]*%s['\"]*(\\s|$)" (regexQuoteMeta .)) $renderedArgs) }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The args check only accepts --bundle-name. The CLI also accepts -B (airflow-core/src/airflow/cli/cli_config.py:162), and the check doesn't look at a custom command used with args: ~. Such valid setups fail to render.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

-B is accepted now (-B x, -Bx, -B=x), and the check looks at command together with
args, so command: [bash, -c, "exec airflow dag-processor -B x"] with args: ~ renders.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

Comment thread chart/values.yaml Outdated
args:
- "bash"
- "-c"
- "exec airflow dag-processor{{ range .Values.dagProcessor.bundleNames }} --bundle-name {{ . | squote }}{{ end }}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

squote doesn't escape an embedded ', so a bundle name with an apostrophe breaks the bash -c command. Bundle names are not restricted in core. Either check bundle names against a safe character set in the chart, or pass the flags as separate argv items.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The default args now take the flags from a helper that quotes each name for a POSIX shell
(' → '\''). On kind, a bundle named it's_c started and was parsed with
--bundle-name 'it'\''s_c'. Outside the chart: core rejects such a name for some metric names
(InvalidStatsNameException in the Dag processor log), but parsing and serialization still work.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

Comment thread chart/values.yaml Outdated
# unless `bundleNames` is set, so bundles selected by a set would then be parsed twice.
enableDefault: ~

# Names of the bundles from `dagBundleConfigList` this dag processor parses

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"If empty, the dag processor parses all the bundles" isn't true for a set when the parent sets bundleNames: workersMergeValues ignores an empty-list override, so bundleNames: [] on a set inherits the parent's list. Worth saying so here and in the docs. Also, new text in values.yaml and values.schema.json says "dag processor"; the project writes it as "Dag processor".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Documented in values.yaml, the schema and the docs: a set inherits the parent bundleNames when
it does not set them or sets an empty list. The new text now says "Dag processor".


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

The set expansion, enableDefault derivation and validation were copied
into five templates, and the copies had already started to disagree.
Review also found setups that rendered but could not run as intended: a
set without its own PodDisruptionBudget still counted toward the
default one, numeric set names produced non-string labels, a set's
Recreate strategy inherited rollingUpdate, bundle names with quotes
broke the shell command, valid -B or command-only selections were
rejected, and no Dag processor at all was accepted silently. The
overlap warning missed the default processor and inherited
bundleNames, and sets-only deployments never deactivate removed
bundles, which users need to know how to clean up.

Generated-by: Claude Code
The scheduler, not the Dag processors, marks the Dags of an inactive
bundle as stale, and sets replace lists and several settings as a whole
rather than merging every key, so the docs sent users to the wrong
place and described overrides that do not happen.

Generated-by: Claude Code
The docs build rejects the word used to describe what the reserialize
command does to the remaining bundle.

Generated-by: Claude Code
@xchwan

xchwan commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Everything is addressed in a2aa205, f875273 and 7fd63d8. The branch also
merges current main.

  • De-duplication: the set expansion, the enableDefault derivation and all set validation
    live in one helper, dagProcessor.expandSets in _helpers.yaml. The Deployment, PDB,
    ServiceAccount, SCC RoleBinding and NOTES.txt all use it, so triggerer.sets can reuse it.
  • Default output: with sets: [], the rendered Dag processor Deployment, ServiceAccount, PDB and
    SCC RoleBinding are the same objects as on main.
  • Tests: test_dag_processor_sets.py and test_scc_rolebinding.py pass (152), and the full
    chart suite passes (2381).
  • kind (Kubernetes v1.31.12): checked sets-only with one set per bundle, the default processor
    next to sets with PDBs, Recreate, a numeric set name, an apostrophe in a bundle
    name, the NOTES warning, render-time failures, Dags from both bundles running to success, and the
    removed-bundle cleanup above. Every Pod had 0 restarts, with one exception below.

One core issue showed up on a fresh database. When several set processors start at the same time,
they all insert the configured bundles into dag_bundle. The losers fail on dag_bundle_pkey, and
that processor restarts once before it settles. This is not specific to the chart (any
multi-processor setup that starts together hits it), so I would open a separate core issue rather
than handle it here.


Drafted-by: Claude Code (Opus 5.5); reviewed by xchwan before posting

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: Per-Bundle DAG Processor Deployments in Helm Chart

5 participants