-
Notifications
You must be signed in to change notification settings - Fork 38
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
devel: better support for runtime integration #43
Conversation
Accept all OCI supported device types in CDI Spec files. Address a few bugs and omissions in InjectDevices making it more complete / better usable in runtimes: - generate cgroup device access rules - remove conflicting devices/mounts prior to injection - fill in missing device type, major/minor number from host - use container uid/gid if they are unspecified in CDI Spec - sort mounts after injection Signed-off-by: Krisztian Litkey <[email protected]>
from my perspective, looks good. |
c39afa7
to
a53df63
Compare
I've tested this on both sides - in the device plugin and in containerd. Worked just fine. |
/assign @elezar |
Hi sorry. Been off sick. Will have a look once I'm back. |
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.
Thanks @klihub. This looks good.
I have some minor comments regarding naming and validation. In general this looks good though.
a53df63
to
b502a0b
Compare
Add functions for annotating containers for CDI device injection and for extracting CDI device names from such annotations. These functions can be used by CDI-aware devices plugins and runtimes, to request the injection of CDI devices and to recover the names of devices to inject correspondingly. For example, the following call to AnnotateInjection annotations := map[string]string{} AnnotateInjection(annotations, "vendor.gpu", []string{ "vendor.com/gpu=gpu0", "vendor.com/gpu=gpu1", }) produces the following annotations map[string]string{ "cdi.k8s.io/vendor.gpu": "vendor.com/gpu=gpu0,vendor.com/gpu=gpu1", } Subsequently parsing these annotations with devices, err := ParseAnnotations(annotations) extracts and returns the original slice of devices to inject: []string{ "vendor.com/gpu=gpu0", "vendor.com/gpu=gpu1", } Notes: These functions provide a temporary solution for delivering CDI device injection requests from either a client or a K8s Device Plugin to the container runtime. They can be removed once dedicated fields to the same effect are added natively to the CRI protocol. Signed-off-by: Krisztian Litkey <[email protected]>
Signed-off-by: Krisztian Litkey <[email protected]>
b502a0b
to
10f8f04
Compare
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.
Thanks @klihub. Sorry for the delay.
No problemo, I think this was pretty fast. Thanks for the review ! |
This PR improves support for runtime CDI integration. See this accompanying branch for cri-o CDI integration as an example of using it.
In particular this PR
Requesting injection via annotation is a stop-gap solution until the CRI protocol gains dedicated CDI support.