You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: keps/sig-scheduling/3633-matchlabelselectors-to-podaffinity/README.md
+20-33Lines changed: 20 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -271,44 +271,31 @@ metadata:
271
271
272
272
#### Story 2
273
273
274
-
When users want to achieve exclusive 1:1 job to domain placement in [kubernetes-sigs/jobset](https://github.com/kubernetes-sigs/jobset).
275
-
Noone knows the job's name until it's created from JobSet, but each Job and Pod will get [`job-name`](https://github.com/kubernetes-sigs/jobset/blob/749a77c2647ac46b309b8227f66293e4116b97ed/api/v1alpha1/jobset_types.go#L26) label on it.
274
+
Let's say all Pods on each tenant get `tenant` label via a controller or a manifest management tool like Helm.
275
+
And, the cluster admin now wants to achieve exclusive 1:1 tenant to domain placement.
276
276
277
-
Users can use `job-name` label to ensure that the Pods with the same `job-name` will land on the same rack
278
-
and Pods with other `job-name` won't labd on the same rack via `matchLabelSelectors`.
277
+
By applying the following affinity grobally with the mutating webhook, the cluster admin can ensure that the Pods with the same domain will land on the same domain, and Pods with other `tenant` won't land on the same domain.
279
278
280
279
```yaml
281
-
apiVersion: jobset.x-k8s.io/v1alpha1
282
-
kind: JobSet
283
-
metadata:
284
-
name: pytorch
285
-
annotations:
286
-
alpha.jobset.sigs.k8s.io/exclusive-topology: rack
287
-
spec:
288
-
replicatedJobs:
289
-
- name: workers
290
-
template:
291
-
...
292
-
affinity:
293
-
podAffinity: # ensures the pods of this job land on the same rack
294
-
requiredDuringSchedulingIgnoredDuringExecution:
295
-
- matchLabelSelectors:
296
-
- matchLabelKey: job-name
297
-
operator: In
298
-
topologyKey: rack
299
-
podAntiAffinity: # ensures only this job lands on the rack
300
-
requiredDuringSchedulingIgnoredDuringExecution:
301
-
- matchLabelSelectors:
302
-
- matchLabelKey: job-name
303
-
operator: NotIn
304
-
- labelSelector:
305
-
matchExpressions:
306
-
- key: job-name
307
-
operator: Exists
308
-
topologyKey: rack
280
+
affinity:
281
+
podAffinity: # ensures the pods of this tenant land on the same node pool
282
+
requiredDuringSchedulingIgnoredDuringExecution:
283
+
- matchLabelSelectors:
284
+
- matchLabelKey: tenant
285
+
operator: In
286
+
topologyKey: node-pool
287
+
podAntiAffinity: # ensures only Pods from this tenant lands on the same node pool
0 commit comments