Skip to content

Commit

Permalink
Explain the evaluation logic based on conditions
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <[email protected]>
  • Loading branch information
stefanprodan committed Jan 17, 2025
1 parent 6f6d3fb commit 91ce112
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions rfcs/0000-custom-health-checks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ condition to know if the certificate has been issued or not before looking at th
In order to provide a generic solution for custom resources, that would not imply
writing a custom `kstatus` reader for each CRD, we need to provide a way for the user
to express the conditions that need to be met in order to determine the status.
And we need to do this in a way that is flexible enough to cover all possible use cases,
without having to change Flux source code for each new use case.
It should be done in a way that is flexible enough to cover all possible use cases,
without having to change Flux source code for each new CRD.

### Goals

Expand Down Expand Up @@ -120,7 +120,7 @@ To help users define custom health checks, we will provide on the [fluxcd.io](ht
website a library of custom health checks for popular custom resources.

The Flux community will be able to contribute to this library by submitting pull requests
to the `fluxcd/website` repository.
to the [fluxcd/website](https://github.com/fluxcd/website) repository.

### User Stories

Expand Down Expand Up @@ -176,7 +176,7 @@ Example for `Cluster`:
We need an expression language that is flexible enough to cover all possible use
cases, without having to change Flux source code for each new use case.

An alternative that have been considered was to use `CUE` instead of `CEL`.
An alternative that has been considered was to use `CUE` instead of `CEL`.
`CUE` lang is a more powerful expression language, but given the fact that
Kubernetes makes use of `CEL` for CRD validation and admission control,
we have decided to also use `CEL` in Flux in order to be consistent with
Expand Down Expand Up @@ -217,6 +217,17 @@ type CustomHealthCheck struct {
}
```

The `InProgress` expression is optional, when not specified the controller will determine
if the resource is in progress if both `Failed` and `Current` evaluate to false.
Moreover, if the `InProgress` expression is not specified and the custom resource has a
`.status.observedGeneration` field, the controller with compare it with the `.metadata.generation`
field to determine if the resource is in progress.

The `Failed` expression is optional, when not specified the controller will keep evaluating the
`Current` expression until it returns true, and gave up after the timeout is reached.
Users should be encouraged to provide a `Failed` expression to avoid staling the reconciliation
loop until the timeout is reached.

### Introduce a generic custom status reader

We'll Introduce a `StatusReader` that will be used to compute the status
Expand Down

0 comments on commit 91ce112

Please sign in to comment.