-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from Avarei/refactor/examples
Refactor/examples
- Loading branch information
Showing
25 changed files
with
309 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,8 @@ spec: | |
kind: Pkl | ||
spec: | ||
type: uri | ||
# 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/[email protected]#/full.pkl" | ||
# 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/[email protected]#/compositions/steps/full.pkl" | ||
``` | ||
### Example | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: Composition | ||
metadata: | ||
name: function-pkl | ||
name: pkl-uri-example | ||
spec: | ||
compositeTypeRef: | ||
apiVersion: example.crossplane.io/v1 | ||
kind: XR | ||
mode: Pipeline | ||
pipeline: | ||
- step: run-the-template | ||
functionRef: | ||
- 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/full.pkl` in this repo | ||
uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/[email protected]#/full.pkl" | ||
uri: package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/crossplane.contrib.example@0.0.0#/compositions/steps/full.pkl | ||
step: pkl-template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Replace this with your XR! | ||
apiVersion: example.crossplane.io/v1 | ||
kind: XR | ||
spec: | ||
compositionRef: | ||
name: pkl-uri-example | ||
metadata: | ||
name: example-xr | ||
spec: {} | ||
name: uri-example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Replace this with your XR! | ||
apiVersion: example.crossplane.io/v1 | ||
kind: XR | ||
spec: | ||
compositionRef: | ||
name: inline-example | ||
metadata: | ||
name: example-xr | ||
spec: {} | ||
name: inline-example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,5 @@ spec: | |
kind: Pkl | ||
spec: | ||
type: uri | ||
# This pkl file is at `pkl/crossplane-example/minimal.pkl` in this repo | ||
uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/[email protected]#/minimal.pkl" | ||
# This pkl file is at `pkl/crossplane-example/compositions/steps/minimal.pkl` in this repo | ||
uri: "package://pkg.pkl-lang.org/github.com/crossplane-contrib/function-pkl/[email protected]#/compositions/steps/minimal.pkl" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
pkl/crossplane.contrib.example/compositions/steps/event.pkl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
amends "@crossplane.contrib/CompositionResponse.pkl" | ||
import "@crossplane.contrib/crossplane.pkl" | ||
|
||
import ".../crds/XR.pkl" | ||
import ".../crds/Object.pkl" | ||
|
||
local request = new crossplane { | ||
customResourceTemplates = new { | ||
["XR"] { | ||
["example.crossplane.io/v1"] = XR | ||
} | ||
["Object"] { | ||
["kubernetes.crossplane.io/v1alpha2"] = Object | ||
} | ||
} | ||
}.Request | ||
|
||
// Pass through the Desired state from previous pipeline steps | ||
desired = request.desired | ||
|
||
results { | ||
new { | ||
severity = SEVERITY_WARNING | ||
message = "I am an Event from Pkl!" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
pkl/crossplane.contrib.example/minimal.pkl → ...ib.example/compositions/steps/minimal.pkl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
amends "@crossplane.contrib/Composition.pkl" | ||
import "@crossplane.contrib/Pkl.pkl" | ||
|
||
import "../crds/XR.pkl" | ||
import ".../PklProject" | ||
|
||
metadata { | ||
name = "pkl-uri-example" | ||
} | ||
spec { | ||
compositeTypeRef { | ||
apiVersion = XR.apiVersion | ||
kind = XR.kind | ||
} | ||
mode = "Pipeline" | ||
pipeline { | ||
new { | ||
step = "pkl-template" | ||
functionRef { | ||
name = "function-pkl" | ||
} | ||
input = new Pkl { | ||
spec { | ||
type = "uri" | ||
uri = PklProject.package.baseUri + "@" + PklProject.package.version + "#/compositions/steps/full.pkl" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
amends "../crds/XR.pkl" | ||
|
||
metadata { | ||
name = "inline-example" | ||
} | ||
|
||
spec { | ||
compositionRef { | ||
name = import("../compositions/inline.pkl").metadata.name!! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
amends "../crds/XR.pkl" | ||
|
||
metadata { | ||
name = "uri-example" | ||
} | ||
|
||
spec { | ||
compositionRef { | ||
name = import("../compositions/uri.pkl").metadata.name!! | ||
} | ||
} |
Oops, something went wrong.