Add topologySpreadConstraints (#814)
This commit is contained in:
		
							parent
							
								
									5805e39e1f
								
							
						
					
					
						commit
						fce7d6d2a7
					
				|  | @ -823,6 +823,14 @@ spec: | ||||||
|         key: node-role.kubernetes.io/test |         key: node-role.kubernetes.io/test | ||||||
|         operator: Exists |         operator: Exists | ||||||
| 
 | 
 | ||||||
|  |       topologySpreadConstraints: | ||||||
|  |         - maxSkew: 1 | ||||||
|  |           topologyKey: kubernetes.io/hostname | ||||||
|  |           whenUnsatisfiable: ScheduleAnyway | ||||||
|  |           labelSelector: | ||||||
|  |             matchLabels: | ||||||
|  |               runner-deployment-name: actions-runner | ||||||
|  | 
 | ||||||
|       repository: mumoshu/actions-runner-controller-ci |       repository: mumoshu/actions-runner-controller-ci | ||||||
|       # The default "summerwind/actions-runner" images are available at DockerHub: |       # The default "summerwind/actions-runner" images are available at DockerHub: | ||||||
|       #  https://hub.docker.com/r/summerwind/actions-runner |       #  https://hub.docker.com/r/summerwind/actions-runner | ||||||
|  |  | ||||||
|  | @ -141,6 +141,9 @@ type RunnerPodSpec struct { | ||||||
| 	// +optional
 | 	// +optional
 | ||||||
| 	HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"` | 	HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"` | ||||||
| 
 | 
 | ||||||
|  | 	// +optional
 | ||||||
|  | 	TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraint,omitempty"` | ||||||
|  | 
 | ||||||
| 	// RuntimeClassName is the container runtime configuration that containers should run under.
 | 	// RuntimeClassName is the container runtime configuration that containers should run under.
 | ||||||
| 	// More info: https://kubernetes.io/docs/concepts/containers/runtime-class
 | 	// More info: https://kubernetes.io/docs/concepts/containers/runtime-class
 | ||||||
| 	// +optional
 | 	// +optional
 | ||||||
|  |  | ||||||
|  | @ -707,6 +707,13 @@ func (in *RunnerPodSpec) DeepCopyInto(out *RunnerPodSpec) { | ||||||
| 			(*in)[i].DeepCopyInto(&(*out)[i]) | 			(*in)[i].DeepCopyInto(&(*out)[i]) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | 	if in.TopologySpreadConstraints != nil { | ||||||
|  | 		in, out := &in.TopologySpreadConstraints, &out.TopologySpreadConstraints | ||||||
|  | 		*out = make([]v1.TopologySpreadConstraint, len(*in)) | ||||||
|  | 		for i := range *in { | ||||||
|  | 			(*in)[i].DeepCopyInto(&(*out)[i]) | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| 	if in.RuntimeClassName != nil { | 	if in.RuntimeClassName != nil { | ||||||
| 		in, out := &in.RuntimeClassName, &out.RuntimeClassName | 		in, out := &in.RuntimeClassName, &out.RuntimeClassName | ||||||
| 		*out = new(string) | 		*out = new(string) | ||||||
|  |  | ||||||
|  | @ -3898,6 +3898,56 @@ spec: | ||||||
|                                 type: string |                                 type: string | ||||||
|                             type: object |                             type: object | ||||||
|                           type: array |                           type: array | ||||||
|  |                         topologySpreadConstraint: | ||||||
|  |                           items: | ||||||
|  |                             description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. | ||||||
|  |                             properties: | ||||||
|  |                               labelSelector: | ||||||
|  |                                 description: LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. | ||||||
|  |                                 properties: | ||||||
|  |                                   matchExpressions: | ||||||
|  |                                     description: matchExpressions is a list of label selector requirements. The requirements are ANDed. | ||||||
|  |                                     items: | ||||||
|  |                                       description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. | ||||||
|  |                                       properties: | ||||||
|  |                                         key: | ||||||
|  |                                           description: key is the label key that the selector applies to. | ||||||
|  |                                           type: string | ||||||
|  |                                         operator: | ||||||
|  |                                           description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. | ||||||
|  |                                           type: string | ||||||
|  |                                         values: | ||||||
|  |                                           description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. | ||||||
|  |                                           items: | ||||||
|  |                                             type: string | ||||||
|  |                                           type: array | ||||||
|  |                                       required: | ||||||
|  |                                         - key | ||||||
|  |                                         - operator | ||||||
|  |                                       type: object | ||||||
|  |                                     type: array | ||||||
|  |                                   matchLabels: | ||||||
|  |                                     additionalProperties: | ||||||
|  |                                       type: string | ||||||
|  |                                     description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. | ||||||
|  |                                     type: object | ||||||
|  |                                 type: object | ||||||
|  |                               maxSkew: | ||||||
|  |                                 description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 1/1/0: | zone1 | zone2 | zone3 | |   P   |   P   |       | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 1/1/1; scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It''s a required field. Default value is 1 and 0 is not allowed.' | ||||||
|  |                                 format: int32 | ||||||
|  |                                 type: integer | ||||||
|  |                               topologyKey: | ||||||
|  |                                 description: TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each <key, value> as a "bucket", and try to put balanced number of pods into each bucket. It's a required field. | ||||||
|  |                                 type: string | ||||||
|  |                               whenUnsatisfiable: | ||||||
|  |                                 description: 'WhenUnsatisfiable indicates how to deal with a pod if it doesn''t satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location,   but giving higher precedence to topologies that would help reduce the   skew. A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assigment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P |   P   |   P   | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won''t make it *more* imbalanced. It''s a required field.' | ||||||
|  |                                 type: string | ||||||
|  |                             required: | ||||||
|  |                               - maxSkew | ||||||
|  |                               - topologyKey | ||||||
|  |                               - whenUnsatisfiable | ||||||
|  |                             type: object | ||||||
|  |                           type: array | ||||||
|                         volumeMounts: |                         volumeMounts: | ||||||
|                           items: |                           items: | ||||||
|                             description: VolumeMount describes a mounting of a Volume within a container. |                             description: VolumeMount describes a mounting of a Volume within a container. | ||||||
|  |  | ||||||
|  | @ -3895,6 +3895,56 @@ spec: | ||||||
|                                 type: string |                                 type: string | ||||||
|                             type: object |                             type: object | ||||||
|                           type: array |                           type: array | ||||||
|  |                         topologySpreadConstraint: | ||||||
|  |                           items: | ||||||
|  |                             description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. | ||||||
|  |                             properties: | ||||||
|  |                               labelSelector: | ||||||
|  |                                 description: LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. | ||||||
|  |                                 properties: | ||||||
|  |                                   matchExpressions: | ||||||
|  |                                     description: matchExpressions is a list of label selector requirements. The requirements are ANDed. | ||||||
|  |                                     items: | ||||||
|  |                                       description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. | ||||||
|  |                                       properties: | ||||||
|  |                                         key: | ||||||
|  |                                           description: key is the label key that the selector applies to. | ||||||
|  |                                           type: string | ||||||
|  |                                         operator: | ||||||
|  |                                           description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. | ||||||
|  |                                           type: string | ||||||
|  |                                         values: | ||||||
|  |                                           description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. | ||||||
|  |                                           items: | ||||||
|  |                                             type: string | ||||||
|  |                                           type: array | ||||||
|  |                                       required: | ||||||
|  |                                         - key | ||||||
|  |                                         - operator | ||||||
|  |                                       type: object | ||||||
|  |                                     type: array | ||||||
|  |                                   matchLabels: | ||||||
|  |                                     additionalProperties: | ||||||
|  |                                       type: string | ||||||
|  |                                     description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. | ||||||
|  |                                     type: object | ||||||
|  |                                 type: object | ||||||
|  |                               maxSkew: | ||||||
|  |                                 description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 1/1/0: | zone1 | zone2 | zone3 | |   P   |   P   |       | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 1/1/1; scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It''s a required field. Default value is 1 and 0 is not allowed.' | ||||||
|  |                                 format: int32 | ||||||
|  |                                 type: integer | ||||||
|  |                               topologyKey: | ||||||
|  |                                 description: TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each <key, value> as a "bucket", and try to put balanced number of pods into each bucket. It's a required field. | ||||||
|  |                                 type: string | ||||||
|  |                               whenUnsatisfiable: | ||||||
|  |                                 description: 'WhenUnsatisfiable indicates how to deal with a pod if it doesn''t satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location,   but giving higher precedence to topologies that would help reduce the   skew. A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assigment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P |   P   |   P   | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won''t make it *more* imbalanced. It''s a required field.' | ||||||
|  |                                 type: string | ||||||
|  |                             required: | ||||||
|  |                               - maxSkew | ||||||
|  |                               - topologyKey | ||||||
|  |                               - whenUnsatisfiable | ||||||
|  |                             type: object | ||||||
|  |                           type: array | ||||||
|                         volumeMounts: |                         volumeMounts: | ||||||
|                           items: |                           items: | ||||||
|                             description: VolumeMount describes a mounting of a Volume within a container. |                             description: VolumeMount describes a mounting of a Volume within a container. | ||||||
|  |  | ||||||
|  | @ -3841,6 +3841,56 @@ spec: | ||||||
|                         type: string |                         type: string | ||||||
|                     type: object |                     type: object | ||||||
|                   type: array |                   type: array | ||||||
|  |                 topologySpreadConstraint: | ||||||
|  |                   items: | ||||||
|  |                     description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. | ||||||
|  |                     properties: | ||||||
|  |                       labelSelector: | ||||||
|  |                         description: LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. | ||||||
|  |                         properties: | ||||||
|  |                           matchExpressions: | ||||||
|  |                             description: matchExpressions is a list of label selector requirements. The requirements are ANDed. | ||||||
|  |                             items: | ||||||
|  |                               description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. | ||||||
|  |                               properties: | ||||||
|  |                                 key: | ||||||
|  |                                   description: key is the label key that the selector applies to. | ||||||
|  |                                   type: string | ||||||
|  |                                 operator: | ||||||
|  |                                   description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. | ||||||
|  |                                   type: string | ||||||
|  |                                 values: | ||||||
|  |                                   description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. | ||||||
|  |                                   items: | ||||||
|  |                                     type: string | ||||||
|  |                                   type: array | ||||||
|  |                               required: | ||||||
|  |                                 - key | ||||||
|  |                                 - operator | ||||||
|  |                               type: object | ||||||
|  |                             type: array | ||||||
|  |                           matchLabels: | ||||||
|  |                             additionalProperties: | ||||||
|  |                               type: string | ||||||
|  |                             description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. | ||||||
|  |                             type: object | ||||||
|  |                         type: object | ||||||
|  |                       maxSkew: | ||||||
|  |                         description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 1/1/0: | zone1 | zone2 | zone3 | |   P   |   P   |       | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 1/1/1; scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It''s a required field. Default value is 1 and 0 is not allowed.' | ||||||
|  |                         format: int32 | ||||||
|  |                         type: integer | ||||||
|  |                       topologyKey: | ||||||
|  |                         description: TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each <key, value> as a "bucket", and try to put balanced number of pods into each bucket. It's a required field. | ||||||
|  |                         type: string | ||||||
|  |                       whenUnsatisfiable: | ||||||
|  |                         description: 'WhenUnsatisfiable indicates how to deal with a pod if it doesn''t satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location,   but giving higher precedence to topologies that would help reduce the   skew. A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assigment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P |   P   |   P   | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won''t make it *more* imbalanced. It''s a required field.' | ||||||
|  |                         type: string | ||||||
|  |                     required: | ||||||
|  |                       - maxSkew | ||||||
|  |                       - topologyKey | ||||||
|  |                       - whenUnsatisfiable | ||||||
|  |                     type: object | ||||||
|  |                   type: array | ||||||
|                 volumeMounts: |                 volumeMounts: | ||||||
|                   items: |                   items: | ||||||
|                     description: VolumeMount describes a mounting of a Volume within a container. |                     description: VolumeMount describes a mounting of a Volume within a container. | ||||||
|  |  | ||||||
|  | @ -3898,6 +3898,56 @@ spec: | ||||||
|                                 type: string |                                 type: string | ||||||
|                             type: object |                             type: object | ||||||
|                           type: array |                           type: array | ||||||
|  |                         topologySpreadConstraint: | ||||||
|  |                           items: | ||||||
|  |                             description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. | ||||||
|  |                             properties: | ||||||
|  |                               labelSelector: | ||||||
|  |                                 description: LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. | ||||||
|  |                                 properties: | ||||||
|  |                                   matchExpressions: | ||||||
|  |                                     description: matchExpressions is a list of label selector requirements. The requirements are ANDed. | ||||||
|  |                                     items: | ||||||
|  |                                       description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. | ||||||
|  |                                       properties: | ||||||
|  |                                         key: | ||||||
|  |                                           description: key is the label key that the selector applies to. | ||||||
|  |                                           type: string | ||||||
|  |                                         operator: | ||||||
|  |                                           description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. | ||||||
|  |                                           type: string | ||||||
|  |                                         values: | ||||||
|  |                                           description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. | ||||||
|  |                                           items: | ||||||
|  |                                             type: string | ||||||
|  |                                           type: array | ||||||
|  |                                       required: | ||||||
|  |                                         - key | ||||||
|  |                                         - operator | ||||||
|  |                                       type: object | ||||||
|  |                                     type: array | ||||||
|  |                                   matchLabels: | ||||||
|  |                                     additionalProperties: | ||||||
|  |                                       type: string | ||||||
|  |                                     description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. | ||||||
|  |                                     type: object | ||||||
|  |                                 type: object | ||||||
|  |                               maxSkew: | ||||||
|  |                                 description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 1/1/0: | zone1 | zone2 | zone3 | |   P   |   P   |       | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 1/1/1; scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It''s a required field. Default value is 1 and 0 is not allowed.' | ||||||
|  |                                 format: int32 | ||||||
|  |                                 type: integer | ||||||
|  |                               topologyKey: | ||||||
|  |                                 description: TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each <key, value> as a "bucket", and try to put balanced number of pods into each bucket. It's a required field. | ||||||
|  |                                 type: string | ||||||
|  |                               whenUnsatisfiable: | ||||||
|  |                                 description: 'WhenUnsatisfiable indicates how to deal with a pod if it doesn''t satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location,   but giving higher precedence to topologies that would help reduce the   skew. A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assigment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P |   P   |   P   | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won''t make it *more* imbalanced. It''s a required field.' | ||||||
|  |                                 type: string | ||||||
|  |                             required: | ||||||
|  |                               - maxSkew | ||||||
|  |                               - topologyKey | ||||||
|  |                               - whenUnsatisfiable | ||||||
|  |                             type: object | ||||||
|  |                           type: array | ||||||
|                         volumeMounts: |                         volumeMounts: | ||||||
|                           items: |                           items: | ||||||
|                             description: VolumeMount describes a mounting of a Volume within a container. |                             description: VolumeMount describes a mounting of a Volume within a container. | ||||||
|  |  | ||||||
|  | @ -3895,6 +3895,56 @@ spec: | ||||||
|                                 type: string |                                 type: string | ||||||
|                             type: object |                             type: object | ||||||
|                           type: array |                           type: array | ||||||
|  |                         topologySpreadConstraint: | ||||||
|  |                           items: | ||||||
|  |                             description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. | ||||||
|  |                             properties: | ||||||
|  |                               labelSelector: | ||||||
|  |                                 description: LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. | ||||||
|  |                                 properties: | ||||||
|  |                                   matchExpressions: | ||||||
|  |                                     description: matchExpressions is a list of label selector requirements. The requirements are ANDed. | ||||||
|  |                                     items: | ||||||
|  |                                       description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. | ||||||
|  |                                       properties: | ||||||
|  |                                         key: | ||||||
|  |                                           description: key is the label key that the selector applies to. | ||||||
|  |                                           type: string | ||||||
|  |                                         operator: | ||||||
|  |                                           description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. | ||||||
|  |                                           type: string | ||||||
|  |                                         values: | ||||||
|  |                                           description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. | ||||||
|  |                                           items: | ||||||
|  |                                             type: string | ||||||
|  |                                           type: array | ||||||
|  |                                       required: | ||||||
|  |                                         - key | ||||||
|  |                                         - operator | ||||||
|  |                                       type: object | ||||||
|  |                                     type: array | ||||||
|  |                                   matchLabels: | ||||||
|  |                                     additionalProperties: | ||||||
|  |                                       type: string | ||||||
|  |                                     description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. | ||||||
|  |                                     type: object | ||||||
|  |                                 type: object | ||||||
|  |                               maxSkew: | ||||||
|  |                                 description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 1/1/0: | zone1 | zone2 | zone3 | |   P   |   P   |       | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 1/1/1; scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It''s a required field. Default value is 1 and 0 is not allowed.' | ||||||
|  |                                 format: int32 | ||||||
|  |                                 type: integer | ||||||
|  |                               topologyKey: | ||||||
|  |                                 description: TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each <key, value> as a "bucket", and try to put balanced number of pods into each bucket. It's a required field. | ||||||
|  |                                 type: string | ||||||
|  |                               whenUnsatisfiable: | ||||||
|  |                                 description: 'WhenUnsatisfiable indicates how to deal with a pod if it doesn''t satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location,   but giving higher precedence to topologies that would help reduce the   skew. A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assigment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P |   P   |   P   | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won''t make it *more* imbalanced. It''s a required field.' | ||||||
|  |                                 type: string | ||||||
|  |                             required: | ||||||
|  |                               - maxSkew | ||||||
|  |                               - topologyKey | ||||||
|  |                               - whenUnsatisfiable | ||||||
|  |                             type: object | ||||||
|  |                           type: array | ||||||
|                         volumeMounts: |                         volumeMounts: | ||||||
|                           items: |                           items: | ||||||
|                             description: VolumeMount describes a mounting of a Volume within a container. |                             description: VolumeMount describes a mounting of a Volume within a container. | ||||||
|  |  | ||||||
|  | @ -3841,6 +3841,56 @@ spec: | ||||||
|                         type: string |                         type: string | ||||||
|                     type: object |                     type: object | ||||||
|                   type: array |                   type: array | ||||||
|  |                 topologySpreadConstraint: | ||||||
|  |                   items: | ||||||
|  |                     description: TopologySpreadConstraint specifies how to spread matching pods among the given topology. | ||||||
|  |                     properties: | ||||||
|  |                       labelSelector: | ||||||
|  |                         description: LabelSelector is used to find matching pods. Pods that match this label selector are counted to determine the number of pods in their corresponding topology domain. | ||||||
|  |                         properties: | ||||||
|  |                           matchExpressions: | ||||||
|  |                             description: matchExpressions is a list of label selector requirements. The requirements are ANDed. | ||||||
|  |                             items: | ||||||
|  |                               description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values. | ||||||
|  |                               properties: | ||||||
|  |                                 key: | ||||||
|  |                                   description: key is the label key that the selector applies to. | ||||||
|  |                                   type: string | ||||||
|  |                                 operator: | ||||||
|  |                                   description: operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. | ||||||
|  |                                   type: string | ||||||
|  |                                 values: | ||||||
|  |                                   description: values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch. | ||||||
|  |                                   items: | ||||||
|  |                                     type: string | ||||||
|  |                                   type: array | ||||||
|  |                               required: | ||||||
|  |                                 - key | ||||||
|  |                                 - operator | ||||||
|  |                               type: object | ||||||
|  |                             type: array | ||||||
|  |                           matchLabels: | ||||||
|  |                             additionalProperties: | ||||||
|  |                               type: string | ||||||
|  |                             description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed. | ||||||
|  |                             type: object | ||||||
|  |                         type: object | ||||||
|  |                       maxSkew: | ||||||
|  |                         description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, it is the maximum permitted difference between the number of matching pods in the target topology and the global minimum. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 1/1/0: | zone1 | zone2 | zone3 | |   P   |   P   |       | - if MaxSkew is 1, incoming pod can only be scheduled to zone3 to become 1/1/1; scheduling it onto zone1(zone2) would make the ActualSkew(2-0) on zone1(zone2) violate MaxSkew(1). - if MaxSkew is 2, incoming pod can be scheduled onto any zone. When `whenUnsatisfiable=ScheduleAnyway`, it is used to give higher precedence to topologies that satisfy it. It''s a required field. Default value is 1 and 0 is not allowed.' | ||||||
|  |                         format: int32 | ||||||
|  |                         type: integer | ||||||
|  |                       topologyKey: | ||||||
|  |                         description: TopologyKey is the key of node labels. Nodes that have a label with this key and identical values are considered to be in the same topology. We consider each <key, value> as a "bucket", and try to put balanced number of pods into each bucket. It's a required field. | ||||||
|  |                         type: string | ||||||
|  |                       whenUnsatisfiable: | ||||||
|  |                         description: 'WhenUnsatisfiable indicates how to deal with a pod if it doesn''t satisfy the spread constraint. - DoNotSchedule (default) tells the scheduler not to schedule it. - ScheduleAnyway tells the scheduler to schedule the pod in any location,   but giving higher precedence to topologies that would help reduce the   skew. A constraint is considered "Unsatisfiable" for an incoming pod if and only if every possible node assigment for that pod would violate "MaxSkew" on some topology. For example, in a 3-zone cluster, MaxSkew is set to 1, and pods with the same labelSelector spread as 3/1/1: | zone1 | zone2 | zone3 | | P P P |   P   |   P   | If WhenUnsatisfiable is set to DoNotSchedule, incoming pod can only be scheduled to zone2(zone3) to become 3/2/1(3/1/2) as ActualSkew(2-1) on zone2(zone3) satisfies MaxSkew(1). In other words, the cluster can still be imbalanced, but scheduler won''t make it *more* imbalanced. It''s a required field.' | ||||||
|  |                         type: string | ||||||
|  |                     required: | ||||||
|  |                       - maxSkew | ||||||
|  |                       - topologyKey | ||||||
|  |                       - whenUnsatisfiable | ||||||
|  |                     type: object | ||||||
|  |                   type: array | ||||||
|                 volumeMounts: |                 volumeMounts: | ||||||
|                   items: |                   items: | ||||||
|                     description: VolumeMount describes a mounting of a Volume within a container. |                     description: VolumeMount describes a mounting of a Volume within a container. | ||||||
|  |  | ||||||
|  | @ -680,6 +680,10 @@ func (r *RunnerReconciler) newPod(runner v1alpha1.Runner) (corev1.Pod, error) { | ||||||
| 		pod.Spec.Tolerations = runnerSpec.Tolerations | 		pod.Spec.Tolerations = runnerSpec.Tolerations | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	if len(runnerSpec.TopologySpreadConstraints) != 0 { | ||||||
|  | 		pod.Spec.TopologySpreadConstraints = runnerSpec.TopologySpreadConstraints | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	if len(runnerSpec.EphemeralContainers) != 0 { | 	if len(runnerSpec.EphemeralContainers) != 0 { | ||||||
| 		pod.Spec.EphemeralContainers = runnerSpec.EphemeralContainers | 		pod.Spec.EphemeralContainers = runnerSpec.EphemeralContainers | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue