Skip to main content

Import Virtual Cluster

This API can be used to import an existing vcluster from a connected cluster into the project.

Example Import Virtual Cluster

An example Import Virtual Cluster:

apiVersion: management.loft.sh/v1
kind: ProjectImportVirtualCluster
metadata:
creationTimestamp: null
sourceVirtualCluster:
cluster: my-connected-cluster
importName: my-name-in-project
name: my-virtual-cluster-name
namespace: my-virtual-cluster-namespace

Import Virtual Cluster Reference

sourceVirtualCluster required object pro

SourceVirtualCluster is the virtual cluster to import into this project

name required string pro

Name of the virtual cluster to import

namespace required string pro

Namespace of the virtual cluster to import

cluster required string pro

Cluster name of the cluster the virtual cluster is running on

owner required object pro

Owner of the virtual cluster to import

user required string pro

User specifies a Loft user.

team required string pro

Team specifies a Loft team.

importName required string pro

ImportName is an optional name to use as the virtualclusterinstance name, if not provided the vcluster name will be used

upgradeToPro required boolean false pro

UpgradeToPro indicates whether we should upgrade to Pro on import

skipHelmDeploy required boolean false pro

SkipHelmDeploy will skip management of the vClusters helm deployment

Import Virtual Cluster (Create)

Import a virtual cluster through this API.

Create a file object.yaml with the following contents:

apiVersion: management.loft.sh/v1
kind: ProjectImportVirtualCluster
metadata:
creationTimestamp: null
sourceVirtualCluster:
cluster: my-connected-cluster
importName: my-name-in-project
name: my-virtual-cluster-name
namespace: my-virtual-cluster-namespace

Then run the following curl command:

# Exchange my-object in the url below with the name of the Import Virtual Cluster
curl -s -X POST --insecure \
"https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/projects/my-object/importvirtualcluster" \
--data-binary "$(cat object.yaml)" \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY"