Skip to content

Commit 969b94d

Browse files
committed
docs(master): add MatchTrue and MatchFalse readiness checks
Signed-off-by: Lucas Caparelli <[email protected]>
1 parent fc6b494 commit 969b94d

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

content/master/concepts/compositions.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ Compositions support matching resource fields by:
10041004
* [non-empty match](#match-that-a-field-exists)
10051005
* [always ready](#always-consider-a-resource-ready)
10061006
* [condition match](#match-a-condition)
1007+
* [boolean match](#match-a-boolean)
10071008

10081009
#### Match a string
10091010

@@ -1159,6 +1160,72 @@ spec:
11591160
status: Success
11601161
```
11611162

1163+
#### Match a Boolean
1164+
1165+
Two types of checks exist for matching boolean fields:
1166+
* `MatchTrue`
1167+
* `MatchFalse`
1168+
1169+
`MatchTrue` considers the composed resource to be ready when the value of a
1170+
field within that resource is `true`.
1171+
1172+
`MatchFalse` considers the composed resource to be ready when the value of a
1173+
field within that resource is `false`.
1174+
1175+
For example, consider
1176+
{{<hover label="matchTrue" line="7">}}my-resource{{</hover>}}, which will be marked
1177+
as ready if
1178+
{{<hover label="matchTrue" line="12">}} status.atProvider.manifest.status.ready{{</hover>}}
1179+
is {{<hover label="matchTrue" line="11">}}true{{</hover>}}.
1180+
1181+
```yaml {label="matchTrue",copy-lines="none"}
1182+
apiVersion: apiextensions.crossplane.io/v1
1183+
kind: Composition
1184+
# Removed for Brevity
1185+
spec:
1186+
resources:
1187+
# Removed for Brevity
1188+
- name: my-resource
1189+
base:
1190+
# Removed for brevity
1191+
readinessChecks:
1192+
- type: MatchTrue
1193+
fieldPath: status.atProvider.manifest.status.ready
1194+
```
1195+
{{<hint "tip" >}}
1196+
Checking {{<hover label="matchTrue" line="11">}}MatchTrue{{</hover>}} doesn't
1197+
require a `match` field.
1198+
{{< /hint >}}
1199+
1200+
Alternatively, `MatchFalse` can be used for fields that express readiness with
1201+
negative polarity.
1202+
1203+
For example, consider
1204+
{{<hover label="matchFalse" line="7">}}my-resource{{</hover>}}, which will be marked
1205+
as ready if
1206+
{{<hover label="matchFalse" line="12">}} status.atProvider.manifest.status.pending{{</hover>}}
1207+
is {{<hover label="matchFalse" line="11">}}false{{</hover>}}.
1208+
1209+
```yaml {label="matchFalse",copy-lines="none"}
1210+
apiVersion: apiextensions.crossplane.io/v1
1211+
kind: Composition
1212+
# Removed for Brevity
1213+
spec:
1214+
resources:
1215+
# Removed for Brevity
1216+
- name: my-resource
1217+
base:
1218+
# Removed for brevity
1219+
readinessChecks:
1220+
- type: MatchFalse
1221+
fieldPath: status.atProvider.manifest.status.pending
1222+
```
1223+
1224+
{{<hint "tip" >}}
1225+
Checking {{<hover label="matchFalse" line="11">}}MatchFalse{{</hover>}} doesn't
1226+
require a `match` field.
1227+
{{< /hint >}}
1228+
11621229
## Verify a Composition
11631230

11641231
View all available Compositions with `kubectl get composition`.

0 commit comments

Comments
 (0)