Skip to content

Commit

Permalink
Merge pull request #13 from Avarei/main
Browse files Browse the repository at this point in the history
Improve docs
  • Loading branch information
Avarei authored Jul 1, 2024
2 parents f52b0f2 + 076c239 commit 1d7fb0d
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ spec:
kind: Pkl
spec:
type: uri
# This pkl file is at `pkl/crossplane-example/full.pkl` in this repo
uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane-[email protected]#/full.pkl"
# This pkl file is at `pkl/crossplane.contrib.example/full.pkl` in this repo
uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.[email protected]#/full.pkl"
```
### Example
see [examples](./example/)
and see [pkl/crossplane.contrib.example/DEPLOY.md](pkl/crossplane.contrib.example/DEPLOY.md) on instructions how to deploy it.
## Creating a new Composition Function
see [pkl/crossplane.contrib.example/README.md](pkl/crossplane.contrib.example/README.md)
see [pkl/crossplane.contrib.example/DEVELOP.md](pkl/crossplane.contrib.example/DEVELOP.md)
## Development
This function uses [Go][go], [Docker][docker], the [Crossplane CLI][cli], and the [Pkl CLI][pkl cli] to build functions
Expand Down
4 changes: 2 additions & 2 deletions example/full/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ spec:
kind: Pkl
spec:
type: uri
# This pkl file is at `pkl/crossplane-example/full.pkl` in this repo
uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane-[email protected]#/full.pkl"
# This pkl file is at `pkl/crossplane.contrib.example/full.pkl` in this repo
uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.[email protected]#/full.pkl"
12 changes: 6 additions & 6 deletions example/inline/composition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ spec:
kind: Pkl
spec:
type: inline
# This pkl file is at `pkl/crossplane-example/full.pkl` in this repo
# This pkl file is at `pkl/crossplane.contrib.example/full.pkl` in this repo
inline: |
amends "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/[email protected]#/CompositionResponse.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/[email protected]#/Resource.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/[email protected]#/Crossplane.pkl"
amends "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib@1.0.0#/CompositionResponse.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib@1.0.0#/Resource.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib@1.0.0#/Crossplane.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane-[email protected]#/crds/XR.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane-[email protected]#/crds/Object.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.[email protected]#/crds/XR.pkl"
import "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.[email protected]#/crds/Object.pkl"
import "package://pkg.pkl-lang.org/pkl-k8s/[email protected]#/api/core/v1/ConfigMap.pkl"
Expand Down
29 changes: 29 additions & 0 deletions pkl/crossplane.contrib.example/DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Deploying this Example

## Prerequirements
* pkl cli
* crossplane in a cluster
* function-pkl deployed (see [here](../../README.md))
* provider-kubernetes deployed
* provider config for kubernetes provider called "default"

## Deploy XRD
```shell
cd pkl/pkl/crossplane.contrib.example
pkl eval xrds/ExampleXR.pkl | kubectl apply -f -
```
## Deploy Composition
```shell
kubectl apply -f ../../example/full/composition.yaml
```
## Deploy XR
```shell
kubectl apply -f ../../example/full/xr.yaml
```

## Check the Resource
```shell
kubectl get xrs.example.crossplane.io example-xr -oyaml

crossplane beta trace xrs example-xr
```
File renamed without changes.
2 changes: 1 addition & 1 deletion pkl/crossplane.contrib.example/xrds/ExampleXR.pkl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
amends "@crossplane.contrib.xrd/CompositeResourceDefinition.pkl"

metadata {
name = "XRD"
name = spec.names.plural + "." + spec.group
}

spec {
Expand Down

0 comments on commit 1d7fb0d

Please sign in to comment.