-
Notifications
You must be signed in to change notification settings - Fork 5
/
composition-pipeline.yaml
65 lines (65 loc) · 2.11 KB
/
composition-pipeline.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
63
64
65
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xcidrs.platform.upbound.io
spec:
compositeTypeRef:
apiVersion: platform.upbound.io/v1alpha1
kind: XCIDR
mode: Pipeline
pipeline:
- step: cidr-subnets-partitions
functionRef:
name: upbound-function-cidr
input:
apiVersion: cidr.fn.crossplane.io/v1beta1
kind: Parameters
cidrFunc: cidrsubnets
prefixField: spec.parameters.cidrBlock
newBits:
- 1
- 1
outputField: status.atFunction.cidr.partitions
- step: cidr-subnets-private
functionRef:
name: upbound-function-cidr
input:
apiVersion: cidr.fn.crossplane.io/v1beta1
kind: Parameters
cidrFunc: cidrsubnets
prefixField: desired.composite.resource.status.atFunction.cidr.partitions[0]
newBits:
- 1
- 1
outputField: status.atFunction.cidr.private.subnets
- step: cidr-subnets-public
functionRef:
name: upbound-function-cidr
input:
apiVersion: cidr.fn.crossplane.io/v1beta1
kind: Parameters
cidrFunc: cidrsubnets
prefixField: desired.composite.resource.status.atFunction.cidr.partitions[1]
newBits:
- 1
- 1
outputField: status.atFunction.cidr.public.subnets
## To debug the pipeline output you can generate a new resource which contains all attributes. Make sure to add function-go-templating to functions.yaml.
# - step: render-templates
# functionRef:
# name: function-go-templating
# input:
# apiVersion: gotemplate.fn.crossplane.io/v1beta1
# kind: GoTemplate
# source: Inline
# inline:
# template: |
# apiVersion: test.my-domain.com/v1alpha1
# kind: DebugResource
# metadata:
# annotations:
# gotemplating.fn.crossplane.io/composition-resource-name: debug
# debug:
# {{ . | toYaml | nindent 2 }}
# debugValue:
# {{ index .desired.composite.resource.status.atFunction.cidr.public.subnets 0 | nindent 2 }}