-
Notifications
You must be signed in to change notification settings - Fork 417
Allow config sources to be specified for containerd and cri-o #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
Allow config sources to be specified for containerd and cri-o #1251
Conversation
Pull Request Test Coverage Report for Build 18193238472Details
💛 - 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.
Can we mark this PR as ready for review? |
I think we can move this to the next minor (if we decide to implement it at all). See the comment here #1222 (comment) for a workaround in the existing codebase. |
3de75ef
to
8afbb32
Compare
I am testing this with the operator and microk8s, by setting the following with the toolkit container:
This does not work as is since the path provided to |
Yes, I missed this when trying to think this through. The user could provide the container path here, but that's definitely not ideal. |
@cdesiniotis what if we also add the following to the GPU Operator:
(We can definitely factor out some logic here to make things more readable across the multiple instances where we are transforming host paths to container paths). This would mean that a user would specify |
A simpler solution would be to prepend |
I've tested this PR paired with NVIDIA/gpu-operator#1758 and it provides a working solution for microk8s. |
Signed-off-by: Evan Lezar <[email protected]>
Signed-off-by: Evan Lezar <[email protected]>
By default containerd 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]>
2c54980
to
b426551
Compare
b426551
to
0d59175
Compare
This change allows a "file" config source to also specify the source path of the file to process. This means that when configuring containerd with the option --config-source=file=/foo/bar.toml the file /foo/bar.toml will be used as the source config instead of the output config file. Signed-off-by: Evan Lezar <[email protected]>
0d59175
to
c789a8d
Compare
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.This further allows an explicit path to be specified for the
file
config source so that there is a separation between the config file being modified by the tooling and the config used as the source for drop-in files, for example.