generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
130 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,6 @@ | |
|
||
# Go workspace file | ||
go.work | ||
|
||
# Binaries | ||
function-go-templating |
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,13 @@ | ||
--- | ||
# Use this function yaml when developing and executing the function directly instead of in a container | ||
# E.g. `go run . --insecure --debug --address=":9443"` | ||
|
||
apiVersion: pkg.crossplane.io/v1beta1 | ||
kind: Function | ||
metadata: | ||
name: function-go-templating | ||
annotations: | ||
render.crossplane.io/runtime: Development | ||
render.crossplane.io/runtime-development-target: localhost:9443 | ||
spec: | ||
package: xpkg.upbound.io/crossplane-contrib/function-go-templating:latest # ignored |
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,25 @@ | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: Composition | ||
metadata: | ||
name: example-function-from-yaml | ||
spec: | ||
compositeTypeRef: | ||
apiVersion: example.crossplane.io/v1beta1 | ||
kind: XR | ||
mode: Pipeline | ||
pipeline: | ||
- step: render-templates | ||
functionRef: | ||
name: function-go-templating | ||
input: | ||
apiVersion: gotemplating.fn.crossplane.io/v1beta1 | ||
kind: GoTemplate | ||
source: Inline | ||
inline: | ||
template: | | ||
--- | ||
apiVersion: {{ .observed.composite.resource.apiVersion }} | ||
kind: {{ .observed.composite.resource.kind }} | ||
status: | ||
# Extract single value from encoded yaml string | ||
dummy: {{ (.observed.composite.resource.spec.yamlBlob | fromYaml).key2 }} |
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,6 @@ | ||
apiVersion: pkg.crossplane.io/v1beta1 | ||
kind: Function | ||
metadata: | ||
name: function-go-templating | ||
spec: | ||
package: xpkg.upbound.io/crossplane-contrib/function-go-templating:latest |
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,9 @@ | ||
apiVersion: example.crossplane.io/v1beta1 | ||
kind: XR | ||
metadata: | ||
name: example | ||
spec: | ||
yamlBlob: | | ||
key1: value1 | ||
key2: value2 | ||
key3: value3 |
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,25 @@ | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: Composition | ||
metadata: | ||
name: example-function-to-yaml | ||
spec: | ||
compositeTypeRef: | ||
apiVersion: example.crossplane.io/v1beta1 | ||
kind: XR | ||
mode: Pipeline | ||
pipeline: | ||
- step: render-templates | ||
functionRef: | ||
name: function-go-templating | ||
input: | ||
apiVersion: gotemplating.fn.crossplane.io/v1beta1 | ||
kind: GoTemplate | ||
source: Inline | ||
inline: | ||
template: | | ||
--- | ||
apiVersion: {{ .observed.composite.resource.apiVersion }} | ||
kind: {{ .observed.composite.resource.kind }} | ||
status: | ||
# Copy the whole 'complexDictionary' as is by fomatting it as yaml | ||
dummy: {{ .observed.composite.resource.spec.complexDictionary | toYaml | nindent 7 }} |
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,6 @@ | ||
apiVersion: pkg.crossplane.io/v1beta1 | ||
kind: Function | ||
metadata: | ||
name: function-go-templating | ||
spec: | ||
package: xpkg.upbound.io/crossplane-contrib/function-go-templating:latest |
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,12 @@ | ||
apiVersion: example.crossplane.io/v1beta1 | ||
kind: XR | ||
metadata: | ||
name: example | ||
spec: | ||
complexDictionary: | ||
scalar1: true | ||
scalar2: text | ||
scalar3: 123 | ||
list: | ||
- abc | ||
- def |