diff --git a/README.md b/README.md index 410a05e..595a4c4 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,47 @@ spec: For more information, see the example in [recursive](example/recursive). +## Setting Conditions on the Claim and Composite + +Starting with Crossplane 1.17, Composition authors can set custom Conditions on the +Composite and the Claim. + +Add a `ClaimConditions` to your template to set Conditions: + +```yaml +apiVersion: meta.gotemplating.fn.crossplane.io/v1alpha1 +kind: ClaimConditions +conditions: +# Guide to ClaimConditions fields: +# Type of the condition, e.g. DatabaseReady. +# 'Healthy', 'Ready' and 'Synced' are reserved for use by Crossplane and this function will raise an error if used +# - type: +# Status of the condition. String of "True"/"False"/"Unknown" +# status: +# Machine-readable PascalCase reason, for example "ErrorProvisioning" +# reason: +# Optional Target. Publish Condition only to the Composite, or the Composite and the Claim (CompositeAndClaim). +# Defaults to Composite +# target: +# Optional message: +# message: +- type: TestCondition + status: "False" + reason: InstallFail + message: "failed to install" + target: CompositeAndClaim +- type: ConditionTrue + status: "True" + reason: TrueCondition + message: we are true + target: Composite +- type: DatabaseReady + status: "True" + reason: Ready + message: Database is ready + target: CompositeAndClaim +``` + ## Additional functions | Name | Description | diff --git a/example/conditions/composition.yaml b/example/conditions/composition.yaml index 7c23e6c..d034db6 100644 --- a/example/conditions/composition.yaml +++ b/example/conditions/composition.yaml @@ -27,7 +27,7 @@ spec: # - type: # Status of the condition. String of "True"/"False"/"Unknown" # status: - # Machine-readable PascalCase reason, for example "DatabaseReady" + # Machine-readable PascalCase reason, for example "ErrorProvisioning" # reason: # Optional Target. Publish Condition only to the Composite, or the Composite and the Claim (CompositeAndClaim). # Defaults to Composite @@ -41,13 +41,14 @@ spec: target: CompositeAndClaim - type: ConditionTrue status: "True" - reason: this condition is true + reason: TrueCondition message: we are true target: Composite - type: DatabaseReady status: "True" reason: Ready message: Database is ready + target: CompositeAndClaim - step: automatically-detect-ready-composed-resources functionRef: name: crossplane-contrib-function-auto-ready