-
Notifications
You must be signed in to change notification settings - Fork 971
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 dynamic resource allocation design details. #3487
Open
Subhasish-Behera
wants to merge
2
commits into
volcano-sh:master
Choose a base branch
from
Subhasish-Behera:design-doc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 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
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,64 @@ | ||
# Dynamic Resources Allocation | ||
|
||
## Summary | ||
|
||
DRA(Dynamic resource allocation) is the new way of requesting access to resources available in Kubernetes 1.26+. | ||
|
||
## Motivation | ||
|
||
DRA allows one to move away from the limited "countable" API provided by device plugins today. Volcano's implementation of device plugins is present in `https://github.com/volcano-sh/devices`. | ||
|
||
The KEP for k8s DRA implementation: https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/3063-dynamic-resource-allocation/README.md | ||
|
||
## Goals | ||
|
||
1. DRA should support resource allocation between multiple containers or pods. | ||
2. Users can attach arbitrary constraints to a resource request to get the exact resource | ||
they are looking for. | ||
|
||
|
||
## Out of Scope | ||
|
||
1. Writing drivers. Support for new hardware will be provided by hardware vendor add-ons. The resources(resource driver) being mentioned in this context will be owned by these add-ons. | ||
2. Replace support for device plugin. | ||
|
||
## Implementation Details | ||
![img_1.png](./images/img_dra1.png) | ||
The DRA will be available as a separate plugin in Volcano. | ||
The functions associated with the Implementation are listed above which are used in kube-schedulers DRA implementation. | ||
|
||
The two allocation modes supported by DRA are: | ||
1. immediate | ||
2. delayed(aka. WaitForFirstConsumer) | ||
|
||
In immediate allocation the allocation on nodes starts as soon as the `ResourceClaim` gets created whereas in delayed mode allocation is delayed until a Pod gets scheduled that needs the `ResourceClaim`. | ||
|
||
For the delayed allocation mode,PodSchedulingcontext is used. In this allocation mode a node is selected tentatively by the scheduler in an iterative process where the scheduler suggests some potential nodes that fit the other resource requirements of a Pod and resource drivers respond with PodSchedulingcontext information about whether they can allocate claims for those nodes. | ||
|
||
|
||
In the `OnSessionOpen` function of the plugin the logic related to publish is written. The `publish` will be used in updating existing podSchedulingContext's state with any changes in the scheduling state. If there's no existing PodSchedulingContext, it creates a new one. | ||
|
||
The information related to resources involved can be accesed using `k8s.io/client-go/informers/resources/v1alpha2` and `k8s.io/client-go/listers/resources/v1alpha2` | ||
|
||
For DRA to work : | ||
1. `DynamicResourceAllocation` feature gate needs to be enabled. | ||
2. `resource.k8s.io/v1alpha2` apigroup needs to be enabled. | ||
|
||
These are set using --feature-gates and --runtime-config flags of K8s API server | ||
|
||
Testing strategy: use k8's existing [test driver](https://github.com/kubernetes/kubernetes/tree/v1.30.1/test/e2e/dra/test-driver). | ||
|
||
Future work: | ||
1. [structured parameters](https://github.com/kubernetes/enhancements/issues/4381): support claim allocation through scheduler without relying on third-party driver. | ||
KEP for reference: https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/4381-dra-structured-parameters/README.md | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Besides the
publish
func of dra, we should also add prefilter, filter, scroe, reserved callback here and add postbind logic in after task bind successfully, please also add these details: )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.
And draw a picture to show the whole process is better.
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.
@Monokaix sent a message regarding the callback part:)
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.
@Monokaix I have some doubts regarding the
prebind
step which I have messaged on slack.