github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/internal/trait/annotations.cue (about) 1 annotations: { 2 type: "trait" 3 annotations: {} 4 description: "Add annotations on your workload. If it generates pod or job, add same annotations for generated pods." 5 attributes: { 6 podDisruptive: true 7 appliesToWorkloads: ["*"] 8 } 9 } 10 template: { 11 // +patchStrategy=jsonMergePatch 12 patch: { 13 let annotationsContent = { 14 for k, v in parameter { 15 (k): v 16 } 17 } 18 19 metadata: { 20 annotations: annotationsContent 21 } 22 if context.output.spec != _|_ if context.output.spec.template != _|_ { 23 spec: template: metadata: annotations: annotationsContent 24 } 25 if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ { 26 spec: jobTemplate: metadata: annotations: annotationsContent 27 } 28 if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ if context.output.spec.jobTemplate.spec != _|_ if context.output.spec.jobTemplate.spec.template != _|_ { 29 spec: jobTemplate: spec: template: metadata: annotations: annotationsContent 30 } 31 } 32 parameter: [string]: string | null 33 }