# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
# Definition source cue file: vela-templates/definitions/internal/annotations.cue
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
  annotations:
    definition.oam.dev/description: Add annotations on your workload. If it generates pod or job, add same annotations for generated pods.
  name: annotations
  namespace: {{ include "systemDefinitionNamespace" . }}
spec:
  appliesToWorkloads:
    - '*'
  podDisruptive: true
  schematic:
    cue:
      template: |
        // +patchStrategy=jsonMergePatch
        patch: {
        	let annotationsContent = {
        		for k, v in parameter {
        			(k): v
        		}
        	}

        	metadata: annotations: annotationsContent
        	if context.output.spec != _|_ if context.output.spec.template != _|_ {
        		spec: template: metadata: annotations: annotationsContent
        	}
        	if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ {
        		spec: jobTemplate: metadata: annotations: annotationsContent
        	}
        	if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ if context.output.spec.jobTemplate.spec != _|_ if context.output.spec.jobTemplate.spec.template != _|_ {
        		spec: jobTemplate: spec: template: metadata: annotations: annotationsContent
        	}
        }
        parameter: [string]: string | null

