Create
Each space that is created in Loft belongs to a project. There are two ways how spaces can be created inside Loft:
- For regular project users: spaces can only be created by template that are allowed on project level.
- For project admins: spaces can be created without template.
Create From Template
Project members can create a new space through the Loft UI or CLI:
- UI
- CLI
- Go to the Projects view using the menu on the left
- Click on Spaces and the button
- In the popup select the space template and click the button
- Optional: Select a cluster where to create the space in. If no cluster is specified, Loft will automatically select one for you.
- Specify a name of the space at the top and optionally configure the template parameters and space access.
- Click on the button
Retrieve a kube-context for this space using Loft CLI:
loft use space [space-name] --project my-project
The Kubernetes namespace in the underlying cluster this space points to usually has a different name than the space inside the project to avoid conflicts, you can adjust the space name pattern within a project.
To create a space using Loft CLI, run:
loft create space [space-name] --project my-project
If you omit specifying a template, Loft will automatically select one for you (if there is a default template in the project specified) or prompt you to select a template.
Running loft create space
will automatically add a kube-context to your kube-config file, so you can immediately run kubectl
commands right after creating a space.
Regardless of how you create a space from a template, either by the UI or the CLI, Loft
allows you to provide a template version string. If you do not provide this string, the latest
version will be automatically selected for you. If you do provide the string though, you can
do something very neat -- you can set any of the MAJOR, MINOR, PATCH version components to an
X
wildcard character. This allows the space to be automatically updated to a more recent
template version that matches your provided template string.
For example, given a template with a version of 1.0.0, and a space created from this template with a version string "1.X.X". Adding a new template version "1.1.0", will cause this space to be automatically updated. Whereas adding a new version "2.0.0", will not cause the space to be upgraded.
This is a very handy way to keep spaces up to date with the latest templates without having to manually upgrade them!
Note that you can even set the version to "X.X.X" to always have your space updated to the latest template version!
Create Without Template
Only Project admins can create a virtual cluster without a template:
- Go to the Projects view using the menu on the left
- Click on Spaces and the button
- In the popup make sure the space template field is empty and click the button
- Optional: Select a cluster where to create the space in. If no cluster is specified, Loft will automatically select one for you.
- Specify a name of the space at the top and optionally configure the space you want to create.
- Click on the button
Retrieve a kube-context for this space using Loft CLI:
loft use space [space-name] --project my-project