github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/volumes.yaml (about) 1 # Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file. 2 # Definition source cue file: vela-templates/definitions/deprecated/volumes.cue 3 apiVersion: core.oam.dev/v1beta1 4 kind: TraitDefinition 5 metadata: 6 annotations: 7 definition.oam.dev/description: Add volumes on K8s pod for your workload which follows the pod spec in path 'spec.template'. This definition is DEPRECATED, please use 'storage' instead. 8 labels: 9 custom.definition.oam.dev/deprecated: "true" 10 name: volumes 11 namespace: {{ include "systemDefinitionNamespace" . }} 12 spec: 13 appliesToWorkloads: 14 - deployments.apps 15 podDisruptive: true 16 schematic: 17 cue: 18 template: | 19 patch: { 20 // +patchKey=name 21 spec: template: spec: volumes: [ 22 if parameter.volumes != _|_ for v in parameter.volumes { 23 { 24 name: v.name 25 if v.type == "pvc" { 26 persistentVolumeClaim: claimName: v.claimName 27 } 28 if v.type == "configMap" { 29 configMap: { 30 defaultMode: v.defaultMode 31 name: v.cmName 32 if v.items != _|_ { 33 items: v.items 34 } 35 } 36 } 37 if v.type == "secret" { 38 secret: { 39 defaultMode: v.defaultMode 40 secretName: v.secretName 41 if v.items != _|_ { 42 items: v.items 43 } 44 } 45 } 46 if v.type == "emptyDir" { 47 emptyDir: medium: v.medium 48 } 49 } 50 }, 51 ] 52 } 53 54 parameter: { 55 // +usage=Declare volumes and volumeMounts 56 volumes?: [...{ 57 name: string 58 // +usage=Specify volume type, options: "pvc","configMap","secret","emptyDir", default to emptyDir 59 type: *"emptyDir" | "pvc" | "configMap" | "secret" 60 if type == "pvc" { 61 claimName: string 62 } 63 if type == "configMap" { 64 defaultMode: *420 | int 65 cmName: string 66 items?: [...{ 67 key: string 68 path: string 69 mode: *511 | int 70 }] 71 } 72 if type == "secret" { 73 defaultMode: *420 | int 74 secretName: string 75 items?: [...{ 76 key: string 77 path: string 78 mode: *511 | int 79 }] 80 } 81 if type == "emptyDir" { 82 medium: *"" | "Memory" 83 } 84 }] 85 } 86