diff --git a/README.md b/README.md index 802d338..f9c22a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ # Crossplane Composition Functions using KCL -[![CI](https://kcl-lang.io/crossplane-kcl/actions/workflows/ci.yml/badge.svg)](https://kcl-lang.io/crossplane-kcl/actions/workflows/ci.yml) +[![Go Report Card](https://goreportcard.com/badge/kcl-lang.io/crossplane-kcl)](https://goreportcard.com/report/kcl-lang.io/crossplane-kcl) +[![GoDoc](https://godoc.org/kcl-lang.io/crossplane-kcl?status.svg)](https://godoc.org/kcl-lang.io/crossplane-kcl) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://kcl-lang.io/crossplane-kcl/blob/main/LICENSE) + +## Introduction + +Crossplane KCL function allows developers to use [KCL](https://kcl-lang.io/) (a DSL) to write composite logic without the need for repeated packaging of crossplane functions, and we support package management and the [KRM KCL specification](https://github.com/kcl-lang/krm-kcl), which allows for OCI/Git source and the reuse of [KCL's module ecosystem](https://artifacthub.io/packages/search?org=kcl&sort=relevance&page=1). ## Developing @@ -31,9 +37,9 @@ A KRM YAML list which means that each document must have an `apiVersion`, `kind` Here's what you can do in the KCL script: + Return an error using `assert {condition}, {error_message}`. -+ Read the `ObservedCompositeResource` from `option("params").oxr`. -+ Read the `ObservedComposedResources` from `option("params").ocds`. -+ Read the `DesiredCompositeResource` from `option("params").dxr`. ++ Read the `ObservedCompositeResource` from `option("oxr").oxr`. ++ Read the `ObservedComposedResources` from `option("ocds").ocds`. ++ Read the `DesiredCompositeResource` from `option("dxr").dxr`. + Read the `DesiredComposedResources` from `option("params").dcds`. + Read the environment variables. e.g. `option("PATH")` (**Not yet implemented**). diff --git a/examples/resources/basic/README.md b/examples/resources/basic/README.md index ec98048..3cd029e 100644 --- a/examples/resources/basic/README.md +++ b/examples/resources/basic/README.md @@ -17,9 +17,25 @@ kind: XR metadata: name: example-xr --- +apiVersion: example.org/v1 +kind: Generated +metadata: + annotations: + crossplane.io/composition-resource-name: "" + generateName: example-xr- + labels: + crossplane.io/composite: example-xr + ownerReferences: + - apiVersion: example.crossplane.io/v1 + blockOwnerDeletion: true + controller: true + kind: XR + name: example-xr + uid: "" +--- apiVersion: render.crossplane.io/v1beta1 kind: Result -message: I was run with input "Hello world"! +message: created resource ":Generated" severity: SEVERITY_NORMAL -step: run-the-template +step: normal ``` diff --git a/input/v1beta1/input.go b/input/v1beta1/input.go index 387f66e..11ac579 100644 --- a/input/v1beta1/input.go +++ b/input/v1beta1/input.go @@ -49,7 +49,7 @@ func (in KCLInput) Validate() error { } } default: - return field.Required(field.NewPath("spec.target"), fmt.Sprintf("invalid target %s", in.Spec.Target)) + return field.Required(field.NewPath("spec.target"), fmt.Sprintf("invalid target: %s", in.Spec.Target)) } return nil