generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathcomposition.yaml
More file actions
52 lines (52 loc) · 1.74 KB
/
composition.yaml
File metadata and controls
52 lines (52 loc) · 1.74 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
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: example-extra-resources
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: meta.gotemplating.fn.crossplane.io/v1alpha1
kind: ExtraResources
requirements:
bucket:
apiVersion: s3.aws.upbound.io/v1beta1
kind: Bucket
matchName: my-awesome-{{ .observed.composite.resource.spec.environment }}-bucket
{{ $someExtraResources := getExtraResources . "bucket" }}
{{- range $i, $extraResource := default (list) $someExtraResources }}
---
apiVersion: kubernetes.crossplane.io/v1alpha1
kind: Object
metadata:
annotations:
gotemplating.fn.crossplane.io/composition-resource-name: bucket-configmap-{{ $i }}
spec:
forProvider:
manifest:
apiVersion: v1
kind: Configmap
metadata:
name: {{ $extraResource.resource.metadata.name }}-bucket
data:
bucket: {{ $extraResource.resource.status.atProvider.id }}
providerConfigRef:
name: "kubernetes"
{{- end }}
---
apiVersion: example.crossplane.io/v1beta1
kind: XR
status:
dummy: cool-status