Skip to main content
Version: 1.15.0

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

ParameterParameter TypeDescriptionRequired
WorkspaceNameStringThe workspace under which the workload is deployed.Mandatory
nameStringThe unique name of the workload placement. This is used as the identifier.Mandatory
clustersarray[string]The list of cluster names where the workload is deployed.Mandatory
burstDurationStringThe time duration for temporary scaling or burst activity (for example, 15m).Mandatory
deletionPolicyStringThis defines what happens on delete (Delete or Retain).Mandatory
helmConfigsarray[object]The list of Helm deployments included in the workload.Mandatory
manifestResourcesarray[object]The list of Kubernetes manifests to apply (for example, ConfigMaps and Deployments).Mandatory
cmdExecarray[object]The list of shell/command executions to run (for example, kubectl commands).Mandatory
stepsarray[object]The ordered execution steps defining workload sequence (command, helm, manifest, etc.).Mandatory
ServiceAccountStringThe service account used for workload operations.Mandatory

Helm Configuration Parameters

ParameterParameter TypeDescriptionRequired
chartStringThe Helm chart identifier (repo/chart-name).Mandatory
releaseNameStringThe Helm release name.Mandatory
releaseNamespaceStringThe target namespace for Helm release.Mandatory
repoNameStringThe Helm repository name.Mandatory
repoURLStringThe URL to the Helm chart repository.Mandatory
versionNumericThe version of the Helm chart to deploy.Mandatory
helmFlagsObjectThe Helm deployment flags to control specific behaviors.Optional
SecretRefStringThe secret reference for Helm repository authentication.Optional
valuesObjectThe key-value map of Helm chart values.Optional
Helm Flag Parameters
ParameterParameter TypeDescriptionRequired
atomicBooleanIf enabled, deletes the installation on failure, rolling back changes.Optional
cleanupOnFailBooleanIf enabled, deletes new resources created in this release when it fails.Optional
createNamespaceBooleanIf enabled, automatically creates the Kubernetes Namespace if it does not already exist.Optional
skipCRDsBooleanIf enabled, skips installing Custom Resource Definitions.Optional
waitBooleanIf 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
timeoutStringThe duration to wait for Kubernetes operation (for example, 0h10m0s for 10 minutes).Optional
SecretRef Parameters
ParameterParameter TypeDescriptionRequired
nameStringThe name of the Kubernetes secret.Mandatory
Values Parameters
ParameterParameter TypeDescriptionRequired
replicaCountThis is the number of replicas to deploy.NumericOptional

Manifest Resources Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe logical name for the manifest.
namespaceStringThe namespace where the manifest applies.
apiVersionStringThe API version of the Kubernetes resource (for example, v1).
kindStringThe Kubernetes resource kind (for example, ConfigMap and Deployment).
dataObjectThe resource content or data fields.

Command Execution Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe name or label for the command step.Mandatory
cmdStringThe command line to execute (for example, kubectl get pods -n bookinfo).Mandatory

Steps Configuration Parameters

ParameterParameter TypeDescriptionRequired
nameStringThe step name referencing a Helm config, manifest, or command.Mandatory
typeStringThe 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"
}}