Closed fernandezcuesta closed 5 months ago
function-auto-ready
marks composed resources as ready only if they were not previously explicitly set not to be ready.
With function-go-templating
you can explicitly mark a resource as not ready by setting the gotemplating.fn.crossplane.io/ready
condition to False
, so you can set it wrapping it with the same condition you are using to create the second resource, e.g.:
apiVersion: s3.aws.upbound.io/v1beta1
kind: Bucket
metadata:
annotations:
gotemplating.fn.crossplane.io/composition-resource-name: bucket
{{- if not (... your condition, e.g. ARN in status is not set ... ) }}
gotemplating.fn.crossplane.io/ready: "False"
{{- end }}
...
This way your "source" resource won't be marked as ready, preventing the composite resource from becoming ready, until the second resource is ready too.
Thanks! it works like a charm, closing this issue.
What problem are you facing?
When working with
function-go-templating
, I'm conditionally rendering some resources based on a condition (e.g. another resource is created and dumps an ARN into its status). When this is the case,function-auto-ready
is marking the whole composition as Ready, even though there might be missing resources (which may or not eventually succeed).How could this Function help solve your problem?
Either this or
function-go-templating
should include a mechanism to mimic the behaviour on P&T whenpolicy.fromFieldPath
isRequired
but the condition fails.