@@ -29,49 +29,36 @@ import (
29
29
)
30
30
31
31
var (
32
- socketpath string
33
- cloudconfig string
32
+ socketPath string
33
+ cloudConfig string
34
34
)
35
35
36
36
func main () {
37
- // Glog requires this otherwise it complains.
38
- if err := flag .CommandLine .Parse (nil ); err != nil {
39
- klog .Fatalf ("Unable to parse flags: %v" , err )
40
- }
37
+ flag .Parse ()
38
+
41
39
// This is a temporary hack to enable proper logging until upstream dependencies
42
40
// are migrated to fully utilize klog instead of glog.
43
- klogFlags := flag .NewFlagSet ("klog" , flag .ExitOnError )
44
- klog .InitFlags (klogFlags )
45
- // Sync the glog and klog flags.
46
- flag .CommandLine .VisitAll (func (f1 * flag.Flag ) {
47
- f2 := klogFlags .Lookup (f1 .Name )
48
- if f2 != nil {
49
- value := f1 .Value .String ()
50
- _ = f2 .Value .Set (value )
51
- }
52
- })
41
+ klog .InitFlags (nil )
53
42
54
43
cmd := & cobra.Command {
55
44
Use : "barbican-kms-plugin" ,
56
- Short : "Barbican KMS plugin for kubernetes " ,
45
+ Short : "Barbican KMS plugin for Kubernetes " ,
57
46
RunE : func (cmd * cobra.Command , args []string ) error {
58
- sigchan := make (chan os.Signal , 1 )
59
- signal .Notify (sigchan , unix .SIGTERM , unix .SIGINT )
60
- err := server .Run (cloudconfig , socketpath , sigchan )
47
+ sigChan := make (chan os.Signal , 1 )
48
+ signal .Notify (sigChan , unix .SIGTERM , unix .SIGINT )
49
+ err := server .Run (cloudConfig , socketPath , sigChan )
61
50
return err
62
51
},
63
52
}
64
53
65
- cmd .Flags ().AddGoFlagSet (flag .CommandLine )
66
-
67
- cmd .PersistentFlags ().StringVar (& socketpath , "socketpath" , "" , "Barbican KMS Plugin unix socket endpoint" )
54
+ cmd .PersistentFlags ().StringVar (& socketPath , "socketpath" , "" , "Barbican KMS Plugin unix socket endpoint" )
68
55
if err := cmd .MarkPersistentFlagRequired ("socketpath" ); err != nil {
69
- klog .Fatalf ("Unable to mark flag socketpath to be required: %v" , err )
56
+ klog .Fatalf ("Unable to mark flag socketpath as required: %v" , err )
70
57
}
71
58
72
- cmd .PersistentFlags ().StringVar (& cloudconfig , "cloud-config" , "" , "Barbican KMS Plugin cloud config" )
59
+ cmd .PersistentFlags ().StringVar (& cloudConfig , "cloud-config" , "" , "Barbican KMS Plugin cloud config" )
73
60
if err := cmd .MarkPersistentFlagRequired ("cloud-config" ); err != nil {
74
- klog .Fatalf ("Unable to mark flag cloud-config to be required: %v" , err )
61
+ klog .Fatalf ("Unable to mark flag cloud-config as required: %v" , err )
75
62
}
76
63
77
64
code := cli .Run (cmd )
0 commit comments