Skip to content

Commit 6359abe

Browse files
committed
docs: Add dependency ready expression to API docs
Signed-off-by: Stefan Prodan <[email protected]>
1 parent 6e3f22d commit 6359abe

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

docs/spec/v1/kustomizations.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,51 @@ is running before deploying applications inside the mesh.
487487
**Note:** Circular dependencies between Kustomizations must be avoided,
488488
otherwise the interdependent Kustomizations will never be applied on the cluster.
489489

490+
#### Dependency Ready Expression
491+
492+
`.spec.dependsOn[].readyExpr` is an optional field that can be used to define a CEL expression
493+
to determine the readiness of a Kustomization dependency.
494+
495+
This is helpful for when custom logic is needed to determine if a dependency is ready.
496+
For example, when performing a lockstep upgrade, the `readyExpr` can be used to
497+
verify that a dependency has a matching version label before proceeding with the
498+
reconciliation of the dependent Kustomization.
499+
500+
```yaml
501+
apiVersion: kustomize.toolkit.fluxcd.io/v1
502+
kind: Kustomization
503+
metadata:
504+
name: app-backend
505+
namespace: apps
506+
labels:
507+
app/version: v1.2.3
508+
---
509+
apiVersion: kustomize.toolkit.fluxcd.io/v1
510+
kind: Kustomization
511+
metadata:
512+
name: app-frontend
513+
namespace: apps
514+
labels:
515+
app/version: v1.2.3
516+
spec:
517+
dependsOn:
518+
- name: app-backend
519+
readyExpr: >
520+
dep.metadata.labels['app/version'] == self.metadata.labels['app/version'] &&
521+
dep.status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') &&
522+
dep.metadata.generation == dep.status.observedGeneration
523+
```
524+
525+
The CEL expression contains the following variables:
526+
527+
- `dep`: The dependency Kustomization object being evaluated.
528+
- `self`: The Kustomization object being reconciled.
529+
530+
**Note:** When `readyExpr` is specified, the built-in readiness check is replaced by the logic
531+
defined in the CEL expression. You can configure the controller to run both the CEL expression
532+
evaluation and the built-in readiness check, with the `AdditiveCELDependencyCheck`
533+
[feature gate](https://fluxcd.io/flux/components/kustomize/options/#feature-gates).
534+
490535
### Service Account reference
491536

492537
`.spec.serviceAccountName` is an optional field used to specify the

0 commit comments

Comments
 (0)