Skip to main content
Version: v4.4

DevPod Workspace Instance

A DevPod workspace.

DevPodWorkspaceInstance example​

An example DevPodWorkspaceInstance:

apiVersion: management.loft.sh/v1
kind: DevPodWorkspaceInstance
metadata:
creationTimestamp: null
name: my-devpod-workspace
namespace: loft-p-my-project
spec:
displayName: my-display-name
owner:
user: my-user
parameters: 'my-parameter: my-value'
runnerRef: {}
target: {}
templateRef:
name: my-devpod-workspace-template
status:
resolvedTarget: {}

Retrieve: DevPodWorkspaceInstances​

You can either use curl or kubectl to retrieve DevPodWorkspaceInstances.

Retrieve a list of DevPodWorkspaceInstances​

Run the following command to list all DevPodWorkspaceInstances in project my-project:

kubectl get devpodworkspaceinstances.management.loft.sh -n loft-p-my-project -o yaml

Retrieve a single DevPodWorkspaceInstance by name​

Run the following kubectl command to get DevPodWorkspaceInstance my-devpod-workspace in project my-project:

kubectl get devpodworkspaceinstances.management.loft.sh my-devpod-workspace -n loft-p-my-project -o yaml

Create: DevPodWorkspaceInstance​

You can either use curl or kubectl to create a new DevPodWorkspaceInstance. Make sure to set the project in the metadata.namespace field you want to create the DevPodWorkspaceInstance in. If your project has the id my-project, the corresponding namespace would be loft-p-my-project.

Create a file object.yaml with the following contents:

apiVersion: management.loft.sh/v1
kind: DevPodWorkspaceInstance
metadata:
creationTimestamp: null
name: my-devpod-workspace
namespace: loft-p-my-project
spec:
displayName: my-display-name
owner:
user: my-user
parameters: 'my-parameter: my-value'
runnerRef: {}
target: {}
templateRef:
name: my-devpod-workspace-template
status:
resolvedTarget: {}

Then create the DevPodWorkspaceInstance my-devpod-workspace in project my-project with:

kubectl create -f object.yaml -n loft-p-my-project

Update: DevPodWorkspaceInstance​

You can either use curl or kubectl to update DevPodWorkspaceInstances.

Update DevPodWorkspaceInstance​

Run the following command to update DevPodWorkspaceInstance my-devpod-workspace in project my-project:

kubectl edit devpodworkspaceinstances.management.loft.sh my-devpod-workspace -n loft-p-my-project

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

Patch DevPodWorkspaceInstance​

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 DevPodWorkspaceInstance my-devpod-workspace in project my-project via a patch:

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

Delete: DevPodWorkspaceInstance​

You can either use curl or kubectl to delete DevPodWorkspaceInstances.

Run the following command to delete DevPodWorkspaceInstance my-devpod-workspace in project my-project:

kubectl delete devpodworkspaceinstances.management.loft.sh my-devpod-workspace -n loft-p-my-project