github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/internal/trait/service-binding.cue (about) 1 "service-binding": { 2 type: "trait" 3 annotations: {} 4 labels: { 5 "ui-hidden": "true" 6 } 7 description: "Binding secrets of cloud resources to component env. This definition is DEPRECATED, please use 'storage' instead." 8 attributes: { 9 appliesToWorkloads: ["deployments.apps", "statefulsets.apps", "daemonsets.apps", "jobs.batch"] 10 } 11 } 12 template: { 13 patch: spec: template: spec: { 14 // +patchKey=name 15 containers: [{ 16 name: context.name 17 // +patchKey=name 18 env: [ 19 for envName, v in parameter.envMappings { 20 name: envName 21 valueFrom: secretKeyRef: { 22 name: v.secret 23 if v["key"] != _|_ { 24 key: v.key 25 } 26 if v["key"] == _|_ { 27 key: envName 28 } 29 } 30 }, 31 ] 32 }] 33 } 34 35 parameter: { 36 // +usage=The mapping of environment variables to secret 37 envMappings: [string]: #KeySecret 38 } 39 #KeySecret: { 40 key?: string 41 secret: string 42 } 43 }