|
| 1 | +--- |
| 2 | +title: "CEL cheatsheet" |
| 3 | +linkTitle: "CEL Health Checks" |
| 4 | +description: "Common Expression Language (CEL) expressions for checking the health of custom resources." |
| 5 | +weight: 31 |
| 6 | +--- |
| 7 | + |
| 8 | +## About |
| 9 | + |
| 10 | +The Kustomization API supports defining custom logic for performing health |
| 11 | +checks on custom resources through the field |
| 12 | +[`.spec.healthCheckExprs`](/flux/components/kustomize/kustomizations/#health-check-exprs). |
| 13 | +This field accepts a set of Common Expression Language (CEL) expressions. |
| 14 | + |
| 15 | +Here you can find a set of community-maintained CEL expressions for popular |
| 16 | +custom resources. |
| 17 | + |
| 18 | +## Contributing |
| 19 | + |
| 20 | +For contributing to this library, open a pull request making changes to this file: |
| 21 | + |
| 22 | +https://github.com/fluxcd/website/blob/main/content/en/flux/cheatsheets/cel-healthchecks.md |
| 23 | + |
| 24 | +Please make sure to test your expressions and post evidence of their correctness |
| 25 | +in the pull request, i.e. configure a Kustomization with the expressions, verify |
| 26 | +that they work as expected and post logs or screenshots in the pull request. |
| 27 | + |
| 28 | +The [CEL Playground](https://playcel.undistro.io/) is a useful resource for |
| 29 | +testing your expressions. The input passed to each expression is the custom |
| 30 | +resource object itself. |
| 31 | + |
| 32 | +## Library |
| 33 | + |
| 34 | +The items in this library are sorted in alphabetical order. |
| 35 | + |
| 36 | +### `Cluster` |
| 37 | + |
| 38 | +```yaml |
| 39 | +- apiVersion: cluster.x-k8s.io/v1beta1 |
| 40 | + kind: Cluster |
| 41 | + failed: status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'False') |
| 42 | + current: status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') |
| 43 | +``` |
| 44 | +
|
| 45 | +### `ClusterIssuer` |
| 46 | + |
| 47 | +```yaml |
| 48 | +- apiVersion: cert-manager.io/v1 |
| 49 | + kind: ClusterIssuer |
| 50 | + failed: status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'False') |
| 51 | + current: status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') |
| 52 | +``` |
| 53 | + |
| 54 | +### `ScaledObject` |
| 55 | + |
| 56 | +```yaml |
| 57 | +- apiVersion: keda.sh/v1alpha1 |
| 58 | + kind: ScaledObject |
| 59 | + failed: status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'False') |
| 60 | + current: status.conditions.filter(e, e.type == 'Ready').all(e, e.status == 'True') |
| 61 | +``` |
| 62 | + |
| 63 | +### `SealedSecret` |
| 64 | + |
| 65 | +```yaml |
| 66 | +- apiVersion: bitnami.com/v1alpha1 |
| 67 | + kind: SealedSecret |
| 68 | + failed: status.conditions.filter(e, e.type == 'Synced').all(e, e.status == 'False') |
| 69 | + current: status.conditions.filter(e, e.type == 'Synced').all(e, e.status == 'True') |
| 70 | +``` |
0 commit comments