generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathcomposition.yaml
62 lines (62 loc) · 2.25 KB
/
composition.yaml
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
59
60
61
62
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: example-inline
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: |
{{- range $i := until ( .observed.composite.resource.spec.count | int ) }}
---
apiVersion: iam.aws.upbound.io/v1beta1
kind: User
metadata:
annotations:
{{ setResourceNameAnnotation (print "test-user-" $i) }}
labels:
testing.upbound.io/example-name: test-user-{{ $i }}
dummy: {{ dig "resources" (print "test-user-" $i) "resource" "metadata" "labels" "dummy" ( randomChoice "foo" "bar" "baz" ) $.observed }}
spec:
forProvider: {}
---
apiVersion: iam.aws.upbound.io/v1beta1
kind: AccessKey
metadata:
annotations:
{{ setResourceNameAnnotation (print "sample-access-key-" $i) }}
spec:
forProvider:
userSelector:
matchLabels:
testing.upbound.io/example-name: test-user-{{ $i }}
writeConnectionSecretToRef:
name: sample-access-key-secret-{{ $i }}
namespace: crossplane-system
{{- end }}
---
apiVersion: meta.gotemplating.fn.crossplane.io/v1alpha1
kind: CompositeConnectionDetails
{{ if eq $.observed.resources nil }}
data: {}
{{ else }}
data:
username: {{ ( index $.observed.resources "sample-access-key-0" ).connectionDetails.username }}
password: {{ ( index $.observed.resources "sample-access-key-0" ).connectionDetails.password }}
url: {{ "http://www.example.com" | b64enc }}
{{ end }}
---
apiVersion: example.crossplane.io/v1beta1
kind: XR
status:
dummy: cool-status