Skip to content

Commit

Permalink
Merge pull request #34 from Avarei/docs/add-https-git-example
Browse files Browse the repository at this point in the history
add https example using git references without pkl package releases
  • Loading branch information
Avarei authored Jul 18, 2024
2 parents c8b4f77 + 4d5e328 commit 541fa17
Show file tree
Hide file tree
Showing 11 changed files with 507 additions and 11 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ spec:
### Example
see [examples](./example/)
and see [pkl/crossplane.contrib.example/DEPLOY.md](pkl/crossplane.contrib.example/DEPLOY.md) on instructions how to deploy it.
and see [pkl/crossplane.contrib.example/DEPLOY.md](pkl/crossplane.contrib.example/DEPLOY.md) on instructions how to deploy using Pkl Packages.
Alternatively [example/git/README.md](example/git/README.md) shows an appraoch without releasing Packages.
## Creating a new Composition Function
see [pkl/crossplane.contrib.example/DEVELOP.md](pkl/crossplane.contrib.example/DEVELOP.md)
Expand Down
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ $ go run . --insecure --debug

```shell
# Then, in another terminal, call it with these example manifests
$ crossplane beta render xr.yaml composition.yaml functions.yaml --observed-resources=observed.yaml
$ crossplane beta render xr.yaml composition.yaml functions.yaml
```
9 changes: 0 additions & 9 deletions example/full/observed.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions example/git/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Using Raw Git References
Instead of releasing a Pkl Package this approach reads directly from a git repository.

Currently this method does ot support PklProject dependencies, meaning all dependencies must be declared explicitely.

```pkl
// e.g.
amends "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/[email protected]#/CompositionResponse.pkl"
// instead of
amends "@crossplane.contrib/CompositionResponse.pkl"
```

For more information about Generating the Pkl Modules, XRDs, and Compositions see [DEVELOP.md](../../pkl/crossplane.contrib.example/DEVELOP.md)
19 changes: 19 additions & 0 deletions example/git/composition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: pkl-git-example
spec:
compositeTypeRef:
apiVersion: example.crossplane.io/v1
kind: XR
mode: Pipeline
pipeline:
- functionRef:
name: function-pkl
input:
apiVersion: pkl.fn.crossplane.io/v1beta1
kind: Pkl
spec:
type: uri
uri: https://raw.githubusercontent.com/crossplane-contrib/function-pkl/main/example/git/pkl/step.pkl
step: pkl-template
5 changes: 5 additions & 0 deletions example/git/extraresources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
apiVersion: kubernetes.crossplane.io/v1alpha2
kind: Object
metadata:
name: required
11 changes: 11 additions & 0 deletions example/git/functions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
apiVersion: pkg.crossplane.io/v1beta1
kind: Function
metadata:
name: function-pkl
annotations:
# This tells crossplane beta render to connect to the function locally.
render.crossplane.io/runtime: Development
spec:
# This is ignored when using the Development runtime.
package: function-pkl
Loading

0 comments on commit 541fa17

Please sign in to comment.