github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/node-affinity.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/deprecated/node-affinity.cue
     3  apiVersion: core.oam.dev/v1beta1
     4  kind: TraitDefinition
     5  metadata:
     6    annotations:
     7      definition.oam.dev/description: affinity specify node affinity and toleration on K8s pod for your workload which follows the pod spec in path 'spec.template'.
     8    labels:
     9      custom.definition.oam.dev/deprecated: "true"
    10      custom.definition.oam.dev/ui-hidden: "true"
    11    name: node-affinity
    12    namespace: {{ include "systemDefinitionNamespace" . }}
    13  spec:
    14    appliesToWorkloads:
    15      - '*'
    16    podDisruptive: true
    17    schematic:
    18      cue:
    19        template: |
    20          patch: spec: template: spec: {
    21          	if parameter.affinity != _|_ {
    22          		affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
    23          			matchExpressions: [
    24          				for k, v in parameter.affinity {
    25          					key:      k
    26          					operator: "In"
    27          					values:   v
    28          				},
    29          			]}]
    30          	}
    31          	if parameter.tolerations != _|_ {
    32          		tolerations: [
    33          			for k, v in parameter.tolerations {
    34          				effect:   "NoSchedule"
    35          				key:      k
    36          				operator: "Equal"
    37          				value:    v
    38          			}]
    39          	}
    40          }
    41          parameter: {
    42          	affinity?: [string]: [...string]
    43          	tolerations?: [string]: string
    44          }
    45