Skip to content

Commit 0b3327d

Browse files
committed
modify the example usecase to explain without jobset
1 parent 15c1f05 commit 0b3327d

File tree

1 file changed

+20
-33
lines changed
  • keps/sig-scheduling/3633-matchlabelselectors-to-podaffinity

1 file changed

+20
-33
lines changed

keps/sig-scheduling/3633-matchlabelselectors-to-podaffinity/README.md

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -271,44 +271,31 @@ metadata:
271271
272272
#### Story 2
273273
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.
276276

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.
279278

280279
```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
288+
requiredDuringSchedulingIgnoredDuringExecution:
289+
- matchLabelSelectors:
290+
- matchLabelKey: tenant
291+
operator: NotIn
292+
- labelSelector:
293+
matchExpressions:
294+
- key: tenant
295+
operator: Exists
296+
topologyKey: node-pool
309297
```
310298

311-
312299
### Notes/Constraints/Caveats (Optional)
313300

314301
<!--

0 commit comments

Comments
 (0)