mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #13179 from feihujiang/showClientVersionAtLeastWhenCouldNotReadServerVersion
Auto commit by PR queue bot
This commit is contained in:
commit
4c56d4962f
@ -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 {
|
||||
kubectl.GetClientVersion(out)
|
||||
if cmdutil.GetFlagBool(cmd, "client") {
|
||||
kubectl.GetClientVersion(out)
|
||||
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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user