Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v0.20] Merge pull request #2032 from hidalgopl/minor-log-improvements-in-vcluster-create #2033

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading