Commit 6b394e72 authored by feihujiang's avatar feihujiang

Kubectl version should show client version at least

when couldn't read server version
parent 00e34429
......@@ -39,8 +39,8 @@ func NewCmdVersion(f *cmdutil.Factory, out io.Writer) *cobra.Command {
}
func RunVersion(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
if cmdutil.GetFlagBool(cmd, "client") {
kubectl.GetClientVersion(out)
if cmdutil.GetFlagBool(cmd, "client") {
return nil
}
......@@ -49,6 +49,6 @@ func RunVersion(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command) error {
return err
}
kubectl.GetVersion(out, client)
kubectl.GetServerVersion(out, client)
return nil
}
......@@ -25,12 +25,10 @@ import (
"k8s.io/kubernetes/pkg/version"
)
func GetVersion(w io.Writer, kubeClient client.Interface) {
GetClientVersion(w)
func GetServerVersion(w io.Writer, kubeClient client.Interface) {
serverVersion, err := kubeClient.ServerVersion()
if err != nil {
fmt.Printf("Couldn't read version from server: %v\n", err)
fmt.Printf("Couldn't read server version from server: %v\n", err)
os.Exit(1)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment