crossplane-contrib / function-cue-archived

Cuelang Integration for Crossplane's Composition Function
Apache License 2.0
10 stars 1 forks source link

Update Output Schema for cue compilation, include base, name, connectionDetails, readiness checks #51

Closed Mitsuwa closed 12 months ago

Mitsuwa commented 12 months ago

What and Why?

This updates the required output format per document for cueCompilation to be

name: "name of resource"
# some connectionDetails for the resource
connectionDetails: []
# some readiness checks for the reasource
readinessChecks: []
base:
   apiVersion: "etc"
   ...

Fixes #48

This also should make the overall function faster because it no longer needs to rely on the #connectionDetails and #readinessChecks within the cue template, because the values will be stored at a wrapped level of the original document (now stored in base) allowing these fields will be omitted or used if present in one parse without needing to run multiple compilations

This also now utilizes the name at the root of the document and allows for users to not have to specify metadata.name anymore.

This root name is now used to create resources as - map[resource.Name($name)*DesiredComposed, if there are multiple documents in the output the resource.Name is the $CUEInput.Name-$name

I have:

negz commented 12 months ago

I'm not super familiar with this codebase yet, but this design looks good and I don't see any obvious concerns in the code. Thank you!