From 40f461cbd45e88fd27a0c626a52399b6dd6c0d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bojanowski?= Date: Tue, 6 Aug 2024 16:25:04 +0200 Subject: [PATCH] add successful message once vCluster is up; log upgraded or created based on the action taken --- pkg/cli/create_helm.go | 18 ++++++++++++++---- pkg/util/clihelper/clihelper.go | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pkg/cli/create_helm.go b/pkg/cli/create_helm.go index be742572ed..b35ef70dd6 100644 --- a/pkg/cli/create_helm.go +++ b/pkg/cli/create_helm.go @@ -280,8 +280,9 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags. if err != nil { return err } - + verb := "created" if isVClusterDeployed(release) { + verb = "upgraded" // While certain backing store changes are allowed we prohibit changes to another distro. if err := config.ValidateChanges(currentVClusterConfig, vClusterConfig); err != nil { return err @@ -304,7 +305,7 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags. // check if we should connect to the vcluster or print the kubeconfig if cmd.Connect || cmd.Print { - cmd.log.Donef("Successfully created virtual cluster %s in namespace %s", vClusterName, cmd.Namespace) + cmd.log.Donef("Successfully %s virtual cluster %s in namespace %s", verb, vClusterName, cmd.Namespace) return ConnectHelm(ctx, &ConnectOptions{ BackgroundProxy: cmd.BackgroundProxy, UpdateCurrent: cmd.UpdateCurrent, @@ -315,9 +316,18 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags. } if cmd.localCluster { - cmd.log.Donef("Successfully created virtual cluster %s in namespace %s. \n- Use 'vcluster connect %s --namespace %s' to access the virtual cluster", vClusterName, cmd.Namespace, vClusterName, cmd.Namespace) + cmd.log.Donef( + "Successfully %s virtual cluster %s in namespace %s. \n"+ + "- Use 'vcluster connect %s --namespace %s' to access the virtual cluster", + verb, vClusterName, cmd.Namespace, vClusterName, cmd.Namespace, + ) } else { - cmd.log.Donef("Successfully created virtual cluster %s in namespace %s. \n- Use 'vcluster connect %s --namespace %s' to access the virtual cluster\n- Use `vcluster connect %s --namespace %s -- kubectl get ns` to run a command directly within the vcluster", vClusterName, cmd.Namespace, vClusterName, cmd.Namespace, vClusterName, cmd.Namespace) + cmd.log.Donef( + "Successfully %s virtual cluster %s in namespace %s. \n"+ + "- Use 'vcluster connect %s --namespace %s' to access the virtual cluster\n"+ + "- Use `vcluster connect %s --namespace %s -- kubectl get ns` to run a command directly within the vcluster", + verb, vClusterName, cmd.Namespace, vClusterName, cmd.Namespace, vClusterName, cmd.Namespace, + ) } return nil diff --git a/pkg/util/clihelper/clihelper.go b/pkg/util/clihelper/clihelper.go index 6c909cb36f..1d415a0290 100644 --- a/pkg/util/clihelper/clihelper.go +++ b/pkg/util/clihelper/clihelper.go @@ -88,6 +88,7 @@ func GetKubeConfig(ctx context.Context, kubeClient *kubernetes.Clientset, vclust if err != nil { return false, nil } + log.Done("vCluster is up and running") return true, nil }) if err != nil {