crossplane-contrib / crossplane-contrib/function-auto-ready
Not detecting readiness of CNPG Cluster Resource
- Dominant language
- Go
- Stars
- 36
- Forks
- 27
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 9
Description
### What happened?
I'm using function-auto-ready with function-kcl to create CloudNativePG (CNPG) Cluster resources. The CNPG Cluster resources have the correct `status.conditions` with `type: Ready, status: "True"` when they become healthy, but function-auto-ready is not detecting them as ready.
Currently, I'm forced to hardcode resources as ready using the `krm.kcl.dev/ready = "True"` annotation from function-kcl, but this defeats the purpose - I want resources to only be marked as ready when they actually report ready status conditions.
**Expected behavior:** function-auto-ready should observe the CNPG Cluster resource's status and mark the composed resource as ready when the Cluster reports `type: Ready, status: "True"` in its status.conditions.
**Actual behavior:** The composed resource "postgres-cluster" continuously shows as "not yet ready" even when the underlying CNPG Cluster is in a healthy state with Ready=True condition.
Error message seen:
```
Normal ComposeResources 63s (x1435 over 20h) defined/compositeresourcedefinition.apiextensions.crossplane.io Composed resource "postgres-cluster" is not yet ready
```
### How can we reproduce it?
1. Create a Composition using Pipeline mode with function-kcl and function-auto-ready:
```yaml
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: postgres-abstraction
spec:
compositeTypeRef:
apiVersion: abc.io/v1alpha1
kind: XPostgres
mode: Pipeline
pipeline:
- step: create-resources
functionRef:
name: function-kcl
input:
apiVersion: krm.kcl.dev/v1alpha1
kind: KCLInput
spec:
source: |
oxr = option("params").oxr
cluster = {
apiVersion = "postgresql.cnpg.io/v1"
kind = "Cluster"
metadata = {
name = "${oxr.metadata.name}-pg"
namespace = "database"
annotations = {
"krm.kcl.dev/composition-resource-name" = "postgres-cluster"
"crossplane.io/external-name" = "${oxr.metadata.name}-pg"
}
}
spec = {
instances = 1
imageName = "ghcr.io/cloudnative-pg/postgresql:17.7-system-trixie"
# ... rest of spec
}
}
items = [cluster]
- step: automatically-detect-ready-composed-resources
functionRef:
name: function-auto-ready
```
2. Create an instance of the XR
3. Wait for the CNPG Cluster to become ready (it will have status.conditions with type: Ready, status: "True")
4. Observe that function-auto-ready still reports the composed resource as "not yet ready"
**Actual CNPG Cluster status** (showing it IS ready):
```yaml
status:
conditions:
- lastTransitionTime: "2026-01-14T09:29:02Z"
message: Cluster is Ready
reason: ClusterIsReady
status: "True"
type: Ready
phase: Cluster in healthy state
readyInstances: 1
```
### What environment did it happen in?
- Function version: v0.6.0 (also tested with v0.5.0)
- Crossplane version: Latest
- Kubernetes distribution: K3s (40+ on-premise clusters)
- Other functions in pipeline: function-kcl, function-status-transformer
- CRD: CloudNativePG Cluster (postgresql.cnpg.io/v1)
### Additional Context
I'm not sure if this is:
1. A compatibility issue between function-kcl and function-auto-ready
2. function-auto-ready not properly observing custom resources (CNPG Clusters) in Pipeline mode
3. Missing configuration or annotation needed for function-auto-ready to observe these resources
I tried:
- Adding `crossplane.io/external-name` annotation
- Using `krm.kcl.dev/composition-resource-name` annotation
- Checking that CNPG Clusters expose the standard `Ready` condition
The only workaround is hardcoding `"krm.kcl.dev/ready" = "True"` in the KCL function output, but this marks resources as ready immediately upon creation rather than waiting for actual readiness.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.