diff --git a/content/master/concepts/compositions.md b/content/master/concepts/compositions.md index ce22845cc..f72043996 100644 --- a/content/master/concepts/compositions.md +++ b/content/master/concepts/compositions.md @@ -1000,6 +1000,8 @@ Compositions support matching resource fields by: * [integer match](#match-an-integer) * [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 @@ -1100,7 +1102,7 @@ spec: {{}} Checking {{}}NonEmpty{{}} doesn't -require a `match` field. +require setting any other fields. {{< /hint >}} #### Always consider a resource ready @@ -1127,6 +1129,99 @@ spec: - type: None ``` +#### Match a condition +{{}}Condition{{}} considers the composed +resource to be ready when it finds the expected condition type, with the +expected status for it in its `status.conditions`. + +For example, consider +{{}}my-resource{{}}, which is +ready if there is a condition of type +{{}}MyType{{}} with a status of +{{}}Success{{}}. + +```yaml {label="condition",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: MatchCondition + matchCondition: + type: MyType + 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 inside that resource is `true`. + +`MatchFalse` considers the composed resource to be ready when the value of a +field inside that resource is `false`. + +For example, consider +{{}}my-resource{{}}, which is +ready if +{{}} status.atProvider.manifest.status.ready{{}} +is {{}}true{{}}. + +```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 +``` +{{}} +Checking {{}}MatchTrue{{}} doesn't +require setting any other fields. +{{< /hint >}} + +`MatchFalse` matches fields that express readiness with the value `false`. + +For example, consider +{{}}my-resource{{}}, is +ready if +{{}} status.atProvider.manifest.status.pending{{}} +is {{}}false{{}}. + +```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 +``` + +{{}} +Checking {{}}MatchFalse{{}} doesn't +require setting any other fields. +{{< /hint >}} + ## Verify a Composition View all available Compositions with `kubectl get composition`. diff --git a/content/v1.13/concepts/compositions.md b/content/v1.13/concepts/compositions.md index fa0fe5e9c..7cce82ad8 100644 --- a/content/v1.13/concepts/compositions.md +++ b/content/v1.13/concepts/compositions.md @@ -1003,6 +1003,7 @@ Compositions support matching resource fields by: * [integer match](#match-an-integer) * [non-empty match](#match-that-a-field-exists) * [always ready](#always-consider-a-resource-ready) + * [condition match](#match-a-condition) #### Match a string @@ -1103,7 +1104,7 @@ spec: {{}} Checking {{}}NonEmpty{{}} doesn't -require a `match` field. +require setting any other fields. {{< /hint >}} #### Always consider a resource ready @@ -1130,6 +1131,34 @@ spec: - type: None ``` +#### Match a condition +{{}}Condition{{}} considers the composed +resource to be ready when it finds the expected condition type, with the +expected status for it in its `status.conditions`. + +For example, consider +{{}}my-resource{{}}, which is +ready if there is a condition of type +{{}}MyType{{}} with a status of +{{}}Success{{}}. + +```yaml {label="condition",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: MatchCondition + matchCondition: + type: MyType + status: Success +``` + ## Verify a Composition View all available Compositions with `kubectl get composition`.