From 8d502f8cf5a91a24f77fec1530c7b2a80123a891 Mon Sep 17 00:00:00 2001 From: dawang Date: Thu, 12 Mar 2026 19:11:50 +0800 Subject: [PATCH 1/2] HYPERFLEET-707 - doc: update adapter configs to add time-based precondition for resource deletion recovery --- helm/adapter1/adapter-task-config.yaml | 26 ++++++++++++++++---------- helm/adapter3/adapter-task-config.yaml | 26 ++++++++++++++++---------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/helm/adapter1/adapter-task-config.yaml b/helm/adapter1/adapter-task-config.yaml index be9e619..ac348a1 100644 --- a/helm/adapter1/adapter-task-config.yaml +++ b/helm/adapter1/adapter-task-config.yaml @@ -25,6 +25,12 @@ spec: source: "env.NAMESPACE" type: "string" + - name: "TTL_EXPIRY_THRESHOLD" + source: "env.TTL_EXPIRY_THRESHOLD" + type: "int" + required: false + default: 300 + # Preconditions with valid operators and CEL expressions preconditions: - name: "clusterStatus" @@ -39,21 +45,21 @@ spec: field: "name" - name: "generation" field: "generation" - - name: "readyConditionStatus" + - name: "readyCondition" expression: | status.conditions.filter(c, c.type == "Ready").size() > 0 - ? status.conditions.filter(c, c.type == "Ready")[0].status - : "False" - # Structured conditions with valid operators - conditions: - - field: "readyConditionStatus" - operator: "equals" - value: "False" + ? status.conditions.filter(c, c.type == "Ready")[0] + : null + # Capture current time as a fixed timestamp for consistent time comparisons + # Using `now()` directly in multiple expressions would return different values + - name: "currentTime" + expression: "now()" - name: "validationCheck" - # Valid CEL expression + # Precondition passes if cluster is NOT Ready OR if cluster is Ready and stable for >TTL_EXPIRY_THRESHOLD seconds since last transition (enables self-healing) expression: | - readyConditionStatus == "False" + readyCondition == null || readyCondition.status != "True" || + (timestamp(currentTime) - timestamp(readyCondition.last_transition_time)).getSeconds() >= TTL_EXPIRY_THRESHOLD # Resources with valid K8s manifests resources: diff --git a/helm/adapter3/adapter-task-config.yaml b/helm/adapter3/adapter-task-config.yaml index 9746668..02532e8 100644 --- a/helm/adapter3/adapter-task-config.yaml +++ b/helm/adapter3/adapter-task-config.yaml @@ -30,6 +30,12 @@ spec: source: "env.NAMESPACE" type: "string" + - name: "TTL_EXPIRY_THRESHOLD" + source: "env.TTL_EXPIRY_THRESHOLD" + type: "int" + required: false + default: 300 + # Preconditions with valid operators and CEL expressions preconditions: - name: "nodepoolStatus" @@ -44,21 +50,21 @@ spec: field: "name" - name: "generation" field: "generation" - - name: "readyConditionStatus" + - name: "readyCondition" expression: | status.conditions.filter(c, c.type == "Ready").size() > 0 - ? status.conditions.filter(c, c.type == "Ready")[0].status - : "False" - # Structured conditions with valid operators - conditions: - - field: "readyConditionStatus" - operator: "equals" - value: "False" + ? status.conditions.filter(c, c.type == "Ready")[0] + : null + # Capture current time as a fixed timestamp for consistent time comparisons + # Using `now()` directly in multiple expressions would return different values + - name: "currentTime" + expression: "now()" - name: "validationCheck" - # Valid CEL expression + # Precondition passes if cluster is NOT Ready OR if cluster is Ready and stable for >TTL_EXPIRY_THRESHOLD seconds since last transition (enables self-healing) expression: | - readyConditionStatus == "False" + readyCondition == null || readyCondition.status != "True" || + (timestamp(currentTime) - timestamp(readyCondition.last_transition_time)).getSeconds() >= TTL_EXPIRY_THRESHOLD # Resources with valid K8s manifests resources: From 04cff6b2c133645b27c65dd9c15a74a58d9bdbb3 Mon Sep 17 00:00:00 2001 From: dawang Date: Fri, 13 Mar 2026 19:55:05 +0800 Subject: [PATCH 2/2] HYPERFLEET-707 - doc: update time-based precondition of adapter configs for more readable --- helm/adapter1/adapter-task-config.yaml | 28 +++++++++++--------------- helm/adapter3/adapter-task-config.yaml | 28 +++++++++++--------------- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/helm/adapter1/adapter-task-config.yaml b/helm/adapter1/adapter-task-config.yaml index ac348a1..15c8595 100644 --- a/helm/adapter1/adapter-task-config.yaml +++ b/helm/adapter1/adapter-task-config.yaml @@ -25,12 +25,6 @@ spec: source: "env.NAMESPACE" type: "string" - - name: "TTL_EXPIRY_THRESHOLD" - source: "env.TTL_EXPIRY_THRESHOLD" - type: "int" - required: false - default: 300 - # Preconditions with valid operators and CEL expressions preconditions: - name: "clusterStatus" @@ -45,21 +39,23 @@ spec: field: "name" - name: "generation" field: "generation" - - name: "readyCondition" + - name: "clusterNotReady" expression: | status.conditions.filter(c, c.type == "Ready").size() > 0 - ? status.conditions.filter(c, c.type == "Ready")[0] - : null - # Capture current time as a fixed timestamp for consistent time comparisons - # Using `now()` directly in multiple expressions would return different values - - name: "currentTime" - expression: "now()" + ? status.conditions.filter(c, c.type == "Ready")[0].status != "True" + : true + - name: "clusterReadyTTL" + expression: | + (timestamp(now()) - timestamp( + status.conditions.filter(c, c.type == "Ready").size() > 0 + ? status.conditions.filter(c, c.type == "Ready")[0].last_transition_time + : now() + )).getSeconds() >= 300 - name: "validationCheck" - # Precondition passes if cluster is NOT Ready OR if cluster is Ready and stable for >TTL_EXPIRY_THRESHOLD seconds since last transition (enables self-healing) + # Precondition passes if cluster is NOT Ready OR if cluster is Ready and stable for >300 seconds since last transition (enables self-healing) expression: | - readyCondition == null || readyCondition.status != "True" || - (timestamp(currentTime) - timestamp(readyCondition.last_transition_time)).getSeconds() >= TTL_EXPIRY_THRESHOLD + clusterNotReady || clusterReadyTTL # Resources with valid K8s manifests resources: diff --git a/helm/adapter3/adapter-task-config.yaml b/helm/adapter3/adapter-task-config.yaml index 02532e8..dd59054 100644 --- a/helm/adapter3/adapter-task-config.yaml +++ b/helm/adapter3/adapter-task-config.yaml @@ -30,12 +30,6 @@ spec: source: "env.NAMESPACE" type: "string" - - name: "TTL_EXPIRY_THRESHOLD" - source: "env.TTL_EXPIRY_THRESHOLD" - type: "int" - required: false - default: 300 - # Preconditions with valid operators and CEL expressions preconditions: - name: "nodepoolStatus" @@ -50,21 +44,23 @@ spec: field: "name" - name: "generation" field: "generation" - - name: "readyCondition" + - name: "nodepoolNotReady" expression: | status.conditions.filter(c, c.type == "Ready").size() > 0 - ? status.conditions.filter(c, c.type == "Ready")[0] - : null - # Capture current time as a fixed timestamp for consistent time comparisons - # Using `now()` directly in multiple expressions would return different values - - name: "currentTime" - expression: "now()" + ? status.conditions.filter(c, c.type == "Ready")[0].status != "True" + : true + - name: "nodepoolReadyTTL" + expression: | + (timestamp(now()) - timestamp( + status.conditions.filter(c, c.type == "Ready").size() > 0 + ? status.conditions.filter(c, c.type == "Ready")[0].last_transition_time + : now() + )).getSeconds() >= 300 - name: "validationCheck" - # Precondition passes if cluster is NOT Ready OR if cluster is Ready and stable for >TTL_EXPIRY_THRESHOLD seconds since last transition (enables self-healing) + # Precondition passes if nodepool is NOT Ready OR if nodepool is Ready and stable for >300 seconds since last transition (enables self-healing) expression: | - readyCondition == null || readyCondition.status != "True" || - (timestamp(currentTime) - timestamp(readyCondition.last_transition_time)).getSeconds() >= TTL_EXPIRY_THRESHOLD + nodepoolNotReady || nodepoolReadyTTL # Resources with valid K8s manifests resources: