mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
docs(api): clarify health check parsing and evaluation (#4495)
## What this PR does Clarifies the lifecycle of HelmRelease CEL health checks. helm-controller parses and validates these expressions and creates a status reader factory before choosing how to wait. The factory constructs the concrete status reader when the selected wait path creates its resource manager. Invalid configuration can therefore stall the HelmRelease with reason InvalidCELExpression even when the release.cozystack.io/helm-install-disable-wait annotation is set or the legacy wait strategy is selected. Once setup succeeds, only helm-controller's poller evaluates expressions: while a Helm action waits under the poller strategy, and for Helm hooks, which are still waited on when the annotation disables wait. Without the annotation, the legacy strategy never evaluates them. With it, hooks are evaluated whatever the strategy, because disabling wait takes precedence. The monitoring template comment now also distinguishes an existing status object without `updateStatus` from a completely absent top-level `status` key. The former evaluates the predicates to false, while the latter can produce an evaluation error and an Unknown result. The poller continues waiting in both cases. The CEL expressions and runtime behavior are unchanged. The generated ApplicationDefinition CRD description was regenerated from the Go field documentation. Fixes #4388 ### Screenshots N/A — no UI changes. ### Downstream repositories - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note NONE ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Clarified when health-check expressions are validated and evaluated across wait strategies and Helm hooks, including how invalid expressions can affect Helm releases. * Explained how missing status fields affect health-check results and that polling continues until the resource is operational or times out. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
3 files changed
+31
-13
No files matched your search
@@ -120,10 +120,18 @@ type ApplicationDefinitionRelease struct {
|
||||
// kstatus rules instead.
|
||||
// A CR whose CRD is not installed fails the Helm action before any wait,
|
||||
// whatever these expressions say.
|
||||
// Upstream evaluates these only when the Helm action itself has wait
|
||||
// enabled, so the release.cozystack.io/helm-install-disable-wait annotation
|
||||
// makes them a silent no-op whatever waitStrategy says: the HelmRelease
|
||||
// reports Ready as soon as helm applies the CR, with no error or warning.
|
||||
// helm-controller parses and validates these expressions and creates a
|
||||
// status reader factory before choosing how to wait. The factory constructs
|
||||
// the concrete status reader when the selected wait path creates its
|
||||
// resource manager. Invalid configuration can
|
||||
// therefore stall the HelmRelease with reason InvalidCELExpression even when
|
||||
// the release.cozystack.io/helm-install-disable-wait annotation is set or the
|
||||
// legacy wait strategy is selected. Once setup succeeds, only helm-controller's
|
||||
// poller evaluates expressions: while a Helm action waits under the poller
|
||||
// strategy, and for Helm hooks, which are still waited on when the annotation
|
||||
// disables wait. Without the annotation, the legacy strategy never evaluates
|
||||
// them. With it, hooks are evaluated whatever the strategy, because disabling
|
||||
// wait takes precedence.
|
||||
// +optional
|
||||
HealthCheckExprs []kustomize.CustomHealthCheck `json:"healthCheckExprs,omitempty"`
|
||||
}
|
||||
|
||||
@@ -43,11 +43,13 @@ spec:
|
||||
an unexpected status can never be silently read as Ready. A paused or
|
||||
failed log store is not ingesting, so the release must not report Ready;
|
||||
cozystack never sets spec.paused on these VLClusters, so `paused` is not
|
||||
reachable in normal operation. Before the operator writes any updateStatus
|
||||
(fresh apply) all three predicates are false, so the poller holds the
|
||||
release not-ready until it becomes operational or hits `timeout:`, the
|
||||
real backstop. Matching by kind covers every logsStorages entry. (CEL
|
||||
evaluation is exercised live, not in helm-unittest, which cannot run it.)
|
||||
reachable in normal operation. If status exists but has no updateStatus,
|
||||
all three predicates evaluate to false. If the top-level status key is
|
||||
absent, `has(status.updateStatus)` can instead fail during evaluation and
|
||||
the status reader reports Unknown. The poller continues waiting in both
|
||||
cases until the resource becomes operational or hits `timeout:`, the real
|
||||
backstop. Matching by kind covers every logsStorages entry. (CEL evaluation
|
||||
is exercised live, not in helm-unittest, which cannot run it.)
|
||||
|
||||
The gate keys on a VLCluster existing, so an empty logsStorages would leave
|
||||
nothing to match. That configuration is rejected at render time by the
|
||||
|
||||
+12
-4
@@ -337,10 +337,18 @@ spec:
|
||||
kstatus rules instead.
|
||||
A CR whose CRD is not installed fails the Helm action before any wait,
|
||||
whatever these expressions say.
|
||||
Upstream evaluates these only when the Helm action itself has wait
|
||||
enabled, so the release.cozystack.io/helm-install-disable-wait annotation
|
||||
makes them a silent no-op whatever waitStrategy says: the HelmRelease
|
||||
reports Ready as soon as helm applies the CR, with no error or warning.
|
||||
helm-controller parses and validates these expressions and creates a
|
||||
status reader factory before choosing how to wait. The factory constructs
|
||||
the concrete status reader when the selected wait path creates its
|
||||
resource manager. Invalid configuration can
|
||||
therefore stall the HelmRelease with reason InvalidCELExpression even when
|
||||
the release.cozystack.io/helm-install-disable-wait annotation is set or the
|
||||
legacy wait strategy is selected. Once setup succeeds, only helm-controller's
|
||||
poller evaluates expressions: while a Helm action waits under the poller
|
||||
strategy, and for Helm hooks, which are still waited on when the annotation
|
||||
disables wait. Without the annotation, the legacy strategy never evaluates
|
||||
them. With it, hooks are evaluated whatever the strategy, because disabling
|
||||
wait takes precedence.
|
||||
items:
|
||||
description: CustomHealthCheck defines the health check for
|
||||
custom resources.
|
||||
|
||||
Reference in new issue
Block a user