Skip to content

Decide pod_template and image based on Coordinator for lang-SDK tasks on KubernetesExecutor#68713

Merged
jason810496 merged 4 commits into
apache:mainfrom
jason810496:feature/lang-sdk/k8s-coordinator-pod-template-file
Jun 29, 2026
Merged

Decide pod_template and image based on Coordinator for lang-SDK tasks on KubernetesExecutor#68713
jason810496 merged 4 commits into
apache:mainfrom
jason810496:feature/lang-sdk/k8s-coordinator-pod-template-file

Conversation

@jason810496

@jason810496 jason810496 commented Jun 18, 2026

Copy link
Copy Markdown
Member

Why

A queue routed to a non-Python coordinator ([sdk] queue_to_coordinator) needs a worker pod whose image carries that runtime (e.g. the JVM for a Java coordinator), but the KubernetesExecutor had no way to pick a coordinator-specific pod template or base image short of setting executor_config on every task.

What

  • Add KubernetesExecutor._coordinator_pod_template_file (reads pod_template_file from extra, import-guarded for 3.3+) and apply it with precedence over executor_config in execute_async.
    • pod_template_file -- applied with precedence over per-task executor_config (a queue's coordinator carries the runtime requirement, so it must win). Python queues resolve to None and are unaffected.
    • worker_container_repository + worker_container_tag -- compose a per-queue base image (both required), since the base image is never carried by a pod template. Plumbed through KubernetesJob.kube_image to the pod request.
  • A malformed [sdk] config is logged and ignored rather than crashing the scheduler.

Example Config to support Lang-SDK feature with KubernetesExecutor

AIRFLOW__SDK__COORDINATORS:

{
  "jdk-11": {
    "classpath": "airflow.sdk.coordinators.java.JavaCoordinator",
    "kwargs": {"java_executable": "/usr/lib/jvm/java-11-openjdk/bin/java", "jvm_args": ["-Xmx1024m"]},
    "extra": {
        "pod_template_file": "/opt/airflow/pod_templates/java.yaml",
        "worker_container_repository": "myrepo/airflow-java",
        "worker_container_tag": "2.3.0"
    }
  },
  "jdk-17": {
    "classpath": "airflow.sdk.coordinators.java.JavaCoordinator",
    "kwargs": {"java_executable": "/usr/lib/jvm/java-17-openjdk/bin/java", "jvm_args": ["-Xmx512m"]},
    "extra": {
        "pod_template_file": "/opt/airflow/pod_templates/java.yaml",
        "worker_container_repository": "myrepo/airflow-java",
        "worker_container_tag": "3.3.0"
    }
  }
}

Next


Was generative AI tooling used to co-author this PR?

@jason810496 jason810496 changed the title Route lang-SDK coordinator tasks to a per-queue pod template on KubernetesExecutor Decide pod_template and image based on Coordinator for lang-SDK tasks on KubernetesExecutor Jun 18, 2026
@jason810496 jason810496 force-pushed the feature/lang-sdk/k8s-coordinator-pod-template-file branch from 155e90c to 01e1017 Compare June 19, 2026 05:03
@jason810496 jason810496 self-assigned this Jun 19, 2026
@jason810496 jason810496 marked this pull request as ready for review June 19, 2026 05:06
@jason810496 jason810496 force-pushed the feature/lang-sdk/k8s-coordinator-pod-template-file branch from 01e1017 to 25fd6bd Compare June 25, 2026 07:36
…netesExecutor

Add an optional pod_template_file to each [sdk] coordinators entry so a queue
routed to a non-Python coordinator launches its worker pod from a
coordinator-specific template (e.g. an image bundling the JVM for a Java
coordinator). The KubernetesExecutor resolves the template by queue when the
task's executor_config does not set one; a per-task executor_config template
still wins.
@jason810496 jason810496 force-pushed the feature/lang-sdk/k8s-coordinator-pod-template-file branch from 25fd6bd to 5fd63dd Compare June 29, 2026 06:46
@jason810496 jason810496 requested a review from uranusjr June 29, 2026 08:52

@uranusjr uranusjr 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.

A couple of minor coding style suggestions. LGTM

Make the coordinator pod-template resolution easier to read: a plain
dict.get without a redundant None default, and a separate assignment
instead of a walrus that wraps across three lines.
@jason810496 jason810496 merged commit 512a044 into apache:main Jun 29, 2026
102 checks passed
karenbraganz pushed a commit to karenbraganz/airflow that referenced this pull request Jun 30, 2026
jason810496 added a commit that referenced this pull request Jul 7, 2026
… on KubernetesExecutor (#68713) (#69536)

Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants