-
Notifications
You must be signed in to change notification settings - Fork 407
Allow config sources to be specified for containerd #1251
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
base: main
Are you sure you want to change the base?
Conversation
By default container extracts the current config by running the `containerd config dump` command and if that fails we read the existing config file. This change allows ordering of these sources to be defined as we do for the nvidia-ctk runtime configure command. Signed-off-by: Evan Lezar <[email protected]>
Pull Request Test Coverage Report for Build 17078747183Details
💛 - Coveralls |
switch source { | ||
case "file": | ||
loaders = append(loaders, toml.FromFile(o.Config)) | ||
case "command": |
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.
Note to self: Since command
here implies containerd config dump
command we may want to make this more expressive. For now I have used the values that we support in the nvidia-ctk runtime configure
command:
nvidia-container-toolkit/cmd/nvidia-ctk/runtime/configure/configure.go
Lines 132 to 137 in 7b1b20b
&cli.StringFlag{ | |
Name: "config-source", | |
Usage: "the source to retrieve the container runtime configuration; one of [command, file]\"", | |
Destination: &config.configSource, | |
Value: defaultConfigSource, | |
}, |
&cli.StringSliceFlag{ | ||
Name: "config-source", | ||
Usage: "specify the config sources", | ||
Destination: &opts.ConfigSources, | ||
Sources: cli.EnvVars("RUNTIME_CONFIG_SOURCES"), |
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.
Flag to be called config-source-order
(or similar)
specify the order of config sources
As the user can do --config-source command,file
or --config-source file,command
same for the ENV VAR RUNTIME_CONFIG_SOURCES_ORDER
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.
I don't agree that the flag name should be changed. The flag specifies the sources and the ordering is implied by the order in which the sources are specified. Valid values for this argument are currently:
""
"file"
"command"
"command,file"
(Default)"file,command"
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.
Then let's expand the Usage
to be more explicit, "specify the config sources [file, command]"
as nvidia-ctk runtime configure
has a flag with the same name but this one is to point to a path. We should provide guidance to the user via Usage
with at least the valid options or the default behav of this flag if not set.
By default container extracts the current config by running the
containerd config dump
command and if that fails we read the existing config file.This change allows ordering of these sources to be defined as we do for the nvidia-ctk runtime configure command.
See #1222 where setting
RUNTIME_CONFIG_SOURCES=file
orRUNTIME_CONFIG_SOURCES=file,command
should allow the current config to be preferred over thecontainerd config dump
command.