Templates¶
A WorkspaceTemplate provides an easy way to configure a workspace and to enforce constraints on its attributes.
Workspace templates have a 1:many relationship with workspaces; multiple workspaces may reference the same template, but a workspace can reference at most one template.
Usage¶
A workspace user can create a workspace referencing a template as follow:
apiVersion: workspace.jupyter.org/v1alpha1
kind: Workspace
metadata:
name: alice-workspace
namespace: alice-team
spec:
displayName: Alice's Workspace
templateRef:
name: template-for-alice-team
In this case, the template configures default settings for the workspace, for example its spec.image or spec.accessType.
The workspace user does not need to worry about all these details.
Templates are namespaced resources, and a workspace.spec.templateRef may only reference a template in its own namespace.
There is an exception to this rule: Jupyter K8s allows workspaces of any namespace to reference templates in the shared namespace - a special namespace identified at the Jupyter K8s operator level.
Setup¶
There are two primary use cases for templates:
cluster or team administrators to provide trusted configurations to workspace users
expert workspace users who want to reuse their favorite workspace configurations
A user with the right RBAC permission can create a template as follows:
apiVersion: workspace.jupyter.org/v1alpha1
kind: WorkspaceTemplate
metadata:
name: template-for-team-alice
namespace: team-alice
spec:
displayName: Team Alice Template
defaultImage: my-repository/my-image:my-tag
A template may reference an access strategy as well:
apiVersion: workspace.jupyter.org/v1alpha1
kind: WorkspaceTemplate
metadata:
name: template-for-team-alice
namespace: team-alice
spec:
displayName: Team Alice Template
defaultImage: my-repository/my-image:my-tag
defaultAccessStrategy:
name: web-access
In this case, any workspace that references this template will inherit the access strategy.