mik-laj commented on a change in pull request #18645:
URL: https://github.com/apache/airflow/pull/18645#discussion_r719868589
##########
File path: airflow/providers/amazon/aws/operators/eks.py
##########
@@ -227,6 +284,78 @@ def execute(self, context):
)
+class EKSCreateFargateProfileOperator(BaseOperator):
+ """
+ Creates an AWS Fargate profile for an Amazon EKS cluster.
+
+ .. seealso::
+ For more information on how to use this operator, take a look at the
guide:
+ :ref:`howto/operator:EKSCreateFargateProfileOperator`
+
+ :param cluster_name: The name of the Amazon EKS cluster to apply the AWS
Fargate profile to. (templated)
+ :type cluster_name: str
+ :param pod_execution_role_arn: The Amazon Resource Name (ARN) of the pod
execution role to
+ use for pods that match the selectors in the AWS Fargate profile.
(templated)
+ :type pod_execution_role_arn: str
+ :param selectors: The selectors to match for pods to use this AWS Fargate
profile. (templated)
+ :type selectors: List
+ :param fargate_profile_name: The unique name to give your AWS Fargate
profile. (templated)
+ :type fargate_profile_name: str
+
+ :param aws_conn_id: The Airflow connection used for AWS credentials.
(templated)
+ If this is None or empty then the default boto3 behaviour is used. If
+ running Airflow in a distributed manner and aws_conn_id is None or
+ empty, then the default boto3 configuration would be used (and must be
+ maintained on each worker node).
+ :type aws_conn_id: str
+ :param region: Which AWS region the connection should use. (templated)
+ If this is None or empty then the default boto3 behaviour is used.
+ :type region: str
+ """
+
+ template_fields: Iterable[str] = (
+ "cluster_name",
+ "pod_execution_role_arn",
+ "selectors",
+ "fargate_profile_name",
+ "aws_conn_id",
+ "region",
+ )
+
+ def __init__(
+ self,
+ cluster_name: str,
+ pod_execution_role_arn: str,
+ selectors: List,
+ fargate_profile_name: Optional[str] = None,
+ aws_conn_id: str = DEFAULT_CONN_ID,
+ region: Optional[str] = None,
+ **kwargs,
+ ) -> None:
+ self.cluster_name = cluster_name
+ self.pod_execution_role_arn = pod_execution_role_arn
+ self.selectors = selectors
+ self.fargate_profile_name = (
+ fargate_profile_name or
f'{cluster_name}{datetime.now().strftime("%Y%m%d_%H%M%S")}'
Review comment:
Operator attributes should be static. Otherwise, the DAG will be
serialized multiple times to the database.
--
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]