Skip to content

fix pointer issue for GCE staging support #1609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/gce-pd-csi-driver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ func init() {
// Use V(5) for GCE Cloud Provider Call informational logging
// Use V(6) for extra repeated/polling information
enumFlag(&computeEnvironment, "compute-environment", allowedComputeEnvironment, "Operating compute environment")
urlFlag(computeEndpoint, "compute-endpoint", "Compute endpoint")
urlFlag(&computeEndpoint, "compute-endpoint", "Compute endpoint")
klog.InitFlags(flag.CommandLine)
flag.Set("logtostderr", "true")
}

func main() {
flag.Parse()
rand.Seed(time.Now().UnixNano())
klog.Infof("Operating compute environment set to: %s and computeEndpoint is set to: %v", computeEnvironment, computeEndpoint)
handle()
os.Exit(0)
}
Expand Down Expand Up @@ -225,13 +226,14 @@ func enumFlag(target *gce.Environment, name string, allowedComputeEnvironment []

}

func urlFlag(target *url.URL, name string, usage string) {
func urlFlag(target **url.URL, name string, usage string) {
flag.Func(name, usage, func(flagValue string) error {
computeURL, err := url.ParseRequestURI(flagValue)
if err == nil {
target = computeURL
*target = computeURL
return nil
}
klog.Infof("Error parsing endpoint compute endpoint %v", err)
return err
})
}