Workload Template
This topic describes the steps to create a Workload Template in a workspace. You can use the Workload Template as a pre configuration in a Workload Placement.
Create a Workload Template
Use this API to create a Workload Template in a workspace.
Method and URL
POST /api/v1/workload-template
Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| WorkspaceName | String | The workspace under which the workload is deployed. | Mandatory |
| name | String | The unique name of the workload placement. This is used as the identifier. | Mandatory |
| clusters | array[string] | The list of cluster names where the workload is deployed. | Mandatory |
| burstDuration | String | The time duration for temporary scaling or burst activity (for example, 15m). | Mandatory |
| deletionPolicy | String | This defines what happens on delete (Delete or Retain). | Mandatory |
| helmConfigs | array[object] | The list of Helm deployments included in the workload. | Mandatory |
| manifestResources | array[object] | The list of Kubernetes manifests to apply (for example, ConfigMaps and Deployments). | Mandatory |
| cmdExec | array[object] | The list of shell/command executions to run (for example, kubectl commands). | Mandatory |
| steps | array[object] | The ordered execution steps defining workload sequence (command, helm, manifest, etc.). | Mandatory |
| ServiceAccount | String | The service account used for workload operations. | Mandatory |
Helm Configuration Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| chart | String | The Helm chart identifier (repo/chart-name). | Mandatory |
| releaseName | String | The Helm release name. | Mandatory |
| releaseNamespace | String | The target namespace for Helm release. | Mandatory |
| repoName | String | The Helm repository name. | Mandatory |
| repoURL | String | The URL to the Helm chart repository. | Mandatory |
| version | Numeric | The version of the Helm chart to deploy. | Mandatory |
| helmFlags | Object | The Helm deployment flags to control specific behaviors. | Optional |
| SecretRef | String | The secret reference for Helm repository authentication. | Optional |
| values | Object | The key-value map of Helm chart values. | Optional |
Helm Flag Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| atomic | Boolean | If enabled, deletes the installation on failure, rolling back changes. | Optional |
| cleanupOnFail | Boolean | If enabled, deletes new resources created in this release when it fails. | Optional |
| createNamespace | Boolean | If enabled, automatically creates the Kubernetes Namespace if it does not already exist. | Optional |
| skipCRDs | Boolean | If enabled, skips installing Custom Resource Definitions. | Optional |
| wait | Boolean | If enabled, waits until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. | Optional |
| timeout | String | The duration to wait for Kubernetes operation (for example, 0h10m0s for 10 minutes). | Optional |
SecretRef Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| name | String | The name of the Kubernetes secret. | Mandatory |
Values Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| replicaCount | This is the number of replicas to deploy. | Numeric | Optional |
Manifest Resources Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| name | String | The logical name for the manifest. | |
| namespace | String | The namespace where the manifest applies. | |
| apiVersion | String | The API version of the Kubernetes resource (for example, v1). | |
| kind | String | The Kubernetes resource kind (for example, ConfigMap and Deployment). | |
| data | Object | The resource content or data fields. |
Command Execution Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| name | String | The name or label for the command step. | Mandatory |
| cmd | String | The command line to execute (for example, kubectl get pods -n bookinfo). | Mandatory |
Steps Configuration Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| name | String | The step name referencing a Helm config, manifest, or command. | Mandatory |
| type | String | The step type for deployment. The values are helm, manifest, or command. | Mandatory |
Example Request
curl -X POST --location --globoff --request 'https://{{host}}/api/v1/workload-template' \
{
"name": "sample-workload-template",
"burstDuration": "15m",
"deletionPolicy": "Delete",
"clusterNames": [
"worker-2",
"worker-1"
],
"autoPlacement": false,
"enableBurst": false,
"helmConfigs": [
{
"name": "cuda",
"chart": "vaidio/cuda",
"releaseName": "cuda",
"releaseNamespace": "bookinfo",
"repoName": "vaidio",
"repoURL": "https://smartscaler.nexus.aveshalabs.io/repository/vaidio/",
"version": "18.2.3",
"helmFlags": {
"createNamespace": true,
"wait": true,
"atomic": true,
"skipCRDs": false,
"cleanupOnFail": true,
"timeout": "10m"
},
"secretRef": {
"name": "nginx-secret"
},
"values": {
"replicaCount": 2
}
}
],
"manifestResources": [
{
"name": "sample-configmap",
"manifest": {
"apiVersion": "v1",
"kind": "ConfigMap",
"metadata": {
"namespace": "bookinfo",
"name": "sample-configmap"
},
"data": {
"database.properties": "host=localhost\nport=5432\ndatabase=myapp",
"ui.properties": "color=purple\ntheme=dark\nlanguage=en"
}
}
}
],
"cmdExec": [
{
"name": "create-namespace",
"cmd": "kubectl get pods -n bookinfo"
}
],
"steps": [
{
"name": "create-namespace",
"type": "command"
},
{
"name": "cuda",
"type": "helm"
},
{
"name": "sample-configmap",
"type": "manifest"
}
],
"serviceAccount": "sa-name"
}
Example Responses
Response: Success
{
"statusCode":200,
"status":"OK",
"message":"Success",
"data":{
"name":"sample-workload-template"
}
}
Response: Error
{
"statusCode":422,
"status":"UPSTREAM_REQUEST_ERROR",
"message":"Error while creating a Workload Template",
"data":null,
"error":{
"errorKey":"UPSTREAM_REQUEST_ERROR",
"message":"Error while creating a Workload Template",
"data":"Error: \"deletionPolicy\" is required; Refer Documentation: https://docs.avesha.io/documentation/enterprise-egs"
}
}
Get a Workload Template
Use this API to get a specific Workload Template by name.
Method and URL
GET /api/v1/workload-template/{name}
Example Request
curl -X GET --location --globoff --request 'https://{{host}}/api/v1/workload-template/sample-workload-template' \
Example Responses
Response: Success
{
"statusCode":200,
"status":"OK",
"message":"Success",
"data":{
"autoPlacement":true,
"burstDuration":"15m",
"clusterNames":["worker-2","worker-1"],
"cmdExec":[{
"cmd":"kubectl get pods -n bookinfo",
"name":"create-namespace"}],
"createdAt":"2025-12-02T17:29:47Z",
"deletionPolicy":"Delete",
"enableBurst":true,
"helmConfigs":[{
"chart":"vaidio/cuda",
"helmFlags":{
"atomic":true,"cleanupOnFail":true,"createNamespace":true,"skipCRDs":false,"timeout":"0h10m0s","wait":true
},
"name":"cuda","
releaseName":"cuda",
"releaseNamespace":"bookinfo",
"repoName":"vaidio",
"repoURL":"https://smartscaler.nexus.aveshalabs.io/repository/vaidio/",
"secretRef":{"name":"nginx-secret"},
"values":{"replicaCount":2},
"version":"18.2.3"}],
"manifestResources":[{
"manifest":{"apiVersion":"v1","data":{"database.properties":"host=localhost\nport=5432\ndatabase=myapp","ui.properties":"color=purple\ntheme=dark\nlanguage=en"},
"kind":"ConfigMap",
"metadata":{"name":"sample-configmap","namespace":"bookinfo"}},
"name":"sample-configmap"}],
"name":"sample-workload-template",
"serviceAccount":"sa-name",
"status":{"workloadSelector":{"name":"cuda","namespace":"bookinfo"}},
"steps":[{"name":"create-namespace","type":"command"},
{"name":"cuda","type":"helm"},
{"name":"sample-configmap","type":"manifest"}],
"updatedAt":"2025-12-02T17:29:47Z"}}
Response: Error
{
"statusCode":404,
"status":"UPSTREAM_REQUEST_ERROR",
"message":"Error while fetching Workload Template",
"data":null,
"error":{
"errorKey":"UPSTREAM_REQUEST_ERROR",
"message":"Error while fetching Workload Template",
"data":"Error: workloadtemplates.gpr.kubeslice.io \"sample-workload-templates\" not found; Reason: NotFound; Refer Documentation: https://docs.avesha.io/documentation/enterprise-egs"
}
}
List a Workload Template
Use this API to list all Workload Templates in a workspace.
Method and URL
GET /api/v1/workload-template
Example Request
curl -X GET --location --globoff --request 'https://{{host}}/api/v1/workload-template' \
Example Responses
Response: Success
{
"statusCode":200,
"status":"OK",
"message":"Success",
"data":[{
"autoPlacement":true,
"burstDuration":"20m",
"clusterNames":["worker-2","worker-1"],
"cmdExec":[{"cmd":"kubectl get pods -n bookinfo","name":"create-namespace"}],
"createdAt":"2025-12-02T17:29:47Z",
"deletionPolicy":"Retain",
"enableBurst":true,
"helmConfigs":[{"chart":"vaidio/cuda","helmFlags":{"atomic":true,"cleanupOnFail":true,"createNamespace":true,"skipCRDs":false,"timeout":"0h10m0s","wait":true},
"name":"cuda",
"releaseName":"cuda",
"releaseNamespace":"bookinfo",
"repoName":"vaidio",
"repoURL":"https://smartscaler.nexus.aveshalabs.io/repository/vaidio/",
"secretRef":{"name":"nginx-secret"},
"values":{"replicaCount":2},
"version":"18.2.3"}],
"manifestResources":[{"manifest":{"apiVersion":"v1","data":{"database.properties":"host=localhost\nport=5432\ndatabase=myapp","ui.properties":"color=purple\ntheme=dark\nlanguage=en"},
"kind":"ConfigMap",
"metadata":{"name":"sample-configmap","namespace":"bookinfo"}},
"name":"sample-configmap"}],
"name":"sample-workload-template",
"serviceAccount":"sa-names",
"status":{"workloadSelector":{"name":"cuda","namespace":"bookinfo"}},
"steps":[{"name":"create-namespace","type":"command"},{"name":"cuda","type":"helm"},{"name":"sample-configmap","type":"manifest"}],
"updatedAt":"2025-12-02T17:29:47Z"}]}
Edit a Workload Template
Use this API to update a Workload Template.
Method and URL
PUT /api/v1/workload-template/{name}
Example Request
curl -X PUT --location --globoff --request 'https://{{host}}/api/v1/workload-template/sample-workload-template' \
Example Response
Response: Success
{
"statusCode":200,
"status":"OK",
"message":"Success",
"data":{
"name":"sample-workload-template"
}}
Response: Error
{
"statusCode":404,
"status":"UPSTREAM_REQUEST_ERROR",
"message":"Error while updating a Workload Template",
"data":null,"error":{
"errorKey":"UPSTREAM_REQUEST_ERROR",
"message":"Error while updating a Workload Template",
"data":"Error: workloadtemplates.gpr.kubeslice.io \"sample-workload-templates\" not found; Reason: NotFound; Refer Documentation: https://docs.avesha.io/documentation/enterprise-egs"
}}
Delete a Workload Template
Use this API to delete a Workload Template by name.
Method and URL
DELETE /api/v1/workload-template/{name}
Parameters
Example Request
curl -X DELETE --location --globoff --request 'https://{{host}}/api/v1/workload-template/sample-workload-template' \
Example Responses
Response: Success
{
"statusCode":200,
"status":"OK",
"message":"Success",
"data":{}
}
Response: Error
{
"statusCode":404,
"status":"UPSTREAM_REQUEST_ERROR",
"message":"Error while deleting Workload Template",
"data":null,
"error":{
"errorKey":"UPSTREAM_REQUEST_ERROR",
"message":"Error while deleting Workload Template",
"data":"Error: workloadtemplates.gpr.kubeslice.io \"sample-workload-template\" not found; Reason: NotFound; Refer Documentation: https://docs.avesha.io/documentation/enterprise-egs"
}}