This repo is Deprecated and will be merging with https://github.com/elastic/crossplane-function-cue. It is recommended that if you are using this repo to move to the elastic repository until it is migrated into this repo
A cuelang integration for Crossplane's Composition Functions.
This function is based on /play codebase and cmd
This function is intended to give a crossplane composition creator the ability to compile and run cue templates within a composition function.
The user can target the compilation output to various objects determined by the target passed into the CUEInput.Export.Target
See Targeting Objects for info on utilizing the types of targets
Resources (default)
PatchDesired
PatchResources
XR
See the kubebuilder generated CRD or the go definition
See examples folder
The compilation output of the CUEInput.Export.Value
must be in YAML
or JSON
documents, or it will fail parsing.
xr
or mr
apiVersion
, kind
Ex cueCompile()
output schema
#outputSchema: {
// Name of your resource
name: string
// Optional connection details
// see docs/CONNECTION_DETAILS.md for more details
connectionDetails?: [...#connectionDetail]
// Optional readiness checks
// see docs/READINESS_CHECKS.md for more details
readinessChecks?: [...#readinessCheck]
// Resource spec
resource: {
// Example
// apiVersion: "nobu.dev/v1"
// kind: "Example"
//
// etc...
}
}
single
{
"name": "my-cluster",
"resource": {
"apiVersion": "nobu.dev/v1",
"kind": "XCluster"
}
}
multiple
- single json document per line, -e json.MarshalStream(field)
will produce this format
{"name": "my-cluster", "resource": {"apiVersion": "nobu.dev/v1", "kind": "XCluster"}}
{"name": "my-network", "resource": {"apiVersion": "nobu.dev/v1", "kind": "XNetwork"}}
single
name: "my-cluster"
resource:
apiVersion: "nobu.dev/v1"
kind: "XCluster"
multiple
documents, separated by ---
, -e yaml.MarshalStream(field)
will produce this format
name: "my-cluster"
resource:
apiVersion: "nobu.dev/v1"
kind: "XCluster"
---
name: "my-network"
resource:
apiVersion: "nobu.dev/v1"
kind: "XNetwork"
...
v0.7.0
export
Runs cue export
based off of a cue template provided by the CUEInput.Export.Value
field
See the currently supported options
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
name: function-cue
spec:
package: mitsuwa/function-cue:v0.1.2
See libraries
Logs are emitted to the Function's pod logs. Look for the Function pod in crossplane-system
.
Info # default
Debug # run with --debug flag