Skip to main content

Import Namespace

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

Import Namespace example

An example Import Namespace:

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

Import Namespace reference

sourceSpace required object

SourceSpace is the space to import into this project

name required string

Name of the space to import

cluster required string

Cluster name of the cluster the space is running on

importName required string

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

Import Namespace (Create)

Import a namespace through this API.

Create a file object.yaml with the following contents:

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

Then run the following curl command:

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