github.com/oam-dev/kubevela@v1.9.11/docs/examples/insert-secret/insertsecret.yaml (about) 1 apiVersion: core.oam.dev/v1beta1 2 kind: ComponentDefinition 3 metadata: 4 name: secretconsumer 5 spec: 6 workload: 7 definition: 8 apiVersion: apps/v1 9 kind: Deployment 10 schematic: 11 cue: 12 template: | 13 output: { 14 apiVersion: "apps/v1" 15 kind: "Deployment" 16 spec: { 17 selector: matchLabels: { 18 "app.oam.dev/component": context.name 19 } 20 template: { 21 metadata: labels: { 22 "app.oam.dev/component": context.name 23 } 24 spec: { 25 containers: [{ 26 name: context.name 27 image: parameter.image 28 if parameter["dbSecret"] != _|_ { 29 env: [ 30 { 31 name: "username" 32 value: dbConn.username 33 }, 34 { 35 name: "DB_PASSWORD" 36 value: dbConn.password 37 }, 38 ] 39 } 40 }] 41 } 42 } 43 } 44 } 45 46 parameter: { 47 // +usage=Which image would you like to use for your service 48 // +short=i 49 image: string 50 51 // +usage=Referred db secret 52 // +insertSecretTo=dbConn 53 dbSecret?: string 54 } 55 56 dbConn: { 57 username: string 58 password: string 59 }