Skip to main content
Version: 3.0 (beta)

Spaces

Spaces are virtual resources that represent regular Kubernetes namespaces. Typically, non-admin users to not have the permission to list, create or delete namespaces in a shared Kubernetes clusters. That's why Loft adds the space resource to Kubernetes. Spaces are not stored in etcd but rather abstract from regular namespaces. Deleting a space will effectively delete the underlying namespace, for example. In turn, any labels and annotations set on a namespace will show up on the corresponding space as well.

Working with Spaces

Space and namespaces are directly coupled via a 1:1 relationship. But unlike with namespaces, it is safe to give non-admin users the permission to create and manage their own spaces.

Create Spaces

To create a space using Loft CLI, run:

loft create space [space-name]
Kube-Context

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.

Delete Spaces
loft delete space [space-name]
Kube-Context

Deleting spaces with Loft CLI has the advantage that Loft CLI will also delete the kube-context for this space from your local kube-config file to keep everything cleaned up.

List Spaces

To see a list of spaces, go to the Spaces view using the main menu on the left.

Spaces & Namespaces

If you are admin in one of the clusters connected to Loft, you will have permission to view all namespaces in the cluster. Since spaces and namespaces have a 1:1 relationship and Loft is often relying on regular Kubernetes RBAC, you will be able to see all namespaces in the Spaces view rather than just namespaces created via Loft.

Prevent Space Deletion

You can prevent space deletion, by setting the annotation loft.sh/non-deletable to true.

Configuration

Owner

JSONPath in CRD:
 spec.user (type: string)         # default: name of current user

Template

Metadata

Name

JSONPath in CRD:
 metadata.name (type: string)

Labels

JSONPath in CRD:
 metadata.labels (type: map[string]string)

Annotations

JSONPath in CRD:
 metadata.annotations (type: map[string]string)

Sleep Mode

Inactivity Timeout

JSONPath in CRD:
 metadata.annotations["sleepmode.loft.sh/sleep-after"] (type: string)

Auto-Delete Timeout

JSONPath in CRD:
 metadata.annotations["sleepmode.loft.sh/delete-after"] (type: string)

Sleep Schedule

JSONPath in CRD:
 metadata.annotations["sleepmode.loft.sh/sleep-schedule"] (type: string)

Wake-Up Schedule

JSONPath in CRD:
 metadata.annotations["sleepmode.loft.sh/wakeup-schedule"] (type: string)

Scheduling Timezone

JSONPath in CRD:
 metadata.annotations["sleepmode.loft.sh/timezone"] (type: string)

Apps

Access To Space

JSONPath in CRD:
 spec.access (type: Access[])

CRDs

Space

apiVersion
string

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

kind
string

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

object (io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta)

ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.

object (com.github.loft-sh.agentapi.pkg.apis.loft.cluster.v1.SpaceSpec)

SpaceSpec defines the desired state of Space

object (com.github.loft-sh.agentapi.pkg.apis.loft.cluster.v1.SpaceStatus)

SpaceStatus defines the observed state of Space

{
  • "apiVersion": "string",
  • "kind": "string",
  • "metadata": {
    },
  • "spec": {
    },
  • "status": {
    }
}