github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/service-binding.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/internal/service-binding.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: TraitDefinition
     5  metadata:
     6    annotations:
     7      definition.oam.dev/description: Binding secrets of cloud resources to component env. This definition is DEPRECATED, please use 'storage' instead.
     8    labels:
     9      custom.definition.oam.dev/ui-hidden: "true"
    10    name: service-binding
    11    namespace: {{ include "systemDefinitionNamespace" . }}
    12  spec:
    13    appliesToWorkloads:
    14      - deployments.apps
    15      - statefulsets.apps
    16      - daemonsets.apps
    17      - jobs.batch
    18    schematic:
    19      cue:
    20        template: |
    21          patch: spec: template: spec: {
    22          	// +patchKey=name
    23          	containers: [{
    24          		name: context.name
    25          		// +patchKey=name
    26          		env: [
    27          			for envName, v in parameter.envMappings {
    28          				name: envName
    29          				valueFrom: secretKeyRef: {
    30          					name: v.secret
    31          					if v["key"] != _|_ {
    32          						key: v.key
    33          					}
    34          					if v["key"] == _|_ {
    35          						key: envName
    36          					}
    37          				}
    38          			},
    39          		]
    40          	}]
    41          }
    42  
    43          parameter: {
    44          	// +usage=The mapping of environment variables to secret
    45          	envMappings: [string]: #KeySecret
    46          }
    47          #KeySecret: {
    48          	key?:   string
    49          	secret: string
    50          }
    51