Repository navigation
Conversation
vincbeck
left a comment
There was a problem hiding this comment.
One comment on the system test but otherwise I like it!
| # Airflow 2 path | ||
| from airflow.decorators import task # type: ignore[attr-defined,no-redef] | ||
|
|
||
| with DAG( |
There was a problem hiding this comment.
Please check the Amazon provider package standards to write the system test: https://github.com/apache/airflow/tree/main/providers/amazon/tests/system/amazon. You can also look at other examples from the Amazon provider package.
There was a problem hiding this comment.
@vincbeck
Thanks for the review! I've reworked the system test to follow the Amazon provider conventions — it now uses SystemTestContextBuilder for the env id, creates and tears down its own cluster/nodegroup, and adds the watcher() + get_test_run() wiring, mirroring example_eks_with_nodegroups.py. Appreciate the pointer to the standards.
233f248 to
c120f31
Compare
|
CI is failing |
c120f31 to
d1be3dc
Compare
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.
d1be3dc to
e4b17e3
Compare
|
This has been approved and green for a while now — just a gentle nudge in case it slipped off the radar. Happy to rebase if anything's needed; otherwise it should be ready to merge whenever it fits. Thanks! |
| how-to-guide: /docs/apache-airflow-providers-amazon/transfer/s3_to_dynamodb.rst | ||
| python-module: airflow.providers.amazon.aws.transfers.s3_to_dynamodb | ||
|
|
||
| task-decorators: |
There was a problem hiding this comment.
As a new decorator is defined, should we update task-sdk/src/airflow/sdk/definitions/decorators/__init__.pyi as well?
I've opened a PR to close #48448 by adding static checks to all existed decorators to make sure the parameter list they accept match to the operator. Not sure if it would impact this.
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