Skip to content

Commit a9ccef6

Browse files
committed
Ensure common envvars have higher precedence
Signed-off-by: Evan Lezar <[email protected]>
1 parent a4e13c5 commit a9ccef6

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

tools/container/containerd/containerd.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,29 +105,29 @@ func main() {
105105
Usage: "Path to the containerd config file",
106106
Value: defaultConfig,
107107
Destination: &options.Config,
108-
EnvVars: []string{"CONTAINERD_CONFIG", "RUNTIME_CONFIG"},
108+
EnvVars: []string{"RUNTIME_CONFIG", "CONTAINERD_CONFIG"},
109109
},
110110
&cli.StringFlag{
111111
Name: "socket",
112112
Usage: "Path to the containerd socket file",
113113
Value: defaultSocket,
114114
Destination: &options.Socket,
115-
EnvVars: []string{"CONTAINERD_SOCKET", "RUNTIME_SOCKET"},
115+
EnvVars: []string{"RUNTIME_SOCKET", "CONTAINERD_SOCKET"},
116116
},
117117
&cli.StringFlag{
118118
Name: "restart-mode",
119119
Usage: "Specify how containerd should be restarted; If 'none' is selected, it will not be restarted [signal | systemd | none]",
120120
Value: defaultRestartMode,
121121
Destination: &options.RestartMode,
122-
EnvVars: []string{"CONTAINERD_RESTART_MODE", "RUNTIME_RESTART_MODE"},
122+
EnvVars: []string{"RUNTIME_RESTART_MODE", "CONTAINERD_RESTART_MODE"},
123123
},
124124
&cli.StringFlag{
125-
Name: "runtime-class",
126-
Aliases: []string{"runtime-name", "nvidia-runtime-name"},
125+
Name: "runtime-name",
126+
Aliases: []string{"nvidia-runtime-name", "runtime-class"},
127127
Usage: "The name of the runtime class to set for the nvidia-container-runtime",
128128
Value: defaultRuntimeClass,
129129
Destination: &options.RuntimeName,
130-
EnvVars: []string{"CONTAINERD_RUNTIME_CLASS", "NVIDIA_RUNTIME_NAME"},
130+
EnvVars: []string{"NVIDIA_RUNTIME_NAME", "CONTAINERD_RUNTIME_CLASS"},
131131
},
132132
&cli.StringFlag{
133133
Name: "nvidia-runtime-dir",
@@ -141,7 +141,7 @@ func main() {
141141
Usage: "Set nvidia-container-runtime as the default runtime",
142142
Value: defaultSetAsDefault,
143143
Destination: &options.SetAsDefault,
144-
EnvVars: []string{"CONTAINERD_SET_AS_DEFAULT", "NVIDIA_RUNTIME_SET_AS_DEFAULT"},
144+
EnvVars: []string{"NVIDIA_RUNTIME_SET_AS_DEFAULT", "CONTAINERD_SET_AS_DEFAULT"},
145145
Hidden: true,
146146
},
147147
&cli.StringFlag{

tools/container/crio/crio.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ func main() {
105105
Usage: "Path to the cri-o config file",
106106
Value: defaultConfig,
107107
Destination: &options.Config,
108-
EnvVars: []string{"CRIO_CONFIG", "RUNTIME_CONFIG"},
108+
EnvVars: []string{"RUNTIME_CONFIG", "CRIO_CONFIG"},
109109
},
110110
&cli.StringFlag{
111111
Name: "socket",
112112
Usage: "Path to the crio socket file",
113113
Value: "",
114114
Destination: &options.Socket,
115-
EnvVars: []string{"CRIO_SOCKET", "RUNTIME_SOCKET"},
115+
EnvVars: []string{"RUNTIME_SOCKET", "CRIO_SOCKET"},
116116
// Note: We hide this option since restarting cri-o via a socket is not supported.
117117
Hidden: true,
118118
},
@@ -121,15 +121,15 @@ func main() {
121121
Usage: "Specify how cri-o should be restarted; If 'none' is selected, it will not be restarted [systemd | none]",
122122
Value: defaultRestartMode,
123123
Destination: &options.RestartMode,
124-
EnvVars: []string{"CRIO_RESTART_MODE", "RUNTIME_RESTART_MODE"},
124+
EnvVars: []string{"RUNTIME_RESTART_MODE", "CRIO_RESTART_MODE"},
125125
},
126126
&cli.StringFlag{
127-
Name: "runtime-class",
128-
Aliases: []string{"runtime-name", "nvidia-runtime-name"},
127+
Name: "runtime-name",
128+
Aliases: []string{"nvidia-runtime-name", "runtime-class"},
129129
Usage: "The name of the runtime class to set for the nvidia-container-runtime",
130130
Value: defaultRuntimeClass,
131131
Destination: &options.RuntimeName,
132-
EnvVars: []string{"CRIO_RUNTIME_CLASS", "NVIDIA_RUNTIME_NAME"},
132+
EnvVars: []string{"NVIDIA_RUNTIME_NAME", "CRIO_RUNTIME_CLASS"},
133133
},
134134
&cli.StringFlag{
135135
Name: "nvidia-runtime-dir",
@@ -143,7 +143,7 @@ func main() {
143143
Usage: "Set nvidia-container-runtime as the default runtime",
144144
Value: defaultSetAsDefault,
145145
Destination: &options.SetAsDefault,
146-
EnvVars: []string{"CRIO_SET_AS_DEFAULT", "NVIDIA_RUNTIME_SET_AS_DEFAULT"},
146+
EnvVars: []string{"NVIDIA_RUNTIME_SET_AS_DEFAULT", "CRIO_SET_AS_DEFAULT"},
147147
Hidden: true,
148148
},
149149
&cli.StringFlag{

tools/container/docker/docker.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,21 @@ func main() {
9999
Usage: "Path to docker config file",
100100
Value: defaultConfig,
101101
Destination: &options.Config,
102-
EnvVars: []string{"DOCKER_CONFIG", "RUNTIME_CONFIG"},
102+
EnvVars: []string{"RUNTIME_CONFIG", "DOCKER_CONFIG"},
103103
},
104104
&cli.StringFlag{
105105
Name: "socket",
106106
Usage: "Path to the docker socket file",
107107
Value: defaultSocket,
108108
Destination: &options.Socket,
109-
EnvVars: []string{"DOCKER_SOCKET", "RUNTIME_SOCKET"},
109+
EnvVars: []string{"RUNTIME_SOCKET", "DOCKER_SOCKET"},
110110
},
111111
&cli.StringFlag{
112112
Name: "restart-mode",
113113
Usage: "Specify how docker should be restarted; If 'none' is selected it will not be restarted [signal | systemd | none ]",
114114
Value: defaultRestartMode,
115115
Destination: &options.RestartMode,
116-
EnvVars: []string{"DOCKER_RESTART_MODE", "RUNTIME_RESTART_MODE"},
116+
EnvVars: []string{"RUNTIME_RESTART_MODE", "DOCKER_RESTART_MODE"},
117117
},
118118
&cli.StringFlag{
119119
Name: "host-root",
@@ -127,11 +127,11 @@ func main() {
127127
},
128128
&cli.StringFlag{
129129
Name: "runtime-name",
130-
Aliases: []string{"runtime-class", "nvidia-runtime-name"},
130+
Aliases: []string{"nvidia-runtime-name", "runtime-class"},
131131
Usage: "Specify the name of the `nvidia` runtime. If set-as-default is selected, the runtime is used as the default runtime.",
132132
Value: defaultRuntimeName,
133133
Destination: &options.RuntimeName,
134-
EnvVars: []string{"DOCKER_RUNTIME_NAME", "NVIDIA_RUNTIME_NAME"},
134+
EnvVars: []string{"NVIDIA_RUNTIME_NAME", "DOCKER_RUNTIME_NAME"},
135135
},
136136
&cli.StringFlag{
137137
Name: "nvidia-runtime-dir",
@@ -145,7 +145,7 @@ func main() {
145145
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",
146146
Value: defaultSetAsDefault,
147147
Destination: &options.SetAsDefault,
148-
EnvVars: []string{"DOCKER_SET_AS_DEFAULT", "NVIDIA_RUNTIME_SET_AS_DEFAULT"},
148+
EnvVars: []string{"NVIDIA_RUNTIME_SET_AS_DEFAULT", "DOCKER_SET_AS_DEFAULT"},
149149
Hidden: true,
150150
},
151151
}

0 commit comments

Comments
 (0)