Skip to content

Commit

Permalink
Merge pull request #1053 from k8s-infra-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…997-to-release-1.19

[release-1.19] fix: flag panic if a flag is defined after being set
  • Loading branch information
andyzhangx committed Oct 17, 2023
2 parents 1a2a723 + 5693478 commit 740ab6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions pkg/blobfuse-proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@ import (
csicommon "sigs.k8s.io/blob-csi-driver/pkg/csi-common"
)

func init() {
_ = flag.Set("logtostderr", "true")
}

var (
blobfuseProxyEndpoint = flag.String("blobfuse-proxy-endpoint", "unix://tmp/blobfuse-proxy.sock", "blobfuse-proxy endpoint")
)

func main() {
klog.InitFlags(nil)
_ = flag.Set("logtostderr", "true")
flag.Parse()
proto, addr, err := csicommon.ParseEndpoint(*blobfuseProxyEndpoint)
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions pkg/blobplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ import (
"k8s.io/klog/v2"
)

func init() {
_ = flag.Set("logtostderr", "true")
}

var (
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
blobfuseProxyEndpoint = flag.String("blobfuse-proxy-endpoint", "unix://tmp/blobfuse-proxy.sock", "blobfuse-proxy endpoint")
Expand All @@ -61,6 +57,7 @@ var (

func main() {
klog.InitFlags(nil)
_ = flag.Set("logtostderr", "true")
flag.Parse()
if *version {
info, err := blob.GetVersionYAML(*driverName)
Expand Down

0 comments on commit 740ab6e

Please sign in to comment.