Skip to content

Honor config_file in deferrable Kubernetes tasks - #72301

Closed
rjgoyln wants to merge 5 commits into
apache:mainfrom
rjgoyln:fix/async-k8s-hook-honor-config-file
Closed

rjgoyln wants to merge 5 commits into
apache:mainfrom
rjgoyln:fix/async-k8s-hook-honor-config-file

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

AsyncKubernetesHook stores config_file but never reads it, so a deferrable task pointed at an explicit kubeconfig still authenticates against whatever the default location resolves to, without warning. The two hooks inside one KubernetesJobTrigger therefore disagree — the sync pod manager reads the requested file, the async one does not. It is now coalesced ahead of the connection's kube_config_path, as the sync hook has always done.

With KUBECONFIG and config_file naming different clusters, the API server the hook ends up on:

before: https://default-cluster.invalid:6443
after:  https://requested-cluster.invalid:6443

Behavior change

config_file now counts towards the mutual-exclusion check, so combining it with in_cluster, kube_config or config_dict raises instead of being silently ignored.

Tests

test_load_config_with_several_params never reached the mutual-exclusion check — the connection lookup raised first and satisfied its bare AirflowException assertion.


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

AsyncKubernetesHook accepted config_file but never read it, so a
deferrable task configured with an explicit kubeconfig authenticated
against whatever the default location resolved to. Inside a single
KubernetesJobTrigger the two hooks disagreed: the sync pod manager used
the requested file while the async hook did not.

Resolving config_file the way the sync hook does also brings it into the
mutual-exclusion check, so combining it with in_cluster, kube_config or
config_dict now fails instead of silently picking one.
@boring-cyborg boring-cyborg Bot added area:providers kind:documentation provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Aug 30, 2026
Asserting on the hook's private cache flag only showed that a flag was
left unset; it never showed that the kubeconfig is re-read on the next
call, which is what a triggerer depends on when an exec plugin's token
expires part-way through a job. Awaiting the load twice pins that
directly and survives any change to how the caching is implemented.

The other test's name described how many arguments it passes instead of
what it checks.
@rjgoyln
rjgoyln marked this pull request as ready for review September 3, 2026 06:54
@potiuk

potiuk commented Sep 25, 2026

Copy link
Copy Markdown
Member

Hello @rjgoyln - thank you for your contributions to Apache Airflow!

The Airflow community has introduced a limit of 5 open pull requests at a time for contributors without write access to the repository. You currently have 24 open pull requests, so - as a one-time step of introducing the limit - we closed the ones where maintainers have not engaged yet:

These pull requests stay open because maintainers are already engaged in them - they count towards your limit:

This is not a judgement of you or of your changes. We never told contributors before that opening many pull requests at once was a problem, so there is nothing to feel bad about - and nothing is lost: your branches, commits and the review history stay where they are.

What we ask you to do is to make your first prioritization decision: choose which of the pull requests above matter most to you, and reopen them (up to 5 open at a time, including the ones still open) with the "Reopen pull request" button or gh pr reopen <PR_NUMBER> --repo apache/airflow. Reopen the ones you are ready to follow through - keep them rebased, respond to review comments and fix failing checks.

While your pull requests are waiting for review, the most valuable thing you can do is help in other ways - reviewing other contributors' pull requests, helping with issues, and taking part in the discussions on the devlist and Slack.

Why we introduced the limit, what it means for you and how to reopen or restore a pull request is explained in https://github.com/apache/airflow/blob/main/contributing-docs/32_open_pull_request_limit.rst.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

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

Labels

area:providers closed because of open PR limit Closed as a one-time step of introducing the open pull request limit kind:documentation provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants