-
Notifications
You must be signed in to change notification settings - Fork 417
[no-relnote] add Dropins flag to nvidia-ctk cmd #1300
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
Conversation
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.
Pull Request Overview
This PR adds support for drop-in configuration files to the nvidia-ctk command by introducing a --drop-in-config
flag. This allows NVIDIA-specific runtime configurations to be saved to separate files instead of modifying the main configuration files.
- Adds
DropInConfig
field to container runtime options and related CLI flags - Refactors containerd and crio config builders to use separate source and destination configs
- Implements drop-in config support for containerd with import management
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
pkg/config/engine/engine.go | Changes function signatures to use more specific interface instead of generic Interface |
pkg/config/engine/crio/option.go | Renames path field to topLevelConfigPath for clarity |
pkg/config/engine/crio/crio.go | Updates config structure to support source/destination pattern |
pkg/config/engine/containerd/option.go | Renames path field to topLevelConfigPath for clarity |
pkg/config/engine/containerd/containerd.go | Implements drop-in config support with source/destination pattern |
pkg/config/engine/containerd/config_drop_in.go | New file implementing drop-in config functionality for containerd |
pkg/config/engine/containerd/config.go | Renames function for better clarity |
pkg/config/engine/config.go | New file defining the Config struct for source/destination pattern |
cmd/nvidia-ctk/runtime/configure/configure.go | Adds drop-in-config flag and updates function calls |
cmd/nvidia-ctk-installer/container/runtime/runtime.go | Adds drop-in config validation and flags |
cmd/nvidia-ctk-installer/container/container.go | Updates flush logic to use drop-in config path when specified |
Test files | Updates test expectations for new drop-in config behavior |
Pull Request Test Coverage Report for Build 18010993246Details
💛 - Coveralls |
e7ef820
to
8738572
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.
Pull Request Overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
topLevelConfig := &Config{ | ||
Tree: func() *toml.Tree { | ||
t, _ := toml.FromFile(b.topLevelConfigPath).Load() | ||
return t | ||
}(), | ||
configOptions: sourceConfigOptions, | ||
} |
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.
Error from toml.FromFile(b.topLevelConfigPath).Load()
is being silently ignored with _
. This could lead to unexpected behavior if the file loading fails. The error should be handled appropriately.
Copilot uses AI. Check for mistakes.
// TODO: Only do this if we've actually modified the config. | ||
if err := c.topLevelConfig.flush(); err != nil { | ||
return 0, fmt.Errorf("failed to save top-level config: %w", err) | ||
} |
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.
The TODO comment indicates that the top-level config is being flushed unconditionally, even when no modifications were made. This could result in unnecessary file I/O operations.
Copilot uses AI. Check for mistakes.
} | ||
|
||
// Apply the runtime-specific config changes. | ||
// TODO: Add the runtime-specific DropInConfigs here. |
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.
This TODO comment suggests incomplete implementation. The runtime-specific drop-in config logic should be implemented or the TODO should be addressed.
Copilot uses AI. Check for mistakes.
8738572
to
9dc5067
Compare
9dc5067
to
995866e
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.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
} | ||
} | ||
|
||
if !filepath.IsAbs(config.dropInConfigPath) { |
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.
This validation will fail when dropInConfigPath is empty for docker runtime, since an empty string is not an absolute path. The validation should only run when dropInConfigPath is not empty.
if !filepath.IsAbs(config.dropInConfigPath) { | |
if config.dropInConfigPath != "" && !filepath.IsAbs(config.dropInConfigPath) { |
Copilot uses AI. Check for mistakes.
defaultCrioConfigFilePath = "/etc/crio/crio.conf" | ||
defaultDockerConfigFilePath = "/etc/docker/daemon.json" | ||
|
||
defaultContainerdDropInConfigFilePath = "/etc/containerd/config.d/99-nvidia.toml" |
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: Did we want to use the /run/nvidia/{{ .something }}
here or are we hoping that we could convince Containerd to start honoring this path?
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.
Since this is for interactive usage, I thought it was ok to set it like that, and yes, with the Hope that we can push the community towards this direction in the future.
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.
PR containerd/containerd#12323 was merged, so we can expect FUTURE containerd versions to have "/etc/containerd/conf.d/*.toml"
by default
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.
OK. That's fine then. Let's also check the paths we specify in the GPU Operator as part of NVIDIA/gpu-operator#1710 as well.
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.
The GPU Operator is using the right default
DefaultContainerdDropInConfigFile = "/etc/containerd/conf.d/99-nvidia.toml"
// DefaultContainerdSocketFile indicates default containerd socket file
} | ||
} | ||
|
||
if config.dropInConfigPath == "" && (config.runtime == "containerd" || config.runtime == "crio") { |
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.
Why are we checking the runtime here AND in the switch statement?
if config.dropInConfigPath == "" && (config.runtime == "containerd" || config.runtime == "crio") { | |
if config.dropInConfigPath == "" { |
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.
suggestion adopted
return fmt.Errorf("failed to flush config to %q: %w", c.path, err) | ||
func (c *topLevelConfig) Save(dropInPath string) (int64, error) { | ||
saveToPath := c.path | ||
if dropInPath == "" { |
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.
We may want toa dd a comment indicating that the path ""
indicates that we're writing to STDOUT
.
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.
comment added
} | ||
} | ||
|
||
if config.dropInConfigPath != "" && !filepath.IsAbs(config.dropInConfigPath) { |
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.
Did we also want to raise an error if docker specifies a drop-in config path?
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.
Error check added for the mentioned scenario
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
df47315
to
8fec2e6
Compare
cce3ebe
to
b41bd12
Compare
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
b41bd12
to
a6e6d1a
Compare
Signed-off-by: Evan Lezar <[email protected]>
a4ff053
to
d4ff926
Compare
Builds on #1280