-
Notifications
You must be signed in to change notification settings - Fork 9
HYPERFLEET-707 - doc: update adapter configs to add time-based stability precondition #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,21 +44,23 @@ spec: | |
| field: "name" | ||
| - name: "generation" | ||
| field: "generation" | ||
| - name: "readyConditionStatus" | ||
| - name: "nodepoolNotReady" | ||
| 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].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 | ||
|
Comment on lines
+47
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle missing readiness fields defensively to prevent CEL runtime failures. Line 49 and Line 55 assume Suggested hardening - name: "nodepoolNotReady"
expression: |
- status.conditions.filter(c, c.type == "Ready").size() > 0
- ? status.conditions.filter(c, c.type == "Ready")[0].status != "True"
+ status.?conditions.orValue([]).filter(c, c.type == "Ready").size() > 0
+ ? status.?conditions.orValue([]).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
+ status.?conditions.orValue([]).filter(c, c.type == "Ready").size() > 0 &&
+ has(status.?conditions.orValue([]).filter(c, c.type == "Ready")[0].last_transition_time)
+ ? status.?conditions.orValue([]).filter(c, c.type == "Ready")[0].last_transition_time
: now()
)).getSeconds() >= 300As per coding guidelines, 🤖 Prompt for AI Agents |
||
|
|
||
| - name: "validationCheck" | ||
| # Valid CEL expression | ||
| # Precondition passes if nodepool is NOT Ready OR if nodepool is Ready and stable for >300 seconds since last transition (enables self-healing) | ||
| expression: | | ||
| readyConditionStatus == "False" | ||
| nodepoolNotReady || nodepoolReadyTTL | ||
|
|
||
| # Resources with valid K8s manifests | ||
| resources: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard
status.conditions/last_transition_timeaccess to avoid brittle preconditions.Line 44 and Line 50 assume
status.conditionsis always present, and Line 51 assumeslast_transition_timeexists. Partial API responses can make these expressions fail at runtime instead of cleanly falling back.Suggested hardening
- name: "clusterNotReady" expression: | - status.conditions.filter(c, c.type == "Ready").size() > 0 - ? status.conditions.filter(c, c.type == "Ready")[0].status != "True" + status.?conditions.orValue([]).filter(c, c.type == "Ready").size() > 0 + ? status.?conditions.orValue([]).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 + status.?conditions.orValue([]).filter(c, c.type == "Ready").size() > 0 && + has(status.?conditions.orValue([]).filter(c, c.type == "Ready")[0].last_transition_time) + ? status.?conditions.orValue([]).filter(c, c.type == "Ready")[0].last_transition_time : now() )).getSeconds() >= 300As per coding guidelines,
**: -Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.🤖 Prompt for AI Agents