Skip to content

Commit 73b939f

Browse files
committed
docs: Add dependency ready expression to API docs
Signed-off-by: Stefan Prodan <[email protected]>
1 parent b657bd8 commit 73b939f

File tree

1 file changed

+51
-4
lines changed

1 file changed

+51
-4
lines changed

docs/spec/v2/helmreleases.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,59 @@ spec:
396396
- name: backend
397397
```
398398

399-
**Note:** This does not account for upgrade ordering. Kubernetes only allows
400-
applying one resource (HelmRelease in this case) at a time, so there is no
401-
way for the controller to know when a dependency HelmRelease may be updated.
402-
Also, circular dependencies between HelmRelease resources must be avoided,
399+
**Note:** Circular dependencies between HelmRelease resources must be avoided,
403400
otherwise the interdependent HelmRelease resources will never be reconciled.
404401

402+
#### Dependency Ready Expression
403+
404+
`.spec.dependsOn[].readyExpr` is an optional field that can be used to define a CEL expression
405+
to determine the readiness of a HelmRelease dependency.
406+
407+
This is helpful for when custom logic is needed to determine if a dependency is ready.
408+
For example, when performing a lockstep upgrade, the `readyExpr` can be used to
409+
verify that a dependency has a matching version in values before proceeding with the
410+
reconciliation of the dependent HelmRelease.
411+
412+
```yaml
413+
apiVersion: helm.toolkit.fluxcd.io/v2
414+
kind: HelmRelease
415+
metadata:
416+
name: backend
417+
namespace: default
418+
spec:
419+
# ...omitted for brevity
420+
values:
421+
app:
422+
version: v1.2.3
423+
---
424+
apiVersion: helm.toolkit.fluxcd.io/v2
425+
kind: HelmRelease
426+
metadata:
427+
name: frontend
428+
namespace: default
429+
spec:
430+
# ...omitted for brevity
431+
values:
432+
app:
433+
version: v1.2.3
434+
dependsOn:
435+
- name: backend
436+
readyExpr: >
437+
dep.spec.values.app.version == self.spec.values.app.version &&
438+
dep.status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') &&
439+
dep.metadata.generation == dep.status.observedGeneration
440+
```
441+
442+
The CEL expression contains the following variables:
443+
444+
- `dep`: The dependency HelmRelease object being evaluated.
445+
- `self`: The HelmRelease object being reconciled.
446+
447+
**Note:** When `readyExpr` is specified, the built-in readiness check is replaced by the logic
448+
defined in the CEL expression. You can configure the controller to run both the CEL expression
449+
evaluation and the built-in readiness check, with the `AdditiveCELDependencyCheck`
450+
[feature gate](https://fluxcd.io/flux/components/helm/options/#feature-gates).
451+
405452
### Values
406453

407454
The values for the Helm release can be specified in two ways:

0 commit comments

Comments
 (0)