Skip to content

Commit e33da24

Browse files
Add EnvVars option for all nvidia-ctk cdi commands
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent 450f73a commit e33da24

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

cmd/nvidia-ctk/cdi/generate/generate.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,20 @@ func (m command) build() *cli.Command {
9696
Name: "config-search-path",
9797
Usage: "Specify the path to search for config files when discovering the entities that should be included in the CDI specification.",
9898
Destination: &opts.configSearchPaths,
99+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_CONFIG_SEARCH_PATHS"},
99100
},
100101
&cli.StringFlag{
101102
Name: "output",
102103
Usage: "Specify the file to output the generated CDI specification to. If this is '' the specification is output to STDOUT",
103104
Destination: &opts.output,
105+
EnvVars: []string{"NVIDIA_CTK_CDI_OUTPUT_FILE_PATH"},
104106
},
105107
&cli.StringFlag{
106108
Name: "format",
107109
Usage: "The output format for the generated spec [json | yaml]. This overrides the format defined by the output file extension (if specified).",
108110
Value: spec.FormatYAML,
109111
Destination: &opts.format,
112+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_OUTPUT_FORMAT"},
110113
},
111114
&cli.StringFlag{
112115
Name: "mode",
@@ -116,27 +119,32 @@ func (m command) build() *cli.Command {
116119
"If mode is set to 'auto' the mode will be determined based on the system configuration.",
117120
Value: string(nvcdi.ModeAuto),
118121
Destination: &opts.mode,
122+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_MODE"},
119123
},
120124
&cli.StringFlag{
121125
Name: "dev-root",
122126
Usage: "Specify the root where `/dev` is located. If this is not specified, the driver-root is assumed.",
123127
Destination: &opts.devRoot,
128+
EnvVars: []string{"NVIDIA_CTK_DEV_ROOT"},
124129
},
125130
&cli.StringSliceFlag{
126131
Name: "device-name-strategy",
127132
Usage: "Specify the strategy for generating device names. If this is specified multiple times, the devices will be duplicated for each strategy. One of [index | uuid | type-index]",
128133
Value: cli.NewStringSlice(nvcdi.DeviceNameStrategyIndex, nvcdi.DeviceNameStrategyUUID),
129134
Destination: &opts.deviceNameStrategies,
135+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_DEVICE_NAME_STRATEGIES"},
130136
},
131137
&cli.StringFlag{
132138
Name: "driver-root",
133139
Usage: "Specify the NVIDIA GPU driver root to use when discovering the entities that should be included in the CDI specification.",
134140
Destination: &opts.driverRoot,
141+
EnvVars: []string{"NVIDIA_CTK_DRIVER_ROOT"},
135142
},
136143
&cli.StringSliceFlag{
137144
Name: "library-search-path",
138145
Usage: "Specify the path to search for libraries when discovering the entities that should be included in the CDI specification.\n\tNote: This option only applies to CSV mode.",
139146
Destination: &opts.librarySearchPaths,
147+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_LIBRARY_SEARCH_PATHS"},
140148
},
141149
&cli.StringFlag{
142150
Name: "nvidia-cdi-hook-path",
@@ -145,36 +153,42 @@ func (m command) build() *cli.Command {
145153
"If not specified, the PATH will be searched for `nvidia-cdi-hook`. " +
146154
"NOTE: That if this is specified as `nvidia-ctk`, the PATH will be searched for `nvidia-ctk` instead.",
147155
Destination: &opts.nvidiaCDIHookPath,
156+
EnvVars: []string{"NVIDIA_CTK_CDI_HOOK_PATH"},
148157
},
149158
&cli.StringFlag{
150159
Name: "ldconfig-path",
151160
Usage: "Specify the path to use for ldconfig in the generated CDI specification",
152161
Destination: &opts.ldconfigPath,
162+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_LDCONFIG_PATH"},
153163
},
154164
&cli.StringFlag{
155165
Name: "vendor",
156166
Aliases: []string{"cdi-vendor"},
157167
Usage: "the vendor string to use for the generated CDI specification.",
158168
Value: "nvidia.com",
159169
Destination: &opts.vendor,
170+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_VENDOR"},
160171
},
161172
&cli.StringFlag{
162173
Name: "class",
163174
Aliases: []string{"cdi-class"},
164175
Usage: "the class string to use for the generated CDI specification.",
165176
Value: "gpu",
166177
Destination: &opts.class,
178+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_CLASS"},
167179
},
168180
&cli.StringSliceFlag{
169181
Name: "csv.file",
170182
Usage: "The path to the list of CSV files to use when generating the CDI specification in CSV mode.",
171183
Value: cli.NewStringSlice(csv.DefaultFileList()...),
172184
Destination: &opts.csv.files,
185+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_CSV_FILES"},
173186
},
174187
&cli.StringSliceFlag{
175188
Name: "csv.ignore-pattern",
176189
Usage: "Specify a pattern the CSV mount specifications.",
177190
Destination: &opts.csv.ignorePatterns,
191+
EnvVars: []string{"NVIDIA_CTK_CDI_GENERATE_CSV_IGNORE_PATTERNS"},
178192
},
179193
}
180194

cmd/nvidia-ctk/cdi/list/list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func (m command) build() *cli.Command {
6464
Usage: "specify the directories to scan for CDI specifications",
6565
Value: cli.NewStringSlice(cdi.DefaultSpecDirs...),
6666
Destination: &cfg.cdiSpecDirs,
67+
EnvVars: []string{"NVIDIA_CTK_CDI_SPEC_DIRS"},
6768
},
6869
}
6970

0 commit comments

Comments
 (0)