Skip to content

Commit df3256a

Browse files
authored
Merge pull request #630 from gianlucam76/healthcheck-cel
ValidateHealths with CEL.
2 parents 9df0cf5 + 9a0e743 commit df3256a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/deployment_order/depends_on_with_health_checks.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,46 @@ To guarantee that cert-manager is not only deployed but also functional, employ
5555
end
5656
```
5757

58+
#### Common Expression Language (CEL) for Health Validation
59+
60+
Alternatively, you can use Common Expression Language ([CEL](https://cel.dev)), which offers a more concise way to define the same health rule. The example below uses a CEL expression to check if the _availableReplicas_ are equal to the _requested replicas_. The result is the same as the Lua script, providing a healthy and succinct way to validate the state of your deployments.
61+
62+
63+
!!! example ""
64+
```yaml
65+
---
66+
apiVersion: config.projectsveltos.io/v1beta1
67+
kind: ClusterProfile
68+
metadata:
69+
name: cert-manager
70+
spec:
71+
clusterSelector:
72+
matchLabels:
73+
env: fv
74+
syncMode: Continuous
75+
helmCharts:
76+
- repositoryURL: https://charts.jetstack.io
77+
repositoryName: jetstack
78+
chartName: jetstack/cert-manager
79+
chartVersion: v1.13.2
80+
releaseName: cert-manager
81+
releaseNamespace: cert-manager
82+
helmChartAction: Install
83+
values: |
84+
installCRDs: true
85+
validateHealths:
86+
- name: deployment-health
87+
featureID: Helm
88+
group: "apps"
89+
version: "v1"
90+
kind: "Deployment"
91+
namespace: cert-manager
92+
evaluateCEL:
93+
- name: deployment_replicas
94+
rule: resource.status.availableReplicas == resource.spec.replicas
95+
```
96+
97+
5898
### Example: Nginx and Cert Manager
5999

60100
In the below example, the ClusterPofile to deploy the __nginx ingress__ depends on the __cert-manager__ ClusterProfile defined above.

0 commit comments

Comments
 (0)