Skip to content
Draft
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
10 changes: 10 additions & 0 deletions pkg/cli/create_platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"github.com/loft-sh/vcluster/pkg/platform"
"github.com/loft-sh/vcluster/pkg/platform/clihelper"
"github.com/loft-sh/vcluster/pkg/projectutil"
"github.com/loft-sh/vcluster/pkg/snapshot"
"github.com/loft-sh/vcluster/pkg/snapshot/pod"
"github.com/loft-sh/vcluster/pkg/strvals"
"github.com/loft-sh/vcluster/pkg/telemetry"
"github.com/loft-sh/vcluster/pkg/upgrade"
Expand Down Expand Up @@ -142,6 +144,14 @@ func CreatePlatform(ctx context.Context, options *CreateOptions, globalFlags *fl
}
log.Donef("Successfully created the virtual cluster %s in project %s", virtualClusterName, options.Project)

if options.Restore != "" {
log.Infof("Restore vCluster %s...", virtualClusterName)
err = Restore(ctx, []string{virtualClusterName, options.Restore}, globalFlags, &snapshot.Options{}, &pod.Options{}, false, false, log)
if err != nil {
return fmt.Errorf("restore vCluster %s: %w", virtualClusterName, err)
}
}

// check if we should connect to the vcluster or print the kubeconfig
if options.Connect || options.Print {
return ConnectPlatform(ctx, &ConnectOptions{
Expand Down