Skip to content

Commit

Permalink
Merge pull request #2032 from hidalgopl/minor-log-improvements-in-vcl…
Browse files Browse the repository at this point in the history
…uster-create

minor log improvements in vcluster create
  • Loading branch information
FabianKramm authored Aug 6, 2024
2 parents 93b1c4a + 40f461c commit 82895be
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions pkg/cli/create_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkg/util/clihelper/clihelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 82895be

Please sign in to comment.