forked from crossplane-contrib/function-go-templating
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomposition.yaml
More file actions
58 lines (58 loc) · 1.94 KB
/
composition.yaml
File metadata and controls
58 lines (58 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: go-template-context.example.crossplane.io
spec:
compositeTypeRef:
apiVersion: example.crossplane.io/v1
kind: XR
mode: Pipeline
pipeline:
- step: environmentConfigs
functionRef:
name: crossplane-contrib-function-environment-configs
input:
apiVersion: environmentconfigs.fn.crossplane.io/v1beta1
kind: Input
spec:
environmentConfigs:
- type: Reference
ref:
name: example-config
- step: go-templating-update-context
functionRef:
name: crossplane-contrib-function-go-templating
input:
apiVersion: gotemplating.fn.crossplane.io/v1beta1
kind: GoTemplate
source: Inline
inline:
template: |
---
apiVersion: meta.gotemplating.fn.crossplane.io/v1alpha1
kind: Context
data:
# update existing EnvironmentConfig by using the "apiextensions.crossplane.io/environment" key
"apiextensions.crossplane.io/environment":
kind: Environment
apiVersion: internal.crossplane.io/v1alpha1
update: environment
nestedEnvUpdate:
hello: world
array:
- "1"
- "2"
# read existing context and move it to another key
"other-context-key":
complex: {{ index .context "apiextensions.crossplane.io/environment" "complex" | toYaml | nindent 6 }}
# Create a new Context key and populate it with data
newkey:
hello: world
---
apiVersion: example.crossplane.io/v1
kind: XR
status:
fromEnv: {{ index .context "apiextensions.crossplane.io/environment" "complex" "c" "d" }}
- step: automatically-detect-ready-composed-resources
functionRef:
name: crossplane-contrib-function-auto-ready