Skip to content

Commit

Permalink
docs(master): add MatchTrue and MatchFalse readiness checks
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Caparelli <[email protected]>
  • Loading branch information
LCaparelli committed Aug 1, 2023
1 parent fc6b494 commit 969b94d
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions content/master/concepts/compositions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ Compositions support matching resource fields by:
* [non-empty match](#match-that-a-field-exists)
* [always ready](#always-consider-a-resource-ready)
* [condition match](#match-a-condition)
* [boolean match](#match-a-boolean)

#### Match a string

Expand Down Expand Up @@ -1159,6 +1160,72 @@ spec:
status: Success
```

#### Match a Boolean

Two types of checks exist for matching boolean fields:
* `MatchTrue`
* `MatchFalse`

`MatchTrue` considers the composed resource to be ready when the value of a
field within that resource is `true`.

`MatchFalse` considers the composed resource to be ready when the value of a
field within that resource is `false`.

For example, consider
{{<hover label="matchTrue" line="7">}}my-resource{{</hover>}}, which will be marked
as ready if
{{<hover label="matchTrue" line="12">}} status.atProvider.manifest.status.ready{{</hover>}}
is {{<hover label="matchTrue" line="11">}}true{{</hover>}}.

```yaml {label="matchTrue",copy-lines="none"}
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
# Removed for Brevity
spec:
resources:
# Removed for Brevity
- name: my-resource
base:
# Removed for brevity
readinessChecks:
- type: MatchTrue
fieldPath: status.atProvider.manifest.status.ready
```
{{<hint "tip" >}}
Checking {{<hover label="matchTrue" line="11">}}MatchTrue{{</hover>}} doesn't
require a `match` field.
{{< /hint >}}

Alternatively, `MatchFalse` can be used for fields that express readiness with
negative polarity.

For example, consider
{{<hover label="matchFalse" line="7">}}my-resource{{</hover>}}, which will be marked
as ready if
{{<hover label="matchFalse" line="12">}} status.atProvider.manifest.status.pending{{</hover>}}
is {{<hover label="matchFalse" line="11">}}false{{</hover>}}.

```yaml {label="matchFalse",copy-lines="none"}
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
# Removed for Brevity
spec:
resources:
# Removed for Brevity
- name: my-resource
base:
# Removed for brevity
readinessChecks:
- type: MatchFalse
fieldPath: status.atProvider.manifest.status.pending
```

{{<hint "tip" >}}
Checking {{<hover label="matchFalse" line="11">}}MatchFalse{{</hover>}} doesn't
require a `match` field.
{{< /hint >}}

## Verify a Composition

View all available Compositions with `kubectl get composition`.
Expand Down

0 comments on commit 969b94d

Please sign in to comment.