What happened?
When setting the status using option("params").dxr, the generated status.conditions is sometimes set to null instead of an empty array when no conditions are present. This causes an error in Crossplane claims, as the field expects an array, not null. Specifically, the error reported is:
Warning ComposeResources 107s (x27 over 29m) defined/compositeresourcedefinition.apiextensions.crossplane.io cannot compose resources: cannot apply composite resource status: XProject.platform.eng.it "platform-gxbnm" is invalid: status.conditions: Invalid value: "null": conditions in body must be of type array: "null"
How can we reproduce it?
- In a composition using function-kcl, set status via:
dxr = option("params").dxr
_dxr.status = {
somekey = "somevalue"
}
- Alternatively, try merging status into dxr:
dxr = option("params").dxr
_dxr = {
**option("params").dxr
status.somekey = "somevalue"
}
- In both cases, if no conditions are present, observe that
status.conditions is set to null.
- Apply the composition and observe the error in Crossplane claims.
What environment did it happen in?
Function version: v0.11.1
Crossplane version: v1.20.1
Kubernetes version: 1.32
Distribution/OS: (please specify)
Related issues and PRs:
Expected behavior:
status.conditions should always be an array (possibly empty), never null.
Workaround / Notes:
- The recommended approach is to set status via
option("params").dxr, but further handling is needed to ensure arrays are not null.
What happened?
When setting the status using
option("params").dxr, the generated status.conditions is sometimes set tonullinstead of an empty array when no conditions are present. This causes an error in Crossplane claims, as the field expects an array, not null. Specifically, the error reported is:How can we reproduce it?
status.conditionsis set to null.What environment did it happen in?
Function version: v0.11.1
Crossplane version: v1.20.1
Kubernetes version: 1.32
Distribution/OS: (please specify)
Related issues and PRs:
Expected behavior:
status.conditionsshould always be an array (possibly empty), never null.Workaround / Notes:
option("params").dxr, but further handling is needed to ensure arrays are notnull.