mirror of
https://github.com/kubevela/kubevela.git
synced 2026-05-06 09:27:16 +00:00
* add podDisruptive to traitdefinition * fix docs & example * fix diff and add docs * use bool type for podDisruptive Co-authored-by: 天元 <jianbo.sjb@alibaba-inc.com>
42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
apiVersion: core.oam.dev/v1beta1
|
|
kind: TraitDefinition
|
|
metadata:
|
|
annotations:
|
|
definition.oam.dev/description: "affinity specify node affinity and toleration"
|
|
name: node-affinity
|
|
namespace: vela-system
|
|
spec:
|
|
appliesToWorkloads:
|
|
- webservice
|
|
- worker
|
|
podDisruptive: true
|
|
schematic:
|
|
cue:
|
|
template: |-
|
|
patch: {
|
|
spec: template: spec: {
|
|
if parameter.affinity != _|_ {
|
|
affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: [{
|
|
matchExpressions: [
|
|
for k, v in parameter.affinity {
|
|
key: k
|
|
operator: "In"
|
|
values: v
|
|
},
|
|
]}]
|
|
}
|
|
if parameter.tolerations != _|_ {
|
|
tolerations: [
|
|
for k, v in parameter.tolerations {
|
|
effect: "NoSchedule"
|
|
key: k
|
|
operator: "Equal"
|
|
value: v
|
|
}]
|
|
}
|
|
}
|
|
}
|
|
parameter: {
|
|
affinity?: [string]: [...string]
|
|
tolerations?: [string]: string
|
|
} |