generated from crossplane/function-template-go
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathcomposition.yaml
50 lines (48 loc) · 1.77 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
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: example-function-get-composed-resource
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: |
---
{{ $flexServerResourceName := "flexServer" }}
# Create an initial composed resource for which we will retrieve a value
apiVersion: dbforpostgresql.azure.upbound.io/v1beta1
kind: FlexibleServer
metadata:
annotations:
{{ setResourceNameAnnotation $flexServerResourceName }}
gotemplating.fn.crossplane.io/ready: "False"
spec:
forProvider:
storageMb: 32768
providerConfigRef:
name: my-provider-cfg
---
# Use getComposedResource to retrieve the observed resource named "flexServer"
{{ $flexServer := getComposedResource . $flexServerResourceName }}
apiVersion: dbforpostgresql.azure.upbound.io/v1beta1
kind: FlexibleServerConfiguration
metadata:
annotations:
{{ setResourceNameAnnotation "flexServerConfig" }}
gotemplating.fn.crossplane.io/ready: "False"
spec:
forProvider:
# Populate the field using the observed status of the retrieved resource
serverId: {{ get $flexServer.status "id" }}
providerConfigRef:
name: my-provider-cfg