@@ -41,9 +41,10 @@ import (
4141)
4242
4343type options struct {
44- flags []cli.Flag
45- configFile string
46- kubeletSocket string
44+ flags []cli.Flag
45+ configFile string
46+ kubeletSocket string
47+ cdiFeatureFlags cli.StringSlice
4748}
4849
4950func main () {
@@ -115,19 +116,6 @@ func main() {
115116 Usage : "ensure that containers that request NVIDIA GPU resources are started with MOFED support" ,
116117 EnvVars : []string {"MOFED_ENABLED" },
117118 },
118- & cli.StringFlag {
119- Name : "kubelet-socket" ,
120- Value : pluginapi .KubeletSocket ,
121- Usage : "specify the socket for communicating with the kubelet; if this is empty, no connection with the kubelet is attempted" ,
122- Destination : & o .kubeletSocket ,
123- EnvVars : []string {"KUBELET_SOCKET" },
124- },
125- & cli.StringFlag {
126- Name : "config-file" ,
127- Usage : "the path to a config file as an alternative to command line options or environment variables" ,
128- Destination : & o .configFile ,
129- EnvVars : []string {"CONFIG_FILE" },
130- },
131119 & cli.StringFlag {
132120 Name : "cdi-annotation-prefix" ,
133121 Value : spec .DefaultCDIAnnotationPrefix ,
@@ -169,10 +157,25 @@ func main() {
169157 Usage : "The specified IMEX channels are required" ,
170158 EnvVars : []string {"IMEX_REQUIRED" },
171159 },
160+ // The following CLI flags do not have equivalents in the config file.
161+ & cli.StringFlag {
162+ Name : "kubelet-socket" ,
163+ Value : pluginapi .KubeletSocket ,
164+ Usage : "specify the socket for communicating with the kubelet; if this is empty, no connection with the kubelet is attempted" ,
165+ Destination : & o .kubeletSocket ,
166+ EnvVars : []string {"KUBELET_SOCKET" },
167+ },
168+ & cli.StringFlag {
169+ Name : "config-file" ,
170+ Usage : "the path to a config file as an alternative to command line options or environment variables" ,
171+ Destination : & o .configFile ,
172+ EnvVars : []string {"CONFIG_FILE" },
173+ },
172174 & cli.StringSliceFlag {
173- Name : "cdi-feature-flags" ,
174- Usage : "A set of feature flags to be passed to the CDI spec generation logic" ,
175- EnvVars : []string {"CDI_FEATURE_FLAGS" },
175+ Name : "cdi-feature-flags" ,
176+ Usage : "A set of feature flags to be passed to the CDI spec generation logic" ,
177+ EnvVars : []string {"CDI_FEATURE_FLAGS" },
178+ Destination : & o .cdiFeatureFlags ,
176179 },
177180 }
178181 o .flags = c .Flags
@@ -364,7 +367,7 @@ func startPlugins(c *cli.Context, o *options) ([]plugin.Interface, bool, error)
364367
365368 // Get the set of plugins.
366369 klog .Info ("Retrieving plugins." )
367- plugins , err := GetPlugins (c .Context , infolib , nvmllib , devicelib , config )
370+ plugins , err := GetPlugins (c .Context , infolib , nvmllib , devicelib , config , o )
368371 if err != nil {
369372 return nil , false , fmt .Errorf ("error getting plugins: %v" , err )
370373 }
0 commit comments