github.com/oam-dev/kubevela@v1.9.11/charts/vela-core/templates/defwithtemplate/topologyspreadconstraints.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/internal/topologyspreadconstraints.cue 3 apiVersion: core.oam.dev/v1beta1 4 kind: TraitDefinition 5 metadata: 6 annotations: 7 definition.oam.dev/description: Add topology spread constraints hooks for every container of K8s pod for your workload which follows the pod spec in path 'spec.template'. 8 name: topologyspreadconstraints 9 namespace: {{ include "systemDefinitionNamespace" . }} 10 spec: 11 appliesToWorkloads: 12 - deployments.apps 13 - statefulsets.apps 14 - daemonsets.apps 15 - jobs.batch 16 podDisruptive: true 17 schematic: 18 cue: 19 template: | 20 constraintsArray: [ 21 for v in parameter.constraints { 22 maxSkew: v.maxSkew 23 topologyKey: v.topologyKey 24 whenUnsatisfiable: v.whenUnsatisfiable 25 labelSelector: v.labelSelector 26 if v.nodeAffinityPolicy != _|_ { 27 nodeAffinityPolicy: v.nodeAffinityPolicy 28 } 29 if v.nodeTaintsPolicy != _|_ { 30 nodeTaintsPolicy: v.nodeTaintsPolicy 31 } 32 if v.minDomains != _|_ { 33 minDomains: v.minDomains 34 } 35 if v.matchLabelKeys != _|_ { 36 matchLabelKeys: v.matchLabelKeys 37 } 38 }, 39 ] 40 patch: spec: template: spec: topologySpreadConstraints: constraintsArray 41 #labSelector: { 42 matchLabels?: [string]: string 43 matchExpressions?: [...{ 44 key: string 45 operator: *"In" | "NotIn" | "Exists" | "DoesNotExist" 46 values?: [...string] 47 }] 48 } 49 parameter: constraints: [...{ 50 // +usage=Describe the degree to which Pods may be unevenly distributed 51 maxSkew: int 52 // +usage=Specify the key of node labels 53 topologyKey: string 54 // +usage=Indicate how to deal with a Pod if it doesn't satisfy the spread constraint 55 whenUnsatisfiable: *"DoNotSchedule" | "ScheduleAnyway" 56 // +usage=labelSelector to find matching Pods 57 labelSelector: #labSelector 58 // +usage=Indicate a minimum number of eligible domains 59 minDomains?: int 60 // +usage=A list of pod label keys to select the pods over which spreading will be calculated 61 matchLabelKeys?: [...string] 62 // +usage=Indicate how we will treat Pod's nodeAffinity/nodeSelector when calculating pod topology spread skew 63 nodeAffinityPolicy?: *"Honor" | "Ignore" 64 // +usage=Indicate how we will treat node taints when calculating pod topology spread skew 65 nodeTaintsPolicy?: *"Honor" | "Ignore" 66 }] 67