github.com/oam-dev/kubevela@v1.9.11/vela-templates/definitions/deprecated/node-affinity.cue (about)

     1  "node-affinity": {
     2  	type: "trait"
     3  	annotations: {}
     4  	labels: {
     5  		"ui-hidden":  "true"
     6  		"deprecated": "true"
     7  	}
     8  	description: "affinity specify node affinity and toleration on K8s pod for your workload which follows the pod spec in path 'spec.template'."
     9  	attributes: {
    10  		appliesToWorkloads: ["*"]
    11  		podDisruptive: true
    12  	}
    13  }
    14  template: {
    15  	patch: spec: template: spec: {
    16  		if parameter.affinity != _|_ {
    17  			affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
    18  				matchExpressions: [
    19  					for k, v in parameter.affinity {
    20  						key:      k
    21  						operator: "In"
    22  						values:   v
    23  					},
    24  				]}]
    25  		}
    26  		if parameter.tolerations != _|_ {
    27  			tolerations: [
    28  				for k, v in parameter.tolerations {
    29  					effect:   "NoSchedule"
    30  					key:      k
    31  					operator: "Equal"
    32  					value:    v
    33  				}]
    34  		}
    35  	}
    36  	parameter: {
    37  		affinity?: [string]: [...string]
    38  		tolerations?: [string]: string
    39  	}
    40  }