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 support for CDI devices to device flag #2280

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

elezar
Copy link

@elezar elezar commented Jun 7, 2023

This change adds support for specifying fully-qualified CDI device names in the --device flag. This allows the Container Device Interface (CDI) to be used to inject devices into container being run.

This mirrors the support recently added to ctr (see containerd/containerd#8525) and under review for the Docker CLI (see docker/cli#4084).

Note that this assumes that the CLI is used to inject devices and additional work would be required for other mechanisms such as compose files.

@elezar
Copy link
Author

elezar commented Jun 7, 2023

/cc @mikebrow

Do you know who should have a look at this? Changes are similar to containerd/containerd#8525.

github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
Copy link
Member

Choose a reason for hiding this comment

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

Can we minimize these dependencies?

Copy link
Author

@elezar elezar Jun 8, 2023

Choose a reason for hiding this comment

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

The code for loading the CDI specifications reads YAML files -- and contains the functionaility to set up watchers on the filesystem that updates the spec in daemonized cases. We are looking to reduce the set of dependencies required, but that work has not yet been started.

Are there any dependencies in particular that you are concerned about? (To be clear, this should be a similar set to those for containerd which includes the same feature when using CRI).

if err != nil {
return
}
for _, device := range allDevices {
if cdi.IsQualifiedName(device) {
opt.CDIDevices = append(opt.CDIDevices, device)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Can we have an integration test too?

Copy link
Author

Choose a reason for hiding this comment

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

Sure. I will add an integration test and also gate this behind an experimental flag.

Copy link
Author

Choose a reason for hiding this comment

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

The Docker CLI PR has been merged, so I will pick up this PR again in the next couple of days.

Copy link
Member

Choose a reason for hiding this comment

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

@elezar ping?

Copy link
Author

Choose a reason for hiding this comment

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

Sorry for the delay. I will look at this again this week.

@AkihiroSuda
Copy link
Member

Needs rebase

This change adds support for specifying fully-qualified CDI device
names in the --device flag. This allows the Container Device Interface
(CDI) to be used to inject devices into container being run.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants