### Deploy XRD using pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEPLOY.md Evaluates the ExampleXR.pkl package from the function-pkl project and applies it to the Kubernetes cluster. ```shell pkl eval package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.example@0.0.1#/xrds/ExampleXR.pkl | kubectl apply -f - ``` -------------------------------- ### Run Crossplane Function PKL Locally Source: https://github.com/crossplane-contrib/function-pkl/blob/main/example/README.md Starts the Crossplane Function PKL locally with insecure and debug modes enabled. This command is used to run the function server. ```shell # Run the function locally $ go run . --insecure --debug ``` -------------------------------- ### Test Function with Example Manifests Source: https://github.com/crossplane-contrib/function-pkl/blob/main/example/README.md Calls the locally running Crossplane Function PKL with example manifests (`xr.yaml`, `composition.yaml`, `functions.yaml`). This command is used to send rendering requests to the function. ```shell # Then, in another terminal, call it with these example manifests $ crossplane beta render xr.yaml composition.yaml functions.yaml ``` -------------------------------- ### Trace XR using Crossplane CLI Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEPLOY.md Traces the 'uri-example' XR resource using the Crossplane beta trace command. ```shell crossplane beta trace xrs uri-example ``` -------------------------------- ### Check Resource using kubectl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEPLOY.md Retrieves the YAML representation of the 'uri-example' XRS resource from the 'example.crossplane.io' API group. ```shell kubectl get xrs.example.crossplane.io uri-example -oyaml ``` -------------------------------- ### Deploy Composition using pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEPLOY.md Evaluates the uri.pkl composition package from the function-pkl project and applies it to the Kubernetes cluster. ```shell pkl eval package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.example@0.0.1#/compositions/uri.pkl | kubectl apply -f - ``` -------------------------------- ### Deploy XR using pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEPLOY.md Evaluates the uri.pkl XR package from the function-pkl project and applies it to the Kubernetes cluster. ```shell pkl eval package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.example@0.0.1#/xrs/uri.pkl | kubectl apply -f - ``` -------------------------------- ### Install function-pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/README.md YAML configuration to install the function-pkl composition function as a Crossplane Function resource. It specifies the package to be used. ```yaml apiVersion: pkg.crossplane.io/v1beta1 kind: Function metadata: name: function-pkl spec: package: xpkg.upbound.io/crossplane-contrib/function-pkl:v0.0.1 ``` -------------------------------- ### Package Artifacts for Multiple Projects Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This command packages artifacts for multiple Pkl projects located in subdirectories. It's useful for managing releases in a monorepo structure. ```bash pkl project package ./*/ ``` -------------------------------- ### Creating a new Release Source: https://github.com/crossplane-contrib/function-pkl/blob/main/README.md Instructions for creating new releases for both the Composition Function and Pkl Packages. This involves using CI actions and Git tagging conventions. ```shell #### Composition Function Run the [CI action](https://github.com/crossplane-contrib/function-pkl/actions/workflows/ci.yml) and provide a Package version. #### Pkl Packages Create a git tag in the style of @ e.g. `git tag crossplane.contrib@0.0.1` Push it `git push --tags` ``` -------------------------------- ### Package Project Artifacts Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This command packages the project into releasable artifacts. It creates distributable files that can be published or shared. ```bash pkl project package ``` -------------------------------- ### Define Pipeline Step with CompositionResponse Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This Pkl snippet demonstrates how to define a pipeline step by amending the `CompositionResponse.pkl`. It imports necessary modules and constructs a `crossplane` request object with custom resource templates. ```pkl import "@crossplane.contrib/crossplane.pkl" import "crds/XR.pkl" local request = new crossplane { customResourceTemplates = new { ["XR"] { ["example.crossplane.io/v1"] = XR } } }.Request ``` -------------------------------- ### Convert YAML Manifests to Modules using Pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This command illustrates converting YAML manifests into Pkl modules. It evaluates a Pkl script designed for this conversion and outputs the resulting modules to a specified directory. ```bash pkl eval crds/crd2module.pkl -m crds ``` -------------------------------- ### Generate Module from XRD using Pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This command demonstrates how to evaluate a Pkl file to generate a module, specifically converting an XRD to its Yaml manifest format. The `-m` flag specifies the output directory. ```bash pkl eval xrds/ExampleXR.pkl ``` -------------------------------- ### Generate Module from Pkl File Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This command shows how to generate a module from a Pkl file. It evaluates the specified Pkl file and outputs the generated module into the specified output directory. ```bash pkl eval xrds/xrd2module.pkl -m crds ``` -------------------------------- ### Resolve Project Dependencies Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This command resolves all project dependencies defined in the PklProject file. It downloads necessary packages and modules required for the project. ```bash pkl project resolve ``` -------------------------------- ### Development Commands Source: https://github.com/crossplane-contrib/function-pkl/blob/main/README.md Shell commands for developing the function-pkl project, including code generation, testing, building, pushing packages, resolving Pkl dependencies, and releasing. ```shell # Run code generation - see input/generate.go $ make generate # Run tests - see fn_test.go $ go test ./... # Build the function's runtime image and package it - see Dockerfile and package/crossplane.yaml $ make build-image # Push the Package to a registry $ crossplane xpkg push -f function-pkl*.xpkg ghcr.io/crossplane-contrib/function-pkl # Resolve Pkl Project Dependencies $ make pkl-resolve # Release a Pkl Project $ git tag crossplane.contrib@x.y.z $ git push --tags # Packages the Pkl Projects. Uses the latest existing git tags to version them. $ make pkl-package # Manually release a Pkl Package on github $ make pkl-release TAG=crossplane.contrib@x.y.z # Debugging this function # While a Debugging session is running run on the same host: $ crossplane beta render xr.yaml composition.yaml functions.yaml --verbose ``` -------------------------------- ### Resolve Dependencies for Multiple Projects Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This command resolves dependencies for multiple Pkl projects located in subdirectories. It's useful when a repository contains several independent Pkl projects with interdependencies. ```bash pkl project resolve ./*/ ``` -------------------------------- ### Create Composite Resource Definition (XRD) in Pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/pkl/crossplane.contrib.example/DEVELOP.md This snippet shows how to create a Composite Resource Definition (XRD) by amending a Pkl module. It specifies the Pkl package and the CompositeResourceDefinition resource to amend. ```pkl amends "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crospslane.contrib.xrd@#/CompositeResourceDefinition.pkl" ``` -------------------------------- ### Pkl - Amending with Raw Git Reference Source: https://github.com/crossplane-contrib/function-pkl/blob/main/example/git/README.md Demonstrates how to amend a Pkl file using a raw Git reference, pointing directly to a file within a Git repository instead of a released package. This is useful for development or when packages are not yet released. ```pkl // e.g. amends "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib@0.0.1#/CompositionResponse.pkl" // instead of amends "@crossplane.contrib/CompositionResponse.pkl" ``` -------------------------------- ### Configure Composition to use function-pkl Source: https://github.com/crossplane-contrib/function-pkl/blob/main/README.md YAML configuration for a Crossplane Composition that uses the function-pkl. It defines the pipeline steps, referencing the function and providing input configuration, including a Pkl URI. ```yaml apiVersion: apiextensions.crossplane.io/v1 kind: Composition metadata: name: function-pkl spec: compositeTypeRef: apiVersion: example.crossplane.io/v1 kind: XR mode: Pipeline pipeline: - step: run-the-template functionRef: name: function-pkl input: apiVersion: pkl.fn.crossplane.io/v1beta1 kind: Pkl spec: type: uri # This pkl file is at `pkl/crossplane.contrib.example/compositions/steps/full.pkl` in this repo uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.example@0.0.1#/compositions/steps/full.pkl" ``` -------------------------------- ### Pkl Function Flow Sequence Diagram Source: https://github.com/crossplane-contrib/function-pkl/blob/main/README.md A Mermaid sequence diagram illustrating the interaction between the Crossplane Composition Function and Pkl files during the execution of a composition. It shows how Pkl files are evaluated and how Crossplane requests are processed. ```mermaid sequenceDiagram participant fun as RunFunction box rgb(20, 100, 60) Pkl Files participant full.pkl as full.pkl participant c.pkl as crossplane.pkl end box rgb(20,60,100) CrossplaneReader participant c.r as crossplane:request end fun->>fun: Create Pkl Evaluator activate fun fun->>full.pkl: Evaluate Pkl File full.pkl->>c.pkl: import c.pkl->>full.pkl: Module with helper functions full.pkl->>+c.pkl: get CompositionRequest c.pkl->>c.r: Get RunFunctionRequest c.r->>c.pkl: Return it in yaml c.pkl->>c.pkl: convert from yaml to Pkl Objects c.pkl->>-full.pkl: return CompositionRequest full.pkl->>fun: Function Respone deactivate fun ``` -------------------------------- ### Generate Pkl Files Source: https://github.com/crossplane-contrib/function-pkl/blob/main/hack/pklcrd/README.md Commands to evaluate Pkl modules for Crossplane CRD to module conversion. ```shell pkl eval -m ../../pkl/crossplane-contrib crd2module.pkl pkl eval -m ../../pkl/crossplane-contrib crd2module-composition-fix.pkl ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.