-
Notifications
You must be signed in to change notification settings - Fork 176
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
API preferred allocation: GetPreferredAllocation #267
API preferred allocation: GetPreferredAllocation #267
Conversation
|
2d51409
to
05aff6e
Compare
/cc @ahalim-intel @martinkennelly @adrianchiris PTAL. |
This RP was tested against 19.0 kubernetes deployment. |
@zshi-redhat Does it make sense to have a different allocating policy per resource pool? |
@amorenoz good question! |
Maybe @sseetharaman6 can comment? We could have both: A default policy (cli) and a per-resource one that would override the former. |
Thanks for this feature. So, the current implementation of |
There were two allocation policys I'd like to implement initially:
For the first one, we have an issue associated with it. I think the main usage of this API is to recommend the device affinity to kubelet when allocating more than one device. I'd like to see if there is any use case in networking or accelerator area that requires this kind of device affinity. one possible example might be: if
we probably want to allocate network function(pool A) and accelerator function(pool B) from the same device for affinity purpose. |
Some policy naming ideas that came to mind :) Concentrate -> Packed : VFs are preferred to be allocated in a Packed manner under the same PF |
Renamed concentrated to packed. |
Thanks for this PR @zshi-redhat . |
Changed the allocatePolicy as a per resource pool config.
Yes, it shall only works with v1.19.0 and onwards, did you see any error when running this sriovdp with old k8s version? |
case "packed": | ||
return resources.NewPackedAllocator() | ||
default: | ||
return nil |
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.
What happens if there's a misconfig or unsupported policy. Can we raise an error here? I tested this and if we specify a policy that does not match any case, then it is silently ignored.
@@ -77,6 +77,7 @@ type ResourceConfig struct { | |||
DeviceType DeviceType `json:"deviceType,omitempty"` | |||
Selectors *json.RawMessage `json:"selectors,omitempty"` | |||
SelectorObj interface{} | |||
AllocatePolicy string `json:"allocatePolicy,omitempty"` |
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.
nit: format of json meta data is off.
I tested this patch on ver. 1.19.3 of Kubernetes. I tested it on multiple VFs with the packed option. It worked as expected enabled and disabled. Thanks again @zshi-redhat for this. |
@zshi-redhat Do you think adding documentation for this would be good too to advertise this feature? |
Yes, I will add doc for the API change, Thanks Martin! |
@zshi-redhat do you envision we also add the Balanced functionality to this patch? If you need help, let me know. |
0b5851e
to
2ab2401
Compare
resolved merge conflict and updated the Readme.doc |
@martinkennelly I thought about adding balanced functionality, the issue I can see is there seems no reliable way to balance device allocation from device plugin perspective, unless having device plugin record all the allocated/deallocated devices from kubelet. However, I'm unsure about adding the record in device plugin because there is no deallocate call from kubelet. |
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.
LGTM.
@adrianchiris as we discussed in resource mgmt meeting (considering adding balanced policy later w/ solid use case), are you good with current |
I wonder if we can get away with no user-facing API changes for Unless i missed it, I did not find a compelling reason in the conversation to justify (IMHO) having this configurable per resource at this time. |
There is some difference between packed policy and no policy. packed always use the resources "in order" while no policy is random. I prefer not to change the default behaviour from random to packed.
Looking at history, this PR was initially implemented the policy as cli cmd, later changed to per-resource pool configuration per suggestion. I think the use case is the same as user may want to allocate one resource in order, but not the others, because we support resourceList to contain multiple resourcePools in one device plugin instance. |
@zshi-redhat could you rebase this ? I assume this PR is still desired |
2ab2401
to
e6376b3
Compare
Rebased. |
Signed-off-by: Zenghui Shi <[email protected]>
This pull request fixes 1 alert when merging 78530f4 into 1a8c9df - view on LGTM.com fixed alerts:
|
@adrianchiris Could you find time to review this? It's rebased. |
I’m planning to migrate our in-house CNI plugin to SR-IOV CNI plugin with this device plugin. While evaluating this device plugin, I found the plugin doesn’t support allocating VFs from different PFs (balanced policy). The balanced policy allows us to assign multi PFs to a Pod to achieve higher bandwidth if the communication stack supports multi-rail network configuration. I have two questions,
|
@adrianchiris @martinkennelly @zshi-redhat |
replaced by #443 |
Fixes #255