github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/deprecated/configmap.cue (about)

     1  configmap: {
     2  	type: "trait"
     3  	annotations: {}
     4  	labels: {
     5  		"deprecated": "true"
     6  	}
     7  	description: "Create/Attach configmaps on K8s pod for your workload which follows the pod spec in path 'spec.template'. This definition is DEPRECATED, please specify configmap in 'storage' instead."
     8  	attributes: {
     9  		podDisruptive: true
    10  		appliesToWorkloads: ["*"]
    11  	}
    12  }
    13  template: {
    14  	patch: spec: template: spec: {
    15  		containers: [{
    16  			// +patchKey=name
    17  			volumeMounts: [
    18  				for v in parameter.volumes {
    19  					{
    20  						name:      "volume-\(v.name)"
    21  						mountPath: v.mountPath
    22  						readOnly:  v.readOnly
    23  					}
    24  				},
    25  			]
    26  		}, ...]
    27  		// +patchKey=name
    28  		volumes: [
    29  			for v in parameter.volumes {
    30  				{
    31  					name: "volume-\(v.name)"
    32  					configMap: name: v.name
    33  				}
    34  			},
    35  		]
    36  	}
    37  	outputs: {
    38  		for v in parameter.volumes {
    39  			if v.data != _|_ {
    40  				(v.name): {
    41  					apiVersion: "v1"
    42  					kind:       "ConfigMap"
    43  					metadata: name: v.name
    44  					data: v.data
    45  				}
    46  			}
    47  		}
    48  	}
    49  	parameter: {
    50  		// +usage=Specify mounted configmap names and their mount paths in the container
    51  		volumes: [...{
    52  			name:      string
    53  			mountPath: string
    54  			readOnly:  *false | bool
    55  			data?: [string]: string
    56  		}]
    57  	}
    58  }