Ensure common envvars have higher precedence

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-06-27 14:13:00 +02:00
parent a4e13c5197
commit a9ccef6090
3 changed files with 20 additions and 20 deletions

View File

@ -105,29 +105,29 @@ func main() {
Usage: "Path to the containerd config file", Usage: "Path to the containerd config file",
Value: defaultConfig, Value: defaultConfig,
Destination: &options.Config, Destination: &options.Config,
EnvVars: []string{"CONTAINERD_CONFIG", "RUNTIME_CONFIG"}, EnvVars: []string{"RUNTIME_CONFIG", "CONTAINERD_CONFIG"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "socket", Name: "socket",
Usage: "Path to the containerd socket file", Usage: "Path to the containerd socket file",
Value: defaultSocket, Value: defaultSocket,
Destination: &options.Socket, Destination: &options.Socket,
EnvVars: []string{"CONTAINERD_SOCKET", "RUNTIME_SOCKET"}, EnvVars: []string{"RUNTIME_SOCKET", "CONTAINERD_SOCKET"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "restart-mode", Name: "restart-mode",
Usage: "Specify how containerd should be restarted; If 'none' is selected, it will not be restarted [signal | systemd | none]", Usage: "Specify how containerd should be restarted; If 'none' is selected, it will not be restarted [signal | systemd | none]",
Value: defaultRestartMode, Value: defaultRestartMode,
Destination: &options.RestartMode, Destination: &options.RestartMode,
EnvVars: []string{"CONTAINERD_RESTART_MODE", "RUNTIME_RESTART_MODE"}, EnvVars: []string{"RUNTIME_RESTART_MODE", "CONTAINERD_RESTART_MODE"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "runtime-class", Name: "runtime-name",
Aliases: []string{"runtime-name", "nvidia-runtime-name"}, Aliases: []string{"nvidia-runtime-name", "runtime-class"},
Usage: "The name of the runtime class to set for the nvidia-container-runtime", Usage: "The name of the runtime class to set for the nvidia-container-runtime",
Value: defaultRuntimeClass, Value: defaultRuntimeClass,
Destination: &options.RuntimeName, Destination: &options.RuntimeName,
EnvVars: []string{"CONTAINERD_RUNTIME_CLASS", "NVIDIA_RUNTIME_NAME"}, EnvVars: []string{"NVIDIA_RUNTIME_NAME", "CONTAINERD_RUNTIME_CLASS"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "nvidia-runtime-dir", Name: "nvidia-runtime-dir",
@ -141,7 +141,7 @@ func main() {
Usage: "Set nvidia-container-runtime as the default runtime", Usage: "Set nvidia-container-runtime as the default runtime",
Value: defaultSetAsDefault, Value: defaultSetAsDefault,
Destination: &options.SetAsDefault, Destination: &options.SetAsDefault,
EnvVars: []string{"CONTAINERD_SET_AS_DEFAULT", "NVIDIA_RUNTIME_SET_AS_DEFAULT"}, EnvVars: []string{"NVIDIA_RUNTIME_SET_AS_DEFAULT", "CONTAINERD_SET_AS_DEFAULT"},
Hidden: true, Hidden: true,
}, },
&cli.StringFlag{ &cli.StringFlag{

View File

@ -105,14 +105,14 @@ func main() {
Usage: "Path to the cri-o config file", Usage: "Path to the cri-o config file",
Value: defaultConfig, Value: defaultConfig,
Destination: &options.Config, Destination: &options.Config,
EnvVars: []string{"CRIO_CONFIG", "RUNTIME_CONFIG"}, EnvVars: []string{"RUNTIME_CONFIG", "CRIO_CONFIG"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "socket", Name: "socket",
Usage: "Path to the crio socket file", Usage: "Path to the crio socket file",
Value: "", Value: "",
Destination: &options.Socket, Destination: &options.Socket,
EnvVars: []string{"CRIO_SOCKET", "RUNTIME_SOCKET"}, EnvVars: []string{"RUNTIME_SOCKET", "CRIO_SOCKET"},
// Note: We hide this option since restarting cri-o via a socket is not supported. // Note: We hide this option since restarting cri-o via a socket is not supported.
Hidden: true, Hidden: true,
}, },
@ -121,15 +121,15 @@ func main() {
Usage: "Specify how cri-o should be restarted; If 'none' is selected, it will not be restarted [systemd | none]", Usage: "Specify how cri-o should be restarted; If 'none' is selected, it will not be restarted [systemd | none]",
Value: defaultRestartMode, Value: defaultRestartMode,
Destination: &options.RestartMode, Destination: &options.RestartMode,
EnvVars: []string{"CRIO_RESTART_MODE", "RUNTIME_RESTART_MODE"}, EnvVars: []string{"RUNTIME_RESTART_MODE", "CRIO_RESTART_MODE"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "runtime-class", Name: "runtime-name",
Aliases: []string{"runtime-name", "nvidia-runtime-name"}, Aliases: []string{"nvidia-runtime-name", "runtime-class"},
Usage: "The name of the runtime class to set for the nvidia-container-runtime", Usage: "The name of the runtime class to set for the nvidia-container-runtime",
Value: defaultRuntimeClass, Value: defaultRuntimeClass,
Destination: &options.RuntimeName, Destination: &options.RuntimeName,
EnvVars: []string{"CRIO_RUNTIME_CLASS", "NVIDIA_RUNTIME_NAME"}, EnvVars: []string{"NVIDIA_RUNTIME_NAME", "CRIO_RUNTIME_CLASS"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "nvidia-runtime-dir", Name: "nvidia-runtime-dir",
@ -143,7 +143,7 @@ func main() {
Usage: "Set nvidia-container-runtime as the default runtime", Usage: "Set nvidia-container-runtime as the default runtime",
Value: defaultSetAsDefault, Value: defaultSetAsDefault,
Destination: &options.SetAsDefault, Destination: &options.SetAsDefault,
EnvVars: []string{"CRIO_SET_AS_DEFAULT", "NVIDIA_RUNTIME_SET_AS_DEFAULT"}, EnvVars: []string{"NVIDIA_RUNTIME_SET_AS_DEFAULT", "CRIO_SET_AS_DEFAULT"},
Hidden: true, Hidden: true,
}, },
&cli.StringFlag{ &cli.StringFlag{

View File

@ -99,21 +99,21 @@ func main() {
Usage: "Path to docker config file", Usage: "Path to docker config file",
Value: defaultConfig, Value: defaultConfig,
Destination: &options.Config, Destination: &options.Config,
EnvVars: []string{"DOCKER_CONFIG", "RUNTIME_CONFIG"}, EnvVars: []string{"RUNTIME_CONFIG", "DOCKER_CONFIG"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "socket", Name: "socket",
Usage: "Path to the docker socket file", Usage: "Path to the docker socket file",
Value: defaultSocket, Value: defaultSocket,
Destination: &options.Socket, Destination: &options.Socket,
EnvVars: []string{"DOCKER_SOCKET", "RUNTIME_SOCKET"}, EnvVars: []string{"RUNTIME_SOCKET", "DOCKER_SOCKET"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "restart-mode", Name: "restart-mode",
Usage: "Specify how docker should be restarted; If 'none' is selected it will not be restarted [signal | systemd | none ]", Usage: "Specify how docker should be restarted; If 'none' is selected it will not be restarted [signal | systemd | none ]",
Value: defaultRestartMode, Value: defaultRestartMode,
Destination: &options.RestartMode, Destination: &options.RestartMode,
EnvVars: []string{"DOCKER_RESTART_MODE", "RUNTIME_RESTART_MODE"}, EnvVars: []string{"RUNTIME_RESTART_MODE", "DOCKER_RESTART_MODE"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "host-root", Name: "host-root",
@ -127,11 +127,11 @@ func main() {
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "runtime-name", Name: "runtime-name",
Aliases: []string{"runtime-class", "nvidia-runtime-name"}, Aliases: []string{"nvidia-runtime-name", "runtime-class"},
Usage: "Specify the name of the `nvidia` runtime. If set-as-default is selected, the runtime is used as the default runtime.", Usage: "Specify the name of the `nvidia` runtime. If set-as-default is selected, the runtime is used as the default runtime.",
Value: defaultRuntimeName, Value: defaultRuntimeName,
Destination: &options.RuntimeName, Destination: &options.RuntimeName,
EnvVars: []string{"DOCKER_RUNTIME_NAME", "NVIDIA_RUNTIME_NAME"}, EnvVars: []string{"NVIDIA_RUNTIME_NAME", "DOCKER_RUNTIME_NAME"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "nvidia-runtime-dir", Name: "nvidia-runtime-dir",
@ -145,7 +145,7 @@ func main() {
Usage: "Set the `nvidia` runtime as the default runtime. If --runtime-name is specified as `nvidia-experimental` the experimental runtime is set as the default runtime instead", Usage: "Set the `nvidia` runtime as the default runtime. If --runtime-name is specified as `nvidia-experimental` the experimental runtime is set as the default runtime instead",
Value: defaultSetAsDefault, Value: defaultSetAsDefault,
Destination: &options.SetAsDefault, Destination: &options.SetAsDefault,
EnvVars: []string{"DOCKER_SET_AS_DEFAULT", "NVIDIA_RUNTIME_SET_AS_DEFAULT"}, EnvVars: []string{"NVIDIA_RUNTIME_SET_AS_DEFAULT", "DOCKER_SET_AS_DEFAULT"},
Hidden: true, Hidden: true,
}, },
} }