-
Notifications
You must be signed in to change notification settings - Fork 994
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 nodegroup plugin #3132
Merged
volcano-sh-bot
merged 3 commits into
volcano-sh:master
from
wuyueandrew:nodegroup-issue3131
Jan 17, 2024
Merged
add nodegroup plugin #3132
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
# Nodegroup Plugin User Guide | ||
|
||
## Introduction | ||
|
||
**Nodegroup plugin** is designed to isolate resources by assigning labels to nodes and set node label affinty on Queue. | ||
|
||
## Usage | ||
|
||
### assign label to node | ||
Assign label to node, label key is `volcano.sh/nodegroup-name`. | ||
```shell script | ||
kubectl label nodes <nodename> volcano.sh/nodegroup-name=<groupname> | ||
``` | ||
|
||
### configure queue | ||
Create queue and bind nodegroup to it. | ||
|
||
```yaml | ||
apiVersion: scheduling.volcano.sh/v1beta1 | ||
kind: Queue | ||
metadata: | ||
name: default | ||
spec: | ||
reclaimable: true | ||
weight: 1 | ||
affinity: # added field | ||
nodeGroupAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- <groupname> | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- <groupname> | ||
nodeGroupAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- <groupname> | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- <groupname> | ||
``` | ||
### submit a vcjob | ||
|
||
submit vcjob job-1 to default queue. | ||
|
||
```shell script | ||
$ cat <<EOF | kubectl apply -f - | ||
apiVersion: batch.volcano.sh/v1alpha1 | ||
kind: Job | ||
metadata: | ||
name: job-1 | ||
spec: | ||
minAvailable: 1 | ||
schedulerName: volcano | ||
queue: default | ||
policies: | ||
- event: PodEvicted | ||
action: RestartJob | ||
tasks: | ||
- replicas: 1 | ||
name: nginx | ||
policies: | ||
- event: TaskCompleted | ||
action: CompleteJob | ||
template: | ||
spec: | ||
containers: | ||
- command: | ||
- sleep | ||
- 10m | ||
image: nginx:latest | ||
name: nginx | ||
resources: | ||
requests: | ||
cpu: 1 | ||
limits: | ||
cpu: 1 | ||
restartPolicy: Never | ||
EOF | ||
``` | ||
|
||
### validate queue affinity and antiAffinity rules is effected | ||
|
||
Query pod information and verify whether the pod has been scheduled on the correct node. The pod should be scheduled on nodes with | ||
label `nodeGroupAffinity.requiredDuringSchedulingIgnoredDuringExecution` or `nodeGroupAffinity.preferredDuringSchedulingIgnoredDuringExecution`. If not, the pod should be scheduled on nodes with label of `nodeGroupAntiAffinity.preferredDuringSchedulingIgnoredDuringExecution`. Specifically, the pod must not be scheduled on nodes with the label `nodeGroupAntiAffinity.requiredDuringSchedulingIgnoredDuringExecution`. | ||
|
||
```shell script | ||
kubectl get po job-1-nginx-0 -o wide | ||
``` | ||
|
||
## How the Nodegroup Plugin Works | ||
|
||
The nodegroup design document provides the most detailed information about the node group. There are some tips to help avoid certain issues.These tips are based on a four-nodes cluster and vcjob called job-1: | ||
|
||
| Node | Label | | ||
| ------ | ------ | | ||
| node1 | groupname1 | | ||
| node2 | groupname2 | | ||
| node3 | groupname3 | | ||
| node4 | groupname4 | | ||
|
||
```yaml | ||
apiVersion: batch.volcano.sh/v1alpha1 | ||
kind: Job | ||
metadata: | ||
name: job-1 | ||
spec: | ||
minAvailable: 1 | ||
schedulerName: volcano | ||
queue: default | ||
policies: | ||
- event: PodEvicted | ||
action: RestartJob | ||
tasks: | ||
- replicas: 1 | ||
name: nginx | ||
policies: | ||
- event: TaskCompleted | ||
action: CompleteJob | ||
template: | ||
spec: | ||
containers: | ||
- command: | ||
- sleep | ||
- 10m | ||
image: nginx:latest | ||
name: nginx | ||
resources: | ||
requests: | ||
cpu: 1 | ||
limits: | ||
cpu: 1 | ||
restartPolicy: Never | ||
``` | ||
|
||
1. Soft constraints are a subset of hard constraints, including both affinity and anti-affinity. Consider a queue setup as follows: | ||
```yaml | ||
apiVersion: scheduling.volcano.sh/v1beta1 | ||
kind: Queue | ||
metadata: | ||
name: default | ||
spec: | ||
reclaimable: true | ||
weight: 1 | ||
affinity: # added field | ||
nodeGroupAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
- gropuname2 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
nodeGroupAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- groupname3 | ||
- gropuname4 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- groupname3 | ||
``` | ||
This implies that tasks in the "default" queue will be scheduled on "groupname1" and "groupname2", with a preference for "groupname1" to run first. Tasks are restricted from running on "groupname3" and "groupname4". However, if the resources in other node groups are insufficient, the task can run on "nodegroup3". | ||
|
||
2. If soft constraints do not form a subset of hard constraints, the queue configuration is incorrect, leading to tasks running on "groupname2": | ||
```yaml | ||
apiVersion: scheduling.volcano.sh/v1beta1 | ||
kind: Queue | ||
metadata: | ||
name: default | ||
spec: | ||
reclaimable: true | ||
weight: 1 | ||
affinity: # added field | ||
nodeGroupAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- gropuname2 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
nodeGroupAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- gropuname4 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- groupname3 | ||
``` | ||
|
||
3. If there is a conflict between nodeGroupAffinity and nodeGroupAntiAffinity, nodeGroupAntiAffinity takes higher priority. | ||
```yaml | ||
apiVersion: scheduling.volcano.sh/v1beta1 | ||
kind: Queue | ||
metadata: | ||
name: default | ||
spec: | ||
reclaimable: true | ||
weight: 1 | ||
affinity: # added field | ||
nodeGroupAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
- gropuname2 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
nodeGroupAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- gropuname2 | ||
``` | ||
This implies that tasks in the "default" queue can only run on "groupname2". | ||
|
||
4. Generally, tasks run on "groupname1" first because it is a soft constraint. However, the scoring function comprises several plugins, so the task may sometimes run on "groupname2". | ||
```yaml | ||
apiVersion: scheduling.volcano.sh/v1beta1 | ||
kind: Queue | ||
metadata: | ||
name: default | ||
spec: | ||
reclaimable: true | ||
weight: 1 | ||
affinity: # added field | ||
nodeGroupAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
- gropuname2 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- groupname1 | ||
nodeGroupAntiAffinity: | ||
requiredDuringSchedulingIgnoredDuringExecution: | ||
- groupname3 | ||
- gropuname4 | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- groupname3 | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following steps are both about queue's configuration, should also add other steps, like set node lable, and submit jobs to a queue and verfiy that jobs are scheduled to affinity nodes and schedule failed on antiaffinity nodes.