@@ -33,7 +33,7 @@ import (
3333 "k8s.io/component-base/logs"
3434
3535 "github.com/NVIDIA/k8s-dra-driver-gpu/internal/info"
36- "github.com/NVIDIA/k8s-dra-driver-gpu/pkg/flags"
36+ pkgflags "github.com/NVIDIA/k8s-dra-driver-gpu/pkg/flags"
3737)
3838
3939const (
@@ -43,9 +43,7 @@ const (
4343)
4444
4545type Flags struct {
46- kubeClientConfig flags.KubeClientConfig
47- loggingConfig * flags.LoggingConfig
48- featureGateConfig * flags.FeatureGateConfig
46+ kubeClientConfig pkgflags.KubeClientConfig
4947
5048 nodeName string
5149 namespace string
@@ -60,7 +58,7 @@ type Flags struct {
6058
6159type Config struct {
6260 flags * Flags
63- clientsets flags .ClientSets
61+ clientsets pkgflags .ClientSets
6462}
6563
6664func (c Config ) DriverPluginPath () string {
@@ -75,10 +73,8 @@ func main() {
7573}
7674
7775func newApp () * cli.App {
78- flags := & Flags {
79- loggingConfig : flags .NewLoggingConfig (),
80- featureGateConfig : flags .NewFeatureGateConfig (),
81- }
76+ loggingConfig := pkgflags .NewLoggingConfig ()
77+ flags := & Flags {}
8278 cliFlags := []cli.Flag {
8379 & cli.StringFlag {
8480 Name : "node-name" ,
@@ -145,8 +141,8 @@ func newApp() *cli.App {
145141 },
146142 }
147143 cliFlags = append (cliFlags , flags .kubeClientConfig .Flags ()... )
148- cliFlags = append (cliFlags , flags . featureGateConfig .Flags ()... )
149- cliFlags = append (cliFlags , flags . loggingConfig .Flags ()... )
144+ cliFlags = append (cliFlags , pkgflags . NewFeatureGateConfig () .Flags ()... )
145+ cliFlags = append (cliFlags , loggingConfig .Flags ()... )
150146
151147 app := & cli.App {
152148 Name : "compute-domain-kubelet-plugin" ,
@@ -158,11 +154,12 @@ func newApp() *cli.App {
158154 if c .Args ().Len () > 0 {
159155 return fmt .Errorf ("arguments not supported: %v" , c .Args ().Slice ())
160156 }
161- return flags .loggingConfig .Apply ()
157+ // `loggingConfig` is now rendered based on user input such as CLI args
158+ err := loggingConfig .Apply ()
159+ pkgflags .LogStartupConfig (flags , loggingConfig )
160+ return err
162161 },
163162 Action : func (c * cli.Context ) error {
164- ctx := c .Context
165-
166163 clientSets , err := flags .kubeClientConfig .NewClientSets ()
167164 if err != nil {
168165 return fmt .Errorf ("create client: %w" , err )
@@ -173,7 +170,7 @@ func newApp() *cli.App {
173170 clientsets : clientSets ,
174171 }
175172
176- return RunPlugin (ctx , config )
173+ return RunPlugin (c . Context , config )
177174 },
178175 After : func (c * cli.Context ) error {
179176 // Runs after `Action` (regardless of success/error). In urfave cli
0 commit comments