Skip to content

Commit 25e836c

Browse files
authored
Merge pull request #25 from gnufied/show-version
Add version flag
2 parents eb81b91 + 51df971 commit 25e836c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cmd/csi-resizer/main.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ package main
1818

1919
import (
2020
"flag"
21+
"fmt"
22+
"os"
2123
"time"
2224

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

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

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

6165
func main() {
6266
klog.InitFlags(nil)
6367
flag.Set("logtostderr", "true")
6468
flag.Parse()
6569

70+
if *showVersion {
71+
fmt.Println(os.Args[0], version)
72+
os.Exit(0)
73+
}
74+
klog.Infof("Version : %s", version)
75+
6676
kubeClient, err := util.NewK8sClient(*master, *kubeConfig)
6777
if err != nil {
6878
klog.Fatal(err.Error())

0 commit comments

Comments
 (0)