-
Notifications
You must be signed in to change notification settings - Fork 0
/
composition.yaml
49 lines (47 loc) · 1.4 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
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: tester.trace-perf.crossplane.io
labels:
testCase: trace-perf
spec:
writeConnectionSecretsToNamespace: crossplane-system
compositeTypeRef:
apiVersion: trace-perf.crossplane.io/v1alpha1
kind: XTracePerf
mode: Pipeline
pipeline:
- step: render-with-kcl
functionRef:
name: function-kcl
input:
apiVersion: krm.kcl.dev/v1alpha1
kind: KCLRun
metadata:
name: resource
spec:
target: Resources
source: |
# Get the XR spec fields which are our user input
resourceCount = option("params")?.oxr?.spec?.resourceCount or 1
# Create number of objects according to spec.resourceCount
objects = [{
apiVersion = "kubernetes.crossplane.io/v1alpha2"
kind = "Object"
metadata.name = "object-{}".format(i)
spec.forProvider = {
manifest = {
apiVersion: "v1"
kind: "ConfigMap"
metadata.namespace = "default"
data: {
"key": "value-{}".format(i)
}
}
}
} for i in range(resourceCount)]
# return any created objects
items = objects
- step: ready
functionRef:
name: function-auto-ready