... | ... |
@@ -109,7 +109,7 @@ func NewCommandAdmin(name, fullName string, out io.Writer) *cobra.Command { |
109 | 109 |
} |
110 | 110 |
|
111 | 111 |
if name == fullName { |
112 |
- cmds.AddCommand(version.NewVersionCommand(fullName)) |
|
112 |
+ cmds.AddCommand(version.NewVersionCommand(fullName, false)) |
|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
cmds.AddCommand(cmd.NewCmdOptions(out)) |
... | ... |
@@ -145,7 +145,7 @@ func NewCommandCLI(name, fullName string, in io.Reader, out, errout io.Writer) * |
145 | 145 |
ExposeFlags(loginCmd, "certificate-authority", "insecure-skip-tls-verify") |
146 | 146 |
|
147 | 147 |
if name == fullName { |
148 |
- cmds.AddCommand(version.NewVersionCommand(fullName)) |
|
148 |
+ cmds.AddCommand(version.NewVersionCommand(fullName, false)) |
|
149 | 149 |
} |
150 | 150 |
cmds.AddCommand(cmd.NewCmdOptions(out)) |
151 | 151 |
|
... | ... |
@@ -50,7 +50,7 @@ func NewCommandSTIBuilder(name string) *cobra.Command { |
50 | 50 |
}, |
51 | 51 |
} |
52 | 52 |
|
53 |
- cmd.AddCommand(version.NewVersionCommand(name)) |
|
53 |
+ cmd.AddCommand(version.NewVersionCommand(name, false)) |
|
54 | 54 |
return cmd |
55 | 55 |
} |
56 | 56 |
|
... | ... |
@@ -64,6 +64,6 @@ func NewCommandDockerBuilder(name string) *cobra.Command { |
64 | 64 |
cmd.RunDockerBuild() |
65 | 65 |
}, |
66 | 66 |
} |
67 |
- cmd.AddCommand(version.NewVersionCommand(name)) |
|
67 |
+ cmd.AddCommand(version.NewVersionCommand(name, false)) |
|
68 | 68 |
return cmd |
69 | 69 |
} |
... | ... |
@@ -110,7 +110,7 @@ func NewCommandOpenShift(name string) *cobra.Command { |
110 | 110 |
root.AddCommand(cli.NewCommandCLI("cli", name+" cli", in, out, errout)) |
111 | 111 |
root.AddCommand(cli.NewCmdKubectl("kube", out)) |
112 | 112 |
root.AddCommand(newExperimentalCommand("ex", name+" ex")) |
113 |
- root.AddCommand(version.NewVersionCommand(name)) |
|
113 |
+ root.AddCommand(version.NewVersionCommand(name, true)) |
|
114 | 114 |
|
115 | 115 |
// infra commands are those that are bundled with the binary but not displayed to end users |
116 | 116 |
// directly |
... | ... |
@@ -37,7 +37,7 @@ func NewCommand(name, fullName string, out io.Writer) *cobra.Command { |
37 | 37 |
cmds.AddCommand(NewProxyCommand("proxy", fullName+" proxy", out)) |
38 | 38 |
cmds.AddCommand(NewSchedulerCommand("scheduler", fullName+" scheduler", out)) |
39 | 39 |
if "hyperkube" == fullName { |
40 |
- cmds.AddCommand(version.NewVersionCommand(fullName)) |
|
40 |
+ cmds.AddCommand(version.NewVersionCommand(fullName, false)) |
|
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
return cmds |
... | ... |
@@ -3,6 +3,7 @@ package version |
3 | 3 |
import ( |
4 | 4 |
"fmt" |
5 | 5 |
|
6 |
+ etcdversion "github.com/coreos/etcd/version" |
|
6 | 7 |
"github.com/prometheus/client_golang/prometheus" |
7 | 8 |
"github.com/spf13/cobra" |
8 | 9 |
kubeversion "k8s.io/kubernetes/pkg/version" |
... | ... |
@@ -52,13 +53,16 @@ func (info Info) String() string { |
52 | 52 |
} |
53 | 53 |
|
54 | 54 |
// NewVersionCommand creates a command for displaying the version of this binary |
55 |
-func NewVersionCommand(basename string) *cobra.Command { |
|
55 |
+func NewVersionCommand(basename string, printEtcdVersion bool) *cobra.Command { |
|
56 | 56 |
return &cobra.Command{ |
57 | 57 |
Use: "version", |
58 | 58 |
Short: "Display version", |
59 | 59 |
Run: func(c *cobra.Command, args []string) { |
60 | 60 |
fmt.Printf("%s %v\n", basename, Get()) |
61 | 61 |
fmt.Printf("kubernetes %v\n", kubeversion.Get()) |
62 |
+ if printEtcdVersion { |
|
63 |
+ fmt.Printf("etcd %v\n", etcdversion.Version) |
|
64 |
+ } |
|
62 | 65 |
}, |
63 | 66 |
} |
64 | 67 |
} |