Skip to main content
Version: v4.4

DevPod Workspace Template

A DevPod workspace template.

DevPodWorkspaceTemplate example​

An example DevPodWorkspaceTemplate:

apiVersion: management.loft.sh/v1
kind: DevPodWorkspaceTemplate
metadata:
creationTimestamp: null
name: my-devpod-workspace-template
spec:
displayName: my-display-name
parameters:
- variable: myVar
template:
instanceTemplate:
metadata: {}
provider:
name: kubernetes
options:
KUBERNETES_NAMESPACE:
value: '{{ .Values.loft.name }}'
status: {}

Retrieve: DevPodWorkspaceTemplates​

You can either use curl or kubectl to retrieve DevPodWorkspaceTemplates.

Retrieve a list of DevPodWorkspaceTemplates​

Run the following command to list all DevPodWorkspaceTemplates:

kubectl get devpodworkspacetemplates.management.loft.sh  -o yaml

Retrieve a single DevPodWorkspaceTemplate by name​

Run the following kubectl command to get DevPodWorkspaceTemplate my-devpod-workspace-template:

kubectl get devpodworkspacetemplates.management.loft.sh my-devpod-workspace-template  -o yaml

Create: DevPodWorkspaceTemplate​

You can either use curl or kubectl to create a new DevPodWorkspaceTemplate.

Create a file object.yaml with the following contents:

apiVersion: management.loft.sh/v1
kind: DevPodWorkspaceTemplate
metadata:
creationTimestamp: null
name: my-devpod-workspace-template
spec:
displayName: my-display-name
parameters:
- variable: myVar
template:
instanceTemplate:
metadata: {}
provider:
name: kubernetes
options:
KUBERNETES_NAMESPACE:
value: '{{ .Values.loft.name }}'
status: {}

Then create the DevPodWorkspaceTemplate my-devpod-workspace-template with:

kubectl create -f object.yaml 

Update: DevPodWorkspaceTemplate​

You can either use curl or kubectl to update DevPodWorkspaceTemplates.

Update DevPodWorkspaceTemplate​

Run the following command to update DevPodWorkspaceTemplate my-devpod-workspace-template:

kubectl edit devpodworkspacetemplates.management.loft.sh my-devpod-workspace-template 

Then edit the object and upon save, kubectl will update the resource.

Patch DevPodWorkspaceTemplate​

Patching a resource is useful if you want to generically exchange only a small portion of the object instead of retrieving the whole object first and then modifying it. To learn more about patches in Kubernetes, please take a look at the official docs.

Run the following kubectl command to add a new annotation my-annotation: my-value to the DevPodWorkspaceTemplate my-devpod-workspace-template via a patch:

kubectl patch devpodworkspacetemplates.management.loft.sh my-devpod-workspace-template  \
--type json \
-p '[{"op": "add", "path": "/metadata/annotations/my-annotation", "value": "my-value"}]'

Delete: DevPodWorkspaceTemplate​

You can either use curl or kubectl to delete DevPodWorkspaceTemplates.

Run the following command to delete DevPodWorkspaceTemplate my-devpod-workspace-template:

kubectl delete devpodworkspacetemplates.management.loft.sh my-devpod-workspace-template