Skip to content

Commit

Permalink
fix: rename loft->vcluster platform
Browse files Browse the repository at this point in the history
Signed-off-by: Rohan CJ <rohantmp@gmail.com>
  • Loading branch information
rohantmp committed Nov 21, 2024
1 parent 9467059 commit 81fa5e4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
10 changes: 5 additions & 5 deletions cmd/vclusterctl/cmd/platform/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func NewDestroyCmd(globalFlags *flags.GlobalFlags) *cobra.Command {

destroyCmd := &cobra.Command{
Use: "destroy",
Short: "Destroy a vCluster platform instance",
Short: "Destroy a vCluster Platform instance",
Long: `########################################################
############# vcluster platform destroy ##################
########################################################
Destroys a vCluster platform instance in your Kubernetes cluster.
Destroys a vCluster Platform instance in your Kubernetes cluster.
Please make sure you meet the following requirements
before running this command:
Expand All @@ -55,7 +55,7 @@ VirtualClusterInstances managed with driver helm will be deleted, but the underl
}

destroyCmd.Flags().StringVar(&cmd.Context, "context", "", "The kube context to use for installation")
destroyCmd.Flags().StringVar(&cmd.Namespace, "namespace", "", "The namespace vCluster platform is installed in")
destroyCmd.Flags().StringVar(&cmd.Namespace, "namespace", "", "The namespace vCluster Platform is installed in")
destroyCmd.Flags().BoolVar(&cmd.DeleteNamespace, "delete-namespace", true, "Whether to delete the namespace or not")
destroyCmd.Flags().BoolVar(&cmd.IgnoreNotFound, "ignore-not-found", false, "Exit successfully if platform installation is not found")
destroyCmd.Flags().BoolVar(&cmd.Force, "force", false, "Try uninstalling even if the platform is not installed. '--namespace' is required if true")
Expand All @@ -78,15 +78,15 @@ func (cmd *DestroyCmd) Run(ctx context.Context) error {
cmd.Log.Info("no platform installation found")
return nil
}
return fmt.Errorf("vCluster platform may not be installed: %w", err)
return fmt.Errorf("vCluster Platform may not be installed: %w", err)
}
cmd.Log.Infof("found platform installation in namespace %q", namespace)
cmd.Namespace = namespace
}

found, err := clihelper.IsLoftAlreadyInstalled(ctx, cmd.KubeClient, cmd.Namespace)
if err != nil {
return fmt.Errorf("vCluster platform may not be installed: %w", err)
return fmt.Errorf("vCluster Platform may not be installed: %w", err)
}
shouldForce := cmd.Force && cmd.Namespace != ""
if !found && !shouldForce {
Expand Down
3 changes: 1 addition & 2 deletions cmd/vclusterctl/cmd/platform/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"

"github.com/loft-sh/api/v4/pkg/product"
"github.com/loft-sh/log"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/use"
"github.com/loft-sh/vcluster/pkg/cli/config"
Expand Down Expand Up @@ -76,7 +75,7 @@ func (cmd *LogoutCmd) Run(ctx context.Context) error {
return fmt.Errorf("save config: %w", err)
}

cmd.Log.Donef(product.Replace("Successfully logged out of vcluster platform instance %s"), ansi.Color(configHost, "white+b"))
cmd.Log.Donef("Successfully logged out of vCluster Palatform instance %s", ansi.Color(configHost, "white+b"))
}

return use.SwitchDriver(ctx, cfg, string(config.HelmDriver), cmd.Log)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/start/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (l *LoftStarter) prepareDocker() error {
// test for helm and kubectl
_, err := exec.LookPath("docker")
if err != nil {
return fmt.Errorf("seems like docker is not installed. Docker is required for the installation of loft. Please visit https://docs.docker.com/engine/install/ for install instructions")
return fmt.Errorf("seems like docker is not installed. Docker is required for the installation of vCluster Platform. Please visit https://docs.docker.com/engine/install/ for install instructions")
}

output, err := exec.Command("docker", "ps").CombinedOutput()
Expand Down
6 changes: 3 additions & 3 deletions pkg/cli/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (l *Options) Prepare() error {
contextToLoad = l.Context
} else if platformConfig.LastInstallContext != "" && platformConfig.LastInstallContext != contextToLoad {
contextToLoad, err = l.Log.Question(&survey.QuestionOptions{
Question: product.Replace(fmt.Sprintf("Seems like you try to use 'loft %s' with a different kubernetes context than before. Please choose which kubernetes context you want to use", l.CommandName)),
Question: product.Replace(fmt.Sprintf("Seems like you try to use 'vcluster %s' with a different kubernetes context than before. Please choose which kubernetes context you want to use", l.CommandName)),
DefaultValue: contextToLoad,
Options: []string{contextToLoad, platformConfig.LastInstallContext},
})
Expand All @@ -182,7 +182,7 @@ func (l *Options) Prepare() error {
// test for helm and kubectl
_, err = exec.LookPath("helm")
if err != nil {
return fmt.Errorf("seems like helm is not installed. Helm is required for the installation of loft. Please visit https://helm.sh/docs/intro/install/ for install instructions")
return fmt.Errorf("seems like helm is not installed. Helm is required for the installation of vCluster Platform. Please visit https://helm.sh/docs/intro/install/ for install instructions")
}

output, err := exec.Command("helm", "version").CombinedOutput()
Expand All @@ -192,7 +192,7 @@ func (l *Options) Prepare() error {

_, err = exec.LookPath("kubectl")
if err != nil {
return fmt.Errorf("seems like kubectl is not installed. Kubectl is required for the installation of loft. Please visit https://kubernetes.io/docs/tasks/tools/install-kubectl/ for install instructions")
return fmt.Errorf("seems like kubectl is not installed. Kubectl is required for the installation of vCluster Platform. Please visit https://kubernetes.io/docs/tasks/tools/install-kubectl/ for install instructions")
}

output, err = exec.Command("kubectl", "version", "--context", contextToLoad).CombinedOutput()
Expand Down
2 changes: 1 addition & 1 deletion pkg/platform/clihelper/clihelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func IsLoftAlreadyInstalled(ctx context.Context, kubeClient kubernetes.Interface
return true, nil
}

var ErrPlatformNamespaceNotFound = errors.New("loft installation namespace not found")
var ErrPlatformNamespaceNotFound = errors.New("vCluster Platform installation namespace not found")

func VClusterPlatformInstallationNamespace(ctx context.Context) (string, error) {
kubeClientConfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(clientcmd.NewDefaultClientConfigLoadingRules(), &clientcmd.ConfigOverrides{})
Expand Down

0 comments on commit 81fa5e4

Please sign in to comment.