SameerMesiah97 commented on code in PR #72542:
URL: https://github.com/apache/airflow/pull/72542#discussion_r4178112089
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/eks.py:
##########
@@ -47,10 +47,28 @@
build_resource_in_use_retry_args,
validate_execute_complete_event,
)
-from airflow.providers.amazon.aws.utils.mixins import aws_template_fields
+from airflow.providers.amazon.aws.utils.mixins import AwsHookParams,
aws_template_fields
from airflow.providers.amazon.aws.utils.waiter_with_logging import wait
from airflow.providers.cncf.kubernetes.utils.pod_manager import OnFinishAction
-from airflow.providers.common.compat.sdk import AirflowException, conf
+from airflow.providers.common.compat.sdk import (
+ AirflowException,
+ AirflowOptionalProviderFeatureException,
+ BaseOperator,
+ conf,
+)
+
+try:
+ from airflow.providers.cncf.kubernetes.operators.pod_exec import
KubernetesPodExecOperator
+except ImportError:
+
+ class KubernetesPodExecOperator(BaseOperator): # type: ignore[no-redef]
+ """Keep existing EKS operators importable with older Kubernetes
providers."""
+
+ def __init__(self, **kwargs):
+ raise AirflowOptionalProviderFeatureException(
+ "EksPodExecOperator requires
apache-airflow-providers-cncf-kubernetes>=10.22.0."
+ )
Review Comment:
Sorry. I just saw that is just a few lines down in the existing file. My
mistake.
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/eks.py:
##########
@@ -47,10 +47,28 @@
build_resource_in_use_retry_args,
validate_execute_complete_event,
)
-from airflow.providers.amazon.aws.utils.mixins import aws_template_fields
+from airflow.providers.amazon.aws.utils.mixins import AwsHookParams,
aws_template_fields
from airflow.providers.amazon.aws.utils.waiter_with_logging import wait
from airflow.providers.cncf.kubernetes.utils.pod_manager import OnFinishAction
-from airflow.providers.common.compat.sdk import AirflowException, conf
+from airflow.providers.common.compat.sdk import (
+ AirflowException,
+ AirflowOptionalProviderFeatureException,
+ BaseOperator,
+ conf,
+)
+
+try:
+ from airflow.providers.cncf.kubernetes.operators.pod_exec import
KubernetesPodExecOperator
+except ImportError:
+
+ class KubernetesPodExecOperator(BaseOperator): # type: ignore[no-redef]
+ """Keep existing EKS operators importable with older Kubernetes
providers."""
+
+ def __init__(self, **kwargs):
+ raise AirflowOptionalProviderFeatureException(
+ "EksPodExecOperator requires
apache-airflow-providers-cncf-kubernetes>=10.22.0."
+ )
Review Comment:
@vincbeck @o-nikolas @ramitkataria
What are your thoughts on this workaround? I believe it should be fine as it
does not force users to update their cncf-kubernetes provider but I do not
recall ever seeing this pattern in providers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]