Repository navigation
Add EKS operator for commands in existing Pods - #72542
AlejandroMorgante wants to merge 8 commits into
Conversation
e104f5c to
b43ca2b
Compare
|
@SameerMesiah97, could you please review this when you have a chance? This is the follow-up to #71244, adding the EKS integration for executing commands in existing Pods. Thank you! |
There was a problem hiding this comment.
There is one potential issue with the new operator. EksPodExecOperator inherits from KubernetesPodExecOperator, which was introduced in PR #72144 but has not yet been included in a released cncf-kubernetes provider version. This will raise the minimum cncf-kubernetes version considerably from 7.20.0, but since it is an optional dependency, the impact should be limited to users installing the Amazon provider’s cncf.kubernetes extra or otherwise using the EKS/Kubernetes integration.
The implementation itself looks relatively clean. I have left a few comments.
Edit: alternatively, we could explore conditional imports i.e try/excepct ImportError then implement the EksPodExecOperator if KubernetesPodExecOperator is successfully imported or maybe putting this new operator into its own module and version gate it there. However, this is atypical for providers so I can't approve that without the input of the AWS maintainers.
d1f9202 to
8f8b2fe
Compare
|
Thanks for raising this. I agree that the Amazon release must depend on the first
|
I think I may have been a bit too presumptuous in my previous comment. Since the Lets see what the AWS maintainers think. |
|
@vincbeck WDYT? |
o-nikolas
left a comment
There was a problem hiding this comment.
I'm not sure I'm in favour of bumping the minimum cncf version to bleeding edge. If users don't install with the amazon extra (apache-airflow-providers-amazon[cncf.kubernetes]) and instead are installing with (apache-airflow-providers-amazon, which won't bump their cncf version) or if they for some reason cannot upgrade cncf to the bleeding edge then all the operators in eks.py will fail to load due to the import failure of the cncf Excec operator.
You can actually see another different, but similar, workaround we put in to avoid bumping this floor previously:
I think @SameerMesiah97 instincts were right here, we should at least for a few releases have some error handling if that import fails.
Putting a request for changes for now to avoid merging this until we're decided.
I agree with Niko hee |
| command=command, | ||
| namespace=namespace, | ||
| container_name=container_name, | ||
| kubernetes_conn_id=None, |
There was a problem hiding this comment.
Does kubernetes_conn_id=None actually skip the connection lookup here? KubernetesHook.__init__ does self.conn_id = conn_id or kubernetes_conn_id, so I think None falls back to kubernetes_default. If that connection has kube_config or cluster_context set, get_conn would fail against the generated kubeconfig, and since the parameter is hardcoded there is no way to work around it. Would it make sense to either override hook to pass conn_id=None explicitly, or keep kubernetes_conn_id user-settable like EksPodOperator does?
There was a problem hiding this comment.
Done, we applied the same strategy used by EksPodOperator: kubernetes_conn_id is now configurable and templatable.
Allow Dags to execute commands in externally managed EKS Pods without making Airflow responsible for their lifecycle. Generated-by: Codex (GPT-5)
EKS kubeconfig authentication runs under sh and can receive log output before its credential data. Bash-only parsing caused both existing and exec Pod operations to reject otherwise valid credentials.
Accurate defaults and permission requirements help Dag authors configure the operator without granting unnecessary access or relying on ambiguous fallback behavior.
Make the operator contract easier to scan and protect the AWS-specific templating boundary identified during review.
Users of existing EKS operators should not need to upgrade the optional Kubernetes provider to adopt an Amazon provider release that adds Pod exec support. Generated-by: Codex (GPT-6)
8f8b2fe to
01e5862
Compare
Reusing an operator instance must not retain a Kubernetes client tied to a temporary kubeconfig that was deleted after the previous execution. Generated-by: Codex (GPT-6)
EKS Pod exec users need to select a separate Kubernetes connection when kubernetes_default contains settings that conflict with the generated EKS kubeconfig, as they can with EksPodOperator. Generated-by: Codex (GPT-6)
The compatibility fallback cannot be used as a standalone Amazon operator. The AST-based example checker otherwise treats it as a public operator even though the actual EKS Pod exec operator already has a system-test example. Generated-by: Codex (GPT-6)
| def __init__(self, **kwargs): | ||
| raise AirflowOptionalProviderFeatureException( | ||
| "EksPodExecOperator requires apache-airflow-providers-cncf-kubernetes>=10.22.0." | ||
| ) |
There was a problem hiding this comment.
I based this on the existing backward-compatible import fallback in the EKS module
The difference is that KubernetesPodExecOperator has no equivalent in older versions of the cncf-kubernetes provider. This fallback keeps existing EKS operators importable and only raises an error when someone tries to instantiate EksPodExecOperator without the required provider version.

Add
EksPodExecOperatorto execute commands in existing EKS Pods without managing their lifecycle. It reusesKubernetesPodExecOperatorfor execution and AWS credentials for authentication.Existing EKS operators retain compatibility with older Kubernetes providers; the new operator requires
cncf-kubernetes>=10.22.0. LikeEksPodOperator, it supports a configurable, templatablekubernetes_conn_id.Includes documentation, unit tests, and an EKS system test. The shell-portability fix was merged separately in #73690.
Validation of the current revision:
73 passed, including the missingpod_execimport regression test.10 passed, 1 xfailed(expected).Earlier live AWS validation completed the full system test: create the EKS cluster and nodegroup, create an externally managed Pod, execute and validate the command output, delete the Pod, and tear down the AWS resources (
1 passedin 15:37). This live test was not rerun for the import compatibility change.Was generative AI tooling used to co-author this PR?
Generated-by: Codex (GPT-5), Codex (GPT-6) following the guidelines