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.
- kubectl
- curl
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
Retrieve a list of DevPodWorkspaceInstances​
Run the following curl command to list all DevPodWorkspaceInstances in project my-project:
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/loft-p-my-project/devpodworkspaceinstances" \
-X GET --insecure \
-H "Authorization: Bearer $ACCESS_KEY"
Get a single DevPodWorkspaceInstance by name​
Run the following curl command to get DevPodWorkspaceInstance my-devpod-workspace in project my-project:
# Exchange my-devpod-workspace in the url below with the name of the DevPodWorkspaceInstance
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/loft-p-my-project/devpodworkspaceinstances/my-devpod-workspace" \
-X GET --insecure \
-H "Authorization: Bearer $ACCESS_KEY"
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.
- kubectl
- curl
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
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: {}
Run the following curl command to create a new DevPodWorkspaceInstance my-devpod-workspace in project my-project:
curl -s -X POST --insecure \
"https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/loft-p-my-project/devpodworkspaceinstances" \
--data-binary "$(cat object.yaml)" \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY"
Update: DevPodWorkspaceInstance​
You can either use curl or kubectl to update DevPodWorkspaceInstances.
- kubectl
- curl
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"}]'
Update DevPodWorkspaceInstance​
First retrieve the current object into a file object.yaml. This could look like:
apiVersion: management.loft.sh/v1
kind: DevPodWorkspaceInstance
metadata:
creationTimestamp: "2023-04-03T00:00:00Z"
generation: 12
name: my-devpod-workspace
namespace: loft-p-my-project
resourceVersion: "66325905"
uid: af5f9f0f-8ab9-4b4b-a595-a95a5921f3c2
spec:
displayName: my-display-name
owner:
user: my-user
parameters: 'my-parameter: my-value'
runnerRef: {}
target: {}
templateRef:
name: my-devpod-workspace-template
status:
resolvedTarget: {}
Run the following curl command to update a single DevPodWorkspaceInstance my-devpod-workspace in project my-project:
# Replace the my-devpod-workspace in the url below with the name of the DevPodWorkspaceInstance you want to update
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/loft-p-my-project/devpodworkspaceinstances/my-devpod-workspace" \
-X PUT --insecure \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY" \
--data-binary "$(cat object.yaml)"
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 curl command to add a new annotation my-annotation: my-value to the DevPodWorkspaceInstance my-devpod-workspace in project my-project via a patch:
# Replace the my-devpod-workspace in the url below with the name of the DevPodWorkspaceInstance you want to update
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/loft-p-my-project/devpodworkspaceinstances/my-devpod-workspace" \
-X PATCH --insecure \
-H "Content-Type: application/json-patch+json" \
-H "Authorization: Bearer $ACCESS_KEY" \
--data '[{"op": "add", "path": "/metadata/annotations/my-annotation", "value": "my-value"}]'
Delete: DevPodWorkspaceInstance​
You can either use curl or kubectl to delete DevPodWorkspaceInstances.
- kubectl
- curl
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
Run the following curl command to delete DevPodWorkspaceInstance my-devpod-workspace in project my-project:
# Replace the my-devpod-workspace in the url below with the name of the DevPodWorkspaceInstance you want to delete
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/namespaces/loft-p-my-project/devpodworkspaceinstances/my-devpod-workspace" \
-X DELETE --insecure \
-H "Authorization: Bearer $ACCESS_KEY"