-
Notifications
You must be signed in to change notification settings - Fork 439
Add option in toolkit container to enable CDI in runtime #838
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
Changes from all commits
df73db7
f625242
e89be14
2b417c1
a7786d4
5ed25bb
d8cd543
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ import ( | |
| "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk-installer/container/runtime/containerd" | ||
| "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk-installer/container/runtime/crio" | ||
| "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk-installer/container/runtime/docker" | ||
| "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-ctk-installer/container/toolkit" | ||
| ) | ||
|
|
||
| const ( | ||
|
|
@@ -66,6 +67,12 @@ func Flags(opts *Options) []cli.Flag { | |
| Destination: &opts.RestartMode, | ||
| EnvVars: []string{"RUNTIME_RESTART_MODE"}, | ||
| }, | ||
| &cli.BoolFlag{ | ||
| Name: "enable-cdi-in-runtime", | ||
| Usage: "Enable CDI in the configured runt ime", | ||
| Destination: &opts.EnableCDI, | ||
| EnvVars: []string{"RUNTIME_ENABLE_CDI"}, | ||
| }, | ||
| &cli.StringFlag{ | ||
| Name: "host-root", | ||
| Usage: "Specify the path to the host root to be used when restarting the runtime using systemd", | ||
|
|
@@ -98,10 +105,14 @@ func Flags(opts *Options) []cli.Flag { | |
| } | ||
|
|
||
| // ValidateOptions checks whether the specified options are valid | ||
| func ValidateOptions(opts *Options, runtime string, toolkitRoot string) error { | ||
| func ValidateOptions(c *cli.Context, opts *Options, runtime string, toolkitRoot string, to *toolkit.Options) error { | ||
| // We set this option here to ensure that it is available in future calls. | ||
| opts.RuntimeDir = toolkitRoot | ||
|
|
||
| if !c.IsSet("enable-cdi-in-runtime") { | ||
| opts.EnableCDI = to.CDI.Enabled | ||
| } | ||
|
Comment on lines
+112
to
+114
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I think about it again, we don't need any operator change with this in place. As you said in a prior comment:
So by default, if a user sets
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No. This PR does not change the semantics of the In the GPU Operator, This PR makes it so that setting
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the default behaviour is to enable CDI in the runtime if CDI is enabled. This can be opted out of if the user sets the envvar -- or opted into if the toolkit option is not set. The Operator API is a separate concern to this. |
||
|
|
||
| // Apply the runtime-specific config changes. | ||
| switch runtime { | ||
| case containerd.Name: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.