1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-01 06:56:29 +00:00

add cluster version command

This commit is contained in:
moelsayed
2017-11-13 02:30:13 +02:00
parent 7172f6ec46
commit cc7fddb1a3
2 changed files with 30 additions and 0 deletions

View File

@@ -34,6 +34,12 @@ func ClusterCommand() cli.Command {
Action: clusterUpFromCli,
Flags: clusterUpFlags,
},
cli.Command{
Name: "version",
Usage: "Show Cluster Kubernetes version",
Action: getClusterVersion,
Flags: []cli.Flag{},
},
},
}
}
@@ -120,3 +126,12 @@ func resolveClusterFile(ctx *cli.Context) (string, error) {
return clusterFile, nil
}
func getClusterVersion(ctx *cli.Context) error {
serverVersion, err := cluster.GetK8sVersion()
if err != nil {
return err
}
fmt.Printf("Server Version: %s\n", serverVersion)
return nil
}