Add @task.eks_pod TaskFlow decorator for EksPodOperator - #72033
Open
Leondon9 wants to merge 1 commit into
Open
Conversation
The TaskFlow route to EKS today is @task.kubernetes with a connection whose kubeconfig carries an `aws eks get-token` exec plugin. The token is then minted by an exec subprocess on the worker, so the worker must ship the AWS CLI and credentials. This decorator wraps EksPodOperator instead, which builds the kubeconfig and short-lived token from the AWS connection (aws_conn_id) over boto3/STS, so the worker needs neither the CLI nor a pre-built kubeconfig. The script-injection logic is kept self-contained rather than shared with the @task.kubernetes implementation in the cncf provider, to avoid a cross-provider private import; a shared helper can follow later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
@task.eks_podTaskFlow decorator that runs a Python function in a pod on an Amazon EKS cluster. It wrapsEksPodOperator, so the cluster kubeconfig and short-lived token come from the AWS connection (aws_conn_id) and the worker needs noawsCLI or kubeconfig.Motivation
The usual way to run a Python function on EKS in the TaskFlow style is
@task.kubernetesagainst a kubeconfig whose user authenticates with anaws eks get-tokenexec plugin. However that kubeconfig is supplied — a Kubernetes connection (kube_config), a file on the worker (kube_config_path/config_file), or the worker's default~/.kube/config— the token is minted by anawssubprocess when the config is loaded. That has two real costs:awsCLI, purely for auth; andaws_conn_idalready used by every other AWS operator, so EKS auth ends up configured in two places.(If Airflow runs inside the target EKS cluster, in-cluster auth avoids the exec plugin; this addresses the common case where it does not — a different or external cluster.)
@task.eks_podwrapsEksPodOperator, which builds the kubeconfig and a short-lived token from the AWS connection over boto3/STS. EKS then authenticates the same way as the rest of the Amazon provider, and the worker needs noawsCLI and no separately provisioned kubeconfig or credentials.Before (
@task.kubernetes; the worker authenticates via anaws eks get-tokenkubeconfig + theawsCLI):After (
@task.eks_pod, authenticating through the AWS connection):Note
The script-injection logic is kept self-contained here rather than shared with the
@task.kubernetesimplementation in the cncf provider, to avoid a cross-provider private import. Factoring out a shared helper can be a follow-up.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines