Skip to content

Commit

Permalink
Merge pull request #1868 from FabianKramm/main
Browse files Browse the repository at this point in the history
chore: bump loft-sh dependency
  • Loading branch information
FabianKramm authored Jun 14, 2024
2 parents e3eb5e3 + 3823d02 commit 19b89f2
Show file tree
Hide file tree
Showing 752 changed files with 27,311 additions and 42,732 deletions.
73 changes: 0 additions & 73 deletions cmd/vclusterctl/cmd/import.go

This file was deleted.

1 change: 1 addition & 0 deletions cmd/vclusterctl/cmd/platform/add/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ func NewAddCmd(globalFlags *flags.GlobalFlags) *cobra.Command {
}

addCmd.AddCommand(NewClusterCmd(globalFlags))
addCmd.AddCommand(NewVClusterCmd(globalFlags))
return addCmd
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package importcmd
package add

import (
"context"

"github.com/loft-sh/log"
"github.com/loft-sh/vcluster/pkg/cli"
"github.com/loft-sh/vcluster/pkg/cli/flags"
"github.com/loft-sh/vcluster/pkg/cli/util"
"github.com/spf13/cobra"
)

Expand All @@ -23,28 +22,26 @@ func NewVClusterCmd(globalFlags *flags.GlobalFlags) *cobra.Command {
Log: log.GetInstance(),
}

description := `#################################################################
############### vcluster platform import vcluster ###############
#################################################################
Imports a vCluster into a vCluster platform project.
description := `###############################################
############# vcluster platform add vcluster ##############
###############################################
Adds a vCluster to the vCluster platform.
Example:
vcluster platform import vcluster my-vcluster --cluster connected-cluster \
--namespace vcluster-my-vcluster --project my-project --import-name my-vcluster
################################################################
vcluster platform add vcluster my-vcluster --namespace vcluster-my-vcluster --project my-project --import-name my-vcluster
###############################################
`

importCmd := &cobra.Command{
Use: "vcluster" + util.VClusterNameOnlyUseLine,
Short: "Imports a vCluster into a vCluster platform project",
Use: "vcluster",
Short: "Adds an existing vCluster to the vCluster platform",
Long: description,
Args: util.VClusterNameOnlyValidator,
Args: cobra.ExactArgs(1),
RunE: func(cobraCmd *cobra.Command, args []string) error {
return cmd.Run(cobraCmd.Context(), args)
},
}

importCmd.Flags().StringVar(&cmd.ClusterName, "cluster", "", "Cluster name of the cluster the virtual cluster is running on")
importCmd.Flags().StringVar(&cmd.Project, "project", "", "The project to import the vCluster into")
importCmd.Flags().StringVar(&cmd.ImportName, "import-name", "", "The name of the vCluster under projects. If unspecified, will use the vcluster name")

Expand All @@ -53,5 +50,5 @@ vcluster platform import vcluster my-vcluster --cluster connected-cluster \

// Run executes the functionality
func (cmd *VClusterCmd) Run(ctx context.Context, args []string) error {
return cli.ImportPlatform(ctx, &cmd.ImportOptions, cmd.GlobalFlags, args[0], cmd.Log)
return cli.ImportHelm(ctx, &cmd.ImportOptions, cmd.GlobalFlags, args[0], cmd.Log)
}
2 changes: 1 addition & 1 deletion cmd/vclusterctl/cmd/platform/connect/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (cmd *NamespaceCmd) Run(ctx context.Context, args []string) error {
spaceName = args[0]
}

cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstanceOrSpace(ctx, platformClient, spaceName, cmd.Project, cmd.Cluster, cmd.log)
cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstance(ctx, platformClient, spaceName, cmd.Project, cmd.log)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/vclusterctl/cmd/platform/delete/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (cmd *NamespaceCmd) Run(ctx context.Context, args []string) error {
spaceName = args[0]
}

cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstanceOrSpace(ctx, platformClient, spaceName, cmd.Project, cmd.Cluster, cmd.Log)
cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstance(ctx, platformClient, spaceName, cmd.Project, cmd.Log)
if err != nil {
return err
}
Expand Down
25 changes: 0 additions & 25 deletions cmd/vclusterctl/cmd/platform/import/import.go

This file was deleted.

26 changes: 0 additions & 26 deletions cmd/vclusterctl/cmd/platform/list/spaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,6 @@ func (cmd *NamespacesCmd) RunSpaces(ctx context.Context) error {
duration.HumanDuration(time.Since(space.SpaceInstance.CreationTimestamp.Time)),
})
}
if len(spaceInstances) == 0 {
spaces, err := platform.GetSpaces(ctx, platformClient, cmd.log)
if err != nil {
return err
}
for _, space := range spaces {
sleepModeConfig := space.Status.SleepModeConfig
sleeping := "false"
if sleepModeConfig.Status.SleepingSince != 0 {
sleeping = duration.HumanDuration(time.Since(time.Unix(sleepModeConfig.Status.SleepingSince, 0)))
}
spaceName := space.Name
if space.Annotations != nil && space.Annotations["loft.sh/display-name"] != "" {
spaceName = space.Annotations["loft.sh/display-name"] + " (" + spaceName + ")"
}

values = append(values, []string{
spaceName,
"",
space.Cluster,
sleeping,
string(space.Space.Status.Phase),
duration.HumanDuration(time.Since(space.Space.CreationTimestamp.Time)),
})
}
}

table.PrintTable(cmd.log, header, values)
return nil
Expand Down
2 changes: 0 additions & 2 deletions cmd/vclusterctl/cmd/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/create"
cmddelete "github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/delete"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/get"
cmdimport "github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/import"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/list"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/set"
"github.com/loft-sh/vcluster/cmd/vclusterctl/cmd/platform/share"
Expand Down Expand Up @@ -54,7 +53,6 @@ func NewPlatformCmd(globalFlags *flags.GlobalFlags) (*cobra.Command, error) {
platformCmd.AddCommand(NewResetCmd(globalFlags))
platformCmd.AddCommand(add.NewAddCmd(globalFlags))
platformCmd.AddCommand(NewAccessKeyCmd(globalFlags))
platformCmd.AddCommand(cmdimport.NewImportCmd(globalFlags))
platformCmd.AddCommand(get.NewGetCmd(globalFlags, defaults))
platformCmd.AddCommand(connect.NewConnectCmd(globalFlags, defaults))
platformCmd.AddCommand(list.NewListCmd(globalFlags))
Expand Down
6 changes: 3 additions & 3 deletions cmd/vclusterctl/cmd/platform/share/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

agentstoragev1 "github.com/loft-sh/agentapi/v4/pkg/apis/loft/storage/v1"
storagev1 "github.com/loft-sh/api/v4/pkg/apis/storage/v1"
"github.com/loft-sh/api/v4/pkg/product"
"github.com/loft-sh/log"
"github.com/loft-sh/vcluster/pkg/cli/flags"
Expand Down Expand Up @@ -80,7 +80,7 @@ func (cmd *NamespaceCmd) Run(ctx context.Context, args []string) error {
spaceName = args[0]
}

cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstanceOrSpace(ctx, platformClient, spaceName, cmd.Project, cmd.Cluster, cmd.Log)
cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstance(ctx, platformClient, spaceName, cmd.Project, cmd.Log)
if err != nil {
return err
}
Expand All @@ -99,7 +99,7 @@ func (cmd *NamespaceCmd) shareSpace(ctx context.Context, platformClient platform
return err
}

accessRule := agentstoragev1.InstanceAccessRule{
accessRule := storagev1.InstanceAccessRule{
ClusterRole: cmd.ClusterRole,
}
if cmd.User != "" {
Expand Down
4 changes: 2 additions & 2 deletions cmd/vclusterctl/cmd/platform/share/vcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

agentstoragev1 "github.com/loft-sh/agentapi/v4/pkg/apis/loft/storage/v1"
storagev1 "github.com/loft-sh/api/v4/pkg/apis/storage/v1"
"github.com/loft-sh/api/v4/pkg/product"
"github.com/loft-sh/log"
"github.com/loft-sh/vcluster/pkg/cli/flags"
Expand Down Expand Up @@ -90,7 +90,7 @@ func (cmd *VClusterCmd) Run(ctx context.Context, args []string) error {
return err
}

accessRule := agentstoragev1.InstanceAccessRule{
accessRule := storagev1.InstanceAccessRule{
ClusterRole: cmd.ClusterRole,
}
if cmd.User != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/vclusterctl/cmd/platform/sleep/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (cmd *NamespaceCmd) Run(ctx context.Context, args []string) error {
spaceName = args[0]
}

cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstanceOrSpace(ctx, platformClient, spaceName, cmd.Project, cmd.Cluster, cmd.Log)
cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstance(ctx, platformClient, spaceName, cmd.Project, cmd.Log)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/vclusterctl/cmd/platform/wakeup/space.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (cmd *NamespaceCmd) Run(ctx context.Context, args []string) error {
spaceName = args[0]
}

cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstanceOrSpace(ctx, platformClient, spaceName, cmd.Project, cmd.Cluster, cmd.Log)
cmd.Cluster, cmd.Project, spaceName, err = platform.SelectSpaceInstance(ctx, platformClient, spaceName, cmd.Project, cmd.Log)
if err != nil {
return err
}
Expand Down
1 change: 0 additions & 1 deletion cmd/vclusterctl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func BuildRoot(log log.Logger) (*cobra.Command, error) {
// add top level commands
rootCmd.AddCommand(NewConnectCmd(globalFlags))
rootCmd.AddCommand(NewCreateCmd(globalFlags))
rootCmd.AddCommand(NewImportCmd(globalFlags))
rootCmd.AddCommand(NewListCmd(globalFlags))
rootCmd.AddCommand(NewDeleteCmd(globalFlags))
rootCmd.AddCommand(NewPauseCmd(globalFlags))
Expand Down
Loading

0 comments on commit 19b89f2

Please sign in to comment.