Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update docs and move crd2module.pkl to the correct directory #27

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions pkl/crossplane.contrib.example/DEPLOY.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
```
18 changes: 9 additions & 9 deletions pkl/crossplane.contrib.example/DEVELOP.md
Original file line number Diff line number Diff line change
@@ -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@<version>#/CompositeResourceDefinition.pkl"
Expand All @@ -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 <filename> -m <outputDir>`.
This will create the Module in the Output directory. e.g. [crds/XR.pkl](crds/XR.pkl) was created by running:
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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/[email protected]/[email protected]

When the Package is released it can be used in the Composition.
See [example/full/composition.yaml](../../example/full/composition.yaml)
See [example/full/composition.yaml](../../example/full/composition.yaml)