Skip to content

Commit

Permalink
Merge pull request #25 from gnufied/show-version
Browse files Browse the repository at this point in the history
Add version flag
  • Loading branch information
k8s-ci-robot authored Mar 7, 2019
2 parents eb81b91 + 51df971 commit 25e836c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cmd/csi-resizer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package main

import (
"flag"
"fmt"
"os"
"time"

"github.com/kubernetes-csi/external-resizer/pkg/controller"
Expand All @@ -35,8 +37,9 @@ var (
resyncPeriod = flag.Duration("resync-period", time.Minute*10, "Resync period for cache")
workers = flag.Int("workers", 10, "Concurrency to process multiple resize requests")

csiAddress = flag.String("csi-address", "/run/csi/socket", "Address of the CSI driver socket.")
csiTimeout = flag.Duration("csiTimeout", 15*time.Second, "Timeout for waiting for CSI driver socket.")
csiAddress = flag.String("csi-address", "/run/csi/socket", "Address of the CSI driver socket.")
csiTimeout = flag.Duration("csiTimeout", 15*time.Second, "Timeout for waiting for CSI driver socket.")
showVersion = flag.Bool("version", false, "Show version")

enableLeaderElection = flag.Bool("leader-election", false, "Enable leader election.")
leaderElectionIdentity = flag.String("leader-election-identity", "", "Unique identity of this resizer. Typically name of the pod where the resizer runs.")
Expand All @@ -56,13 +59,20 @@ var (
"slot. This is effectively the maximum duration that a leader can be stopped "+
"before it is replaced by another candidate. This is only applicable if leader "+
"election is enabled.")
version = "unknown"
)

func main() {
klog.InitFlags(nil)
flag.Set("logtostderr", "true")
flag.Parse()

if *showVersion {
fmt.Println(os.Args[0], version)
os.Exit(0)
}
klog.Infof("Version : %s", version)

kubeClient, err := util.NewK8sClient(*master, *kubeConfig)
if err != nil {
klog.Fatal(err.Error())
Expand Down

0 comments on commit 25e836c

Please sign in to comment.