DevPod Workspace Template
A DevPod workspace template.
Example DevPodWorkspaceTemplate
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:
provider:
name: kubernetes
options:
KUBERNETES_NAMESPACE:
value: '{{ .Values.loft.name }}'
status: {}
DevPodWorkspaceTemplate Reference
kind
required 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
kind
required string apiVersion
required 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
apiVersion
required string metadata
required object
metadata
required object spec
required object
spec
required object status
required object
status
required object Retrieve: DevPodWorkspaceTemplates
You can either use curl or kubectl to retrieve DevPodWorkspaceTemplates.
- kubectl
- curl
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
Retrieve a list of DevPodWorkspaceTemplates
Run the following curl command to list all DevPodWorkspaceTemplates:
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/devpodworkspacetemplates" \
-X GET --insecure \
-H "Authorization: Bearer $ACCESS_KEY"
Get a single DevPodWorkspaceTemplate by name
Run the following curl command to get DevPodWorkspaceTemplate my-devpod-workspace-template
:
# Exchange my-devpod-workspace-template in the url below with the name of the DevPodWorkspaceTemplate
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/devpodworkspacetemplates/my-devpod-workspace-template" \
-X GET --insecure \
-H "Authorization: Bearer $ACCESS_KEY"
Create: DevPodWorkspaceTemplate
You can either use curl or kubectl to create a new DevPodWorkspaceTemplate.
- kubectl
- curl
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:
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
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:
provider:
name: kubernetes
options:
KUBERNETES_NAMESPACE:
value: '{{ .Values.loft.name }}'
status: {}
Run the following curl command to create a new DevPodWorkspaceTemplate my-devpod-workspace-template
:
curl -s -X POST --insecure \
"https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/devpodworkspacetemplates" \
--data-binary "$(cat object.yaml)" \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY"
Update: DevPodWorkspaceTemplate
You can either use curl or kubectl to update DevPodWorkspaceTemplates.
- kubectl
- curl
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"}]'
Update DevPodWorkspaceTemplate
First retrieve the current object into a file object.yaml
. This could look like:
apiVersion: management.loft.sh/v1
kind: DevPodWorkspaceTemplate
metadata:
creationTimestamp: "2023-04-03T00:00:00Z"
generation: 12
name: my-devpod-workspace-template
resourceVersion: "66325905"
uid: af5f9f0f-8ab9-4b4b-a595-a95a5921f3c2
spec:
displayName: my-display-name
parameters:
- variable: myVar
template:
provider:
name: kubernetes
options:
KUBERNETES_NAMESPACE:
value: '{{ .Values.loft.name }}'
status: {}
Run the following curl command to update a single DevPodWorkspaceTemplate my-devpod-workspace-template
:
# Replace the my-devpod-workspace-template in the url below with the name of the DevPodWorkspaceTemplate you want to update
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/devpodworkspacetemplates/my-devpod-workspace-template" \
-X PUT --insecure \
-H "Content-Type: application/yaml" \
-H "Authorization: Bearer $ACCESS_KEY" \
--data-binary "$(cat object.yaml)"
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 curl command to add a new annotation my-annotation: my-value
to the DevPodWorkspaceTemplate my-devpod-workspace-template
via a patch:
# Replace the my-devpod-workspace-template in the url below with the name of the DevPodWorkspaceTemplate you want to update
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/devpodworkspacetemplates/my-devpod-workspace-template" \
-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: DevPodWorkspaceTemplate
You can either use curl or kubectl to delete DevPodWorkspaceTemplates.
- kubectl
- curl
Run the following command to delete DevPodWorkspaceTemplate my-devpod-workspace-template
:
kubectl delete devpodworkspacetemplates.management.loft.sh my-devpod-workspace-template
Run the following curl command to delete DevPodWorkspaceTemplate my-devpod-workspace-template
:
# Replace the my-devpod-workspace-template in the url below with the name of the DevPodWorkspaceTemplate you want to delete
curl -s "https://$LOFT_DOMAIN/kubernetes/management/apis/management.loft.sh/v1/devpodworkspacetemplates/my-devpod-workspace-template" \
-X DELETE --insecure \
-H "Authorization: Bearer $ACCESS_KEY"