1
0
mirror of https://github.com/rancher/rke.git synced 2025-04-27 03:11:03 +00:00

print version

This commit is contained in:
Murali Paluru 2019-09-03 13:01:22 -07:00 committed by Alena Prokharchyk
parent 11c49ae59f
commit c69d971962
5 changed files with 14 additions and 1 deletions

View File

@ -4,6 +4,8 @@ import (
"context"
"fmt"
"github.com/sirupsen/logrus"
"github.com/rancher/rke/cluster"
"github.com/rancher/rke/hosts"
"github.com/rancher/rke/log"
@ -71,6 +73,7 @@ func CertificateCommand() cli.Command {
}
func rotateRKECertificatesFromCli(ctx *cli.Context) error {
logrus.Infof("Running RKE version: %v", ctx.App.Version)
k8sComponents := ctx.StringSlice("service")
rotateCACerts := ctx.Bool("rotate-ca")
clusterFile, filePath, err := resolveClusterFile(ctx)
@ -101,6 +104,7 @@ func rotateRKECertificatesFromCli(ctx *cli.Context) error {
}
func generateCSRFromCli(ctx *cli.Context) error {
logrus.Infof("Running RKE version: %v", ctx.App.Version)
clusterFile, filePath, err := resolveClusterFile(ctx)
if err != nil {
return fmt.Errorf("Failed to resolve cluster file: %v", err)

View File

@ -179,6 +179,7 @@ func RestoreEtcdSnapshot(
}
func SnapshotSaveEtcdHostsFromCli(ctx *cli.Context) error {
logrus.Infof("Running RKE version: %v", ctx.App.Version)
clusterFile, filePath, err := resolveClusterFile(ctx)
if err != nil {
return fmt.Errorf("failed to resolve cluster file: %v", err)
@ -206,6 +207,7 @@ func SnapshotSaveEtcdHostsFromCli(ctx *cli.Context) error {
}
func RestoreEtcdSnapshotFromCli(ctx *cli.Context) error {
logrus.Infof("Running RKE version: %v", ctx.App.Version)
clusterFile, filePath, err := resolveClusterFile(ctx)
if err != nil {
return fmt.Errorf("failed to resolve cluster file: %v", err)

View File

@ -12,7 +12,7 @@ import (
"github.com/rancher/rke/hosts"
"github.com/rancher/rke/log"
"github.com/rancher/rke/pki"
"github.com/rancher/types/apis/management.cattle.io/v3"
v3 "github.com/rancher/types/apis/management.cattle.io/v3"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
@ -81,6 +81,7 @@ func ClusterRemove(
}
func clusterRemoveFromCli(ctx *cli.Context) error {
logrus.Infof("Running RKE version: %v", ctx.App.Version)
if ctx.Bool("local") {
return clusterRemoveLocal(ctx)
}

View File

@ -6,6 +6,8 @@ import (
"strings"
"time"
"github.com/sirupsen/logrus"
"github.com/rancher/rke/cluster"
"github.com/rancher/rke/dind"
"github.com/rancher/rke/hosts"
@ -205,6 +207,7 @@ func checkAllIncluded(cluster *cluster.Cluster) error {
}
func clusterUpFromCli(ctx *cli.Context) error {
logrus.Infof("Running RKE version: %v", ctx.App.Version)
if ctx.Bool("local") {
return clusterUpLocal(ctx)
}

View File

@ -3,6 +3,8 @@ package cmd
import (
"fmt"
"github.com/sirupsen/logrus"
"github.com/rancher/rke/cluster"
"github.com/rancher/rke/pki"
"github.com/urfave/cli"
@ -26,6 +28,7 @@ func VersionCommand() cli.Command {
}
func getClusterVersion(ctx *cli.Context) error {
logrus.Infof("Running RKE version: %v", ctx.App.Version)
localKubeConfig := pki.GetLocalKubeConfig(ctx.String("config"), "")
// not going to use a k8s dialer here.. this is a CLI command
serverVersion, err := cluster.GetK8sVersion(localKubeConfig, nil)