You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by vi...@apache.org on 2026/09/11 15:35:30 UTC

(airflow) branch main updated: Wait for the EKS cluster to be stable before deleting Fargate profiles (#72957)

This is an automated email from the ASF dual-hosted git repository.

vincbeck pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 2309d05a24c Wait for the EKS cluster to be stable before deleting Fargate profiles (#72957)
2309d05a24c is described below

commit 2309d05a24ca91baf333899afc0cfdb7f5ac67c4
Author: Vincent <97...@users.noreply.github.com>
AuthorDate: Fri Sep 11 11:35:22 2026 -0400

    Wait for the EKS cluster to be stable before deleting Fargate profiles (#72957)
    
    The EKS Fargate system tests deleted the Fargate profile as soon as the profile
    itself reported ACTIVE, but the cluster can still have an update in progress at
    that point. EKS then rejects DeleteFargateProfile with ResourceInUseException,
    and the operator's bounded retry window is not always long enough to ride it
    out, so the teardown fails and leaks the cluster.
---
 .../system/amazon/aws/example_eks_with_fargate_in_one_step.py  | 10 ++++++++++
 .../system/amazon/aws/example_eks_with_fargate_profile.py      | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_in_one_step.py b/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_in_one_step.py
index 44a8df57e54..894539c0ac6 100644
--- a/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_in_one_step.py
+++ b/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_in_one_step.py
@@ -123,6 +123,15 @@ with DAG(
         target_state=FargateProfileStates.ACTIVE,
     )
 
+    # The cluster can still report an update in progress after the fargate profile turns ACTIVE, and EKS
+    # rejects the DeleteFargateProfile call below with ResourceInUseException while that update runs.
+    await_cluster_stable = EksClusterStateSensor(
+        task_id="await_cluster_stable",
+        trigger_rule=TriggerRule.ALL_DONE,
+        cluster_name=cluster_name,
+        target_state=ClusterStates.ACTIVE,
+    )
+
     # An Amazon EKS cluster can not be deleted with attached resources such as nodegroups or Fargate profiles.
     # Setting the `force` to `True` will delete any attached resources before deleting the cluster.
     delete_cluster_and_fargate_profile = EksDeleteClusterOperator(
@@ -150,6 +159,7 @@ with DAG(
         # TEST TEARDOWN
         describe_pod,
         await_fargate_profile_stable,
+        await_cluster_stable,
         delete_cluster_and_fargate_profile,
         await_delete_cluster,
     )
diff --git a/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_profile.py b/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_profile.py
index 1da5b9c8e01..96ba6ba8c50 100644
--- a/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_profile.py
+++ b/providers/amazon/tests/system/amazon/aws/example_eks_with_fargate_profile.py
@@ -139,6 +139,15 @@ with DAG(
         target_state=FargateProfileStates.ACTIVE,
     )
 
+    # The cluster can still report an update in progress after the fargate profile turns ACTIVE, and EKS
+    # rejects DeleteFargateProfile with ResourceInUseException while that update runs.
+    await_cluster_stable_before_profile_delete = EksClusterStateSensor(
+        task_id="await_cluster_stable_before_profile_delete",
+        trigger_rule=TriggerRule.ALL_DONE,
+        cluster_name=cluster_name,
+        target_state=ClusterStates.ACTIVE,
+    )
+
     # [START howto_operator_eks_delete_fargate_profile]
     delete_fargate_profile = EksDeleteFargateProfileOperator(
         task_id="delete_eks_fargate_profile",
@@ -190,6 +199,7 @@ with DAG(
         # TEARDOWN
         describe_pod,
         await_fargate_profile_stable,
+        await_cluster_stable_before_profile_delete,
         delete_fargate_profile,  # part of the test AND teardown
         await_delete_fargate_profile,
         await_cluster_stable,