-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcomposition.yaml
58 lines (57 loc) · 1.97 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
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xclusters.platform.acme.co
spec:
compositeTypeRef:
apiVersion: platform.acme.co/v1alpha1
kind: XCluster
mode: Pipeline
pipeline:
- step: compose
functionRef:
name: crossplane-contrib-function-kcl
input:
apiVersion: krm.kcl.dev/v1alpha1
kind: KCLRun
metadata:
name: compose-cluster
spec:
target: Resources
params:
name: "input-instance"
source: |
oxr = option("params").oxr
dxr = {
**oxr
status.dummy = "cool-status"
}
readyCondition = {
conditionStatus: "True"
conditionType: "Ready"
time: "5s"
} if (oxr.spec.parameters.networkRef.name) else {}
statusCondition = {
conditionStatus: "False"
conditionType: "Ready"
conditionReason: "Network reference is missing"
time: "0s"
} if not (oxr.spec.parameters.networkRef.name) else {}
items = [{
apiVersion: "nop.crossplane.io/v1alpha1"
kind: "NopResource"
metadata.name = oxr.metadata.name
spec.forProvider = {
conditionAfter = [readyCondition] if readyCondition else [statusCondition]
fields = {
initialNodeCount: oxr.spec.parameters.initialNodeCount
networkRef: oxr.spec.parameters.networkRef
subnetworkRef: oxr.spec.parameters.subnetworkRef
project: oxr.spec.parameters.project
location: oxr.spec.parameters.location
}
}
}]
- step: automatically-detect-ready-composed-resources
functionRef:
name: crossplane-contrib-function-auto-ready