From 87e69e85979c1235618708344457d42e87c8656d Mon Sep 17 00:00:00 2001 From: Tim <32556895+Avarei@users.noreply.github.com> Date: Sun, 7 Jul 2024 14:45:34 +0200 Subject: [PATCH] update docs and move crd2module.pkl to the correct directory Signed-off-by: Tim <32556895+Avarei@users.noreply.github.com> --- README.md | 2 +- pkl/crossplane.contrib.example/DEPLOY.md | 14 +++++++------- pkl/crossplane.contrib.example/DEVELOP.md | 18 +++++++++--------- .../{xrds => crds}/crd2module.pkl | 0 4 files changed, 17 insertions(+), 17 deletions(-) rename pkl/crossplane.contrib.example/{xrds => crds}/crd2module.pkl (100%) diff --git a/README.md b/README.md index 4f08ed4..d0cf887 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ spec: ``` ## Usage -To use this function create add the following to your composition: +To use this function add the following to your composition: ```yaml apiVersion: apiextensions.crossplane.io/v1 kind: Composition diff --git a/pkl/crossplane.contrib.example/DEPLOY.md b/pkl/crossplane.contrib.example/DEPLOY.md index 79a9c7a..faf1bdc 100644 --- a/pkl/crossplane.contrib.example/DEPLOY.md +++ b/pkl/crossplane.contrib.example/DEPLOY.md @@ -1,11 +1,11 @@ # Deploying this Example ## Prerequirements -* [pkl cli](https://pkl-lang.org/main/current/pkl-cli/index.html#installation) +* [pkl cli](https://pkl-lang.org/main/current/pkl-cli/index.html#installation) is installed * crossplane in a cluster * function-pkl deployed (see [here](../../README.md)) -* provider-kubernetes deployed -* provider config for kubernetes provider called "default" +* The examples use [provider-kubernetes](https://marketplace.upbound.io/providers/crossplane-contrib/provider-kubernetes) +* [provider config](https://marketplace.upbound.io/providers/crossplane-contrib/provider-kubernetes/v0.14.0/resources/kubernetes.crossplane.io/ProviderConfig/v1alpha1) for provider-kubernetes called "default" ## Deploy XRD ```shell @@ -14,16 +14,16 @@ pkl eval xrds/ExampleXR.pkl | kubectl apply -f - ``` ## Deploy Composition ```shell -kubectl apply -f ../../example/full/composition.yaml +pkl eval compositions/uri.pkl | kubectl apply -f - ``` ## Deploy XR ```shell -kubectl apply -f ../../example/full/xr.yaml +pkl eval xrs/uri.pkl | kubectl apply -f - ``` ## Check the Resource ```shell -kubectl get xrs.example.crossplane.io example-xr -oyaml +kubectl get xrs.example.crossplane.io uri-example -oyaml -crossplane beta trace xrs example-xr +crossplane beta trace xrs uri-example ``` diff --git a/pkl/crossplane.contrib.example/DEVELOP.md b/pkl/crossplane.contrib.example/DEVELOP.md index 75bf421..a4dd46f 100644 --- a/pkl/crossplane.contrib.example/DEVELOP.md +++ b/pkl/crossplane.contrib.example/DEVELOP.md @@ -1,10 +1,10 @@ # Composite Resource Definitions - XRDs -XRDs can be created directly in Pkl or in Yaml. +XRDs can be created directly in Pkl or imported from Yaml. Either can be converted to a Pkl Module. -## Create XRD +## Create a XRD (Skip if you already have a XRD) When Creating a Pkl file ensure it amends CompositeResourceDefinition ```pkl amends "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crospslane.contrib.xrd@#/CompositeResourceDefinition.pkl" @@ -14,7 +14,7 @@ view [xrds/ExampleXR.pkl](xrds/ExampleXR.pkl) for more details on how to Build i running `pkl eval xrds/ExampleXR.pkl` renders the XRD in its Yaml manifest format. -## Create Module +## Create a Module Modules can be generated by creating a file like [xrds/xrd2module.pkl](xrds/xrd2module.pkl) and running `pkl eval -m `. This will create the Module in the Output directory. e.g. [crds/XR.pkl](crds/XR.pkl) was created by running: @@ -25,9 +25,9 @@ pkl eval xrds/xrd2module.pkl -m crds yaml manifests can be converted in the same way. ## Create Managed Resource Modules -Managed Resources and any other CRDs can be converted similarly to XRDs by creating a file like [xrds/crd2module.pkl](xrds/crd2module.pkl) +Managed Resources and any other CRDs can be converted similarly to XRDs by creating a file like [crds/crd2module.pkl](crds/crd2module.pkl) ```bash -pkl eval xrds/crd2module.pkl -m crds +pkl eval crds/crd2module.pkl -m crds ``` ## Create Pkl file for the Pipeline Step @@ -50,7 +50,7 @@ local request = new crossplane { } }.Request ``` -To Parse the Request automatically into Pkl Language all K8sResources used must be declared in customResourceTemplates in the specified form. +To Parse the Request into Pkl Language the XRD and all Managed Resources used must be declared in customResourceTemplates. ## Create a Composition The Composition itself can be created in [yaml](../../example/full/composition.yaml) or in [pkl](compositions/inline.pkl). The latter is especially useful, if the the function is used with an inline Pkl file. @@ -61,12 +61,12 @@ The Composition itself can be created in [yaml](../../example/full/composition.y ## Resolve Dependencies Running `pkl project resolve` will download the Project dependencies -> Note: When having multiple Projects in a Repository, which have dependencies among them use +> Note: When having multiple Projects in a Repository, which have dependencies among each other use > `pkl project resolve ./*/` from the parent directory ## Package Project Run `pkl project package` to create releasable package artifacts. -> Note: When having multiple Projects in a Repository, which have dependencies among them use +> Note: When having multiple Projects in a Repository, which have dependencies among each other use > `pkl project package ./*/` from the parent directory ## Release Project @@ -80,4 +80,4 @@ Using pkg.pkl-lang.org as the domain helps with redirecting the requests from - https://github.com/crossplane-contrib/function-pkl/releases/download/crossplane@x.y.z/crossplane@x.y.z When the Package is released it can be used in the Composition. -See [example/full/composition.yaml](../../example/full/composition.yaml) \ No newline at end of file +See [example/full/composition.yaml](../../example/full/composition.yaml) diff --git a/pkl/crossplane.contrib.example/xrds/crd2module.pkl b/pkl/crossplane.contrib.example/crds/crd2module.pkl similarity index 100% rename from pkl/crossplane.contrib.example/xrds/crd2module.pkl rename to pkl/crossplane.contrib.example/crds/crd2module.pkl