-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathpatch-volume.yaml
57 lines (53 loc) · 1.37 KB
/
patch-volume.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
# Code generated by KubeVela templates. DO NOT EDIT.
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
annotations:
definition.oam.dev/description: "Mount empty volumes to container."
name: patch-volume
spec:
appliesToWorkloads:
- webservice
- worker
- microservice
schematic:
cue:
template: |-
patch: {
spec: template: spec: {
// +patchKey=name
containers: [{
name: context.name
// +patchKey=name
volumeMounts: [
for volumeMount in parameter.volumeMounts {
name: volumeMount.name
mountPath: volumeMount.path
},
]
}]
// +patchKey=name
volumes: [
for volumeMount in parameter.volumeMounts {
name: volumeMount.name
emptyDir: {
if volumeMount.medium != _|_ {
medium: volumeMount.medium
}
if volumeMount.sizeLimit != _|_ {
sizeLimit: volumeMount.sizeLimit
}
}
},
]
}
}
#VolumeMount: {
name: string
path: string
medium?: string
sizeLimit?: string
}
parameter: {
volumeMounts: [...#VolumeMount]
}