Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Coordinator concept #702

Merged
merged 4 commits into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions site/content/en/docs/concepts/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,54 @@ A JobSet failure is counted when ANY of its child Jobs fail. `spec.failurePolicy
to automatically restart the JobSet. A restart is done by recreating all child jobs.

A JobSet is terminally failed when the number of failures reaches `spec.failurePolicy.maxRestarts`

## Coordinator

A specific pod can be assigned as coordinator using `spec.coordinator`. If
defined, a `jobset.sigs.k8s.io/coordinator` annotation and label with the stable
network endpoint of the coordinator Pod will be added to all Jobs and Pods in
the JobSet. This label can be useful by other Pods. For example:

```yaml
apiVersion: jobset.x-k8s.io/v1alpha2
kind: JobSet
metadata:
name: pytorch
spec:
coordinator:
replicatedJob: leader
jobIndex: 0
podIndex: 0
replicatedJobs:
- name: leader
replicas: 1
template:
spec:
parallelism: 1
completions: 1
...
- name: workers
replicas: 1
template:
spec:
parallelism: 8
completions: 8
template:
spec:
containers:
- name: worker
env:
- name: LEADER_ADDRESS
valueFrom:
fieldRef:
fieldPath: "metadata.labels['jobset.sigs.k8s.io/coordinator']"
...
```

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For completeness, can we include an example of the resulting label/annotation that would be applied to jobs/pods, for the example spec above? So the user can verify correctness and understand what they should expect the stable network endpoint to look like.

i.e., jobset.sigs.k8s.io/coordinator=pytorch-leader-0-0.pytorch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added!

All Jobs and Pods in the JobSet will have a
`jobset.sigs.k8s.io/coordinator=pytorch-leader-0-0.pytorch` label and annotation.

WARNING: if using Kueue with JobSet, ensure Kueue version v0.8.3+ or v0.9.0+ is
installed. Prior versions are built using a JobSet api definition that does not
have the coordinator field:
https://github.com/kubernetes-sigs/kueue/issues/3495.