Built-in Workload Profiles
On this page
Each Workload in the Platform Orchestrator has an associated Workload Profile. It is assigned when generating the
Deployment Set
or Deployment Delta that is passed in to the Platform Orchestrator when deploying the Workload, usually by using the
humctl
Humanitec CLI
. The
Overview
has more details about the process.
The Platform Orchestrator has three built-in Workload Profiles. They can cover the majority of use cases. If you need to go beyond what those Workload Profiles offer, consider creating a Custom Workload Profile .
Workload Profile | Description |
---|---|
default-cronjob | Generates a series of Kubernetes CronJobs . The Workload Profile allows multiple schedules to be defined in one workload. |
default-job | Generates a of Kubernetes Job that is run at deployment time. |
default-module | Generates a Kubernetes Deployment which will roll out a ReplicaSet . This is the most commonly used Workload Profile. It is used the the default if no other Workload Profile is specified. |
module
to refer to workload, but this is expected to change. When this happens, the version
property of the deployment set will be incremented to 1
. Old deployment sets will continue to function with module
.default-cronjob
This Workload Profile generates a series of Kubernetes CronJobs . The Workload Profile allows multiple schedules to be defined in one workload.
Features
Feature | Description |
---|---|
annotations | Specify Annotations that will be added to Pods generated for the workload. |
containers | Add one or more containers to the workload. |
labels | Specify Labels that will be added to Pods generated for the workload. |
service-account | Specify the Service Account pods should run under. |
schedules | Specify a series of schedules and container overrides for CronJobs . |
Example
The following
Score
File and
Score extension file
jointly define a single Workload using the Workload Profile humanitec/default-cronjob
.
The Workload contains one container, has an environment variable MY_ENV_VAR
set in it, has container resources defined, has an additional label prometheus-name
, runs under the Service Account my-service-account
, and has two Cron schedules defined, each executing a different command inside the container.
Score file | Score extension file |
---|---|
|
|
Using the
humctl
Humanitec CLI
to translate the Score file and extension file yields this Deployment Delta:
$ humctl score deploy --dry-run -f score.yaml --extensions humanitec.score.yaml --env development
{
"metadata": {
"env_id": "development",
"name": "Auto-deployment (SCORE)"
},
"modules": {
"add": {
"my-cronjob": {
"profile": "humanitec/default-cronjob",
"spec": {
"annotations": {
"humanitec.io/managed-by": "Score"
},
"containers": {
"my-container": {
"id": "my-container",
"image": "registry.humanitec.io/public/sample-service:1.2.0",
"resources": {
"limits": {
"cpu": "0.250",
"memory": "256Mi"
},
"requests": {
"cpu": "0.025",
"memory": "64Mi"
}
},
"variables": {
"MY_ENV_VAR": "Hello World!"
}
}
},
"labels": {
"prometheus-name": "my-cronjob"
},
"schedules": {
"6-hour-run": {
"containers": {
"my-container": {
"args": [
"--hours",
"6"
]
}
},
"schedule": "15 1,7,13,19 * * *"
},
"daily-run": {
"containers": {
"my-container": {
"command": [
"node",
"daily-cron.js"
]
}
},
"schedule": "0 23 * * *"
}
},
"serviceAccountName": "my-service-account"
}
}
}
}
}
default-job
This Workload Profile generates a of Kubernetes Job that is run at deployment time.
Features
Feature | Description |
---|---|
annotations | Specify Annotations that will be added to Pods generated for the workload. |
containers | Add one or more containers to the workload. |
labels | Specify Labels that will be added to Pods generated for the workload. |
service-account | Specify the Service Account pods should run under. |
Example
The following
Score
File and
Score extension file
jointly define a single Workload using the Workload Profile humanitec/default-job
.
The Workload contains one container, has an environment variable MY_ENV_VAR
set in it, has container resources defined, has an additional label prometheus-name
, and runs under the Service Account my-service-account
.
Score file | Score extension file |
---|---|
|
|
Using the
humctl
Humanitec CLI
to translate the Score file and extension file yields this Deployment Delta:
$ humctl score deploy --dry-run -f score.yaml --extensions humanitec.score.yaml --env development
{
"metadata": {
"env_id": "development",
"name": "Auto-deployment (SCORE)"
},
"modules": {
"add": {
"my-job": {
"profile": "humanitec/default-job",
"spec": {
"annotations": {
"humanitec.io/managed-by": "Score"
},
"containers": {
"my-container": {
"id": "my-container",
"image": "registry.humanitec.io/public/sample-service:1.2.0",
"resources": {
"limits": {
"cpu": "0.250",
"memory": "256Mi"
},
"requests": {
"cpu": "0.025",
"memory": "64Mi"
}
},
"variables": {
"MY_ENV_VAR": "Hello World!"
}
}
},
"labels": {
"prometheus-name": "my-job"
},
"serviceAccountName": "my-service-account"
}
}
}
}
}
default-module
This Workload Profile generates a Kubernetes Deployment which will roll out a ReplicaSet . It is therefore intended for stateless workloads. In practice this covers the vast majority of workloads used in Kubernetes.
Features
Feature | Description |
---|---|
annotations | Specify Annotations that will be added to Pods generated for the workload. |
containers | Add one or more containers to the workload. |
labels | Specify Labels that will be added to Pods generated for the workload. |
replicas | A runtime feature allowing the number of replicas to be set. |
service | Create a Service object to provide a stable way of addressing the workload within the cluster. |
service-account | Specify the Service Account pods should run under. |
Example
The following
Score
File and
Score extension file
jointly define a single Workload using the Workload Profile humanitec/default-module
.
The Workload contains one container, has an environment variable MY_ENV_VAR
set in it, has container resources defined, has an additional label prometheus-name
, runs under the Service Account my-service-account
, defines a Service on port 8080
, has liveness and readiness probes, and defines a route referencing a requested dns
resource.
The files do not need to request the Workload Profile default-module
as it is the default Workload Profile to use.
Score file | Score extension file |
---|---|
|
|
Using the
humctl
Humanitec CLI
to translate the Score file and extension file yields this Deployment Delta:
$ humctl score deploy --dry-run -f score.yaml --extensions humanitec.score.yaml --env development
{
"metadata": {
"env_id": "development",
"name": "Auto-deployment (SCORE)"
},
"modules": {
"add": {
"my-workload": {
"externals": {
"default-route": {
"class": "default",
"params": {
"host": "${externals.dns.host}",
"path": "/",
"port": 8080
},
"type": "route"
},
"dns": {
"class": "default",
"type": "dns"
}
},
"profile": "humanitec/default-module",
"spec": {
"annotations": {
"humanitec.io/managed-by": "Score"
},
"containers": {
"sample-service": {
"args": [
"--run",
"webserver"
],
"command": [
"node",
"index.js"
],
"id": "sample-service",
"image": "registry.humanitec.io/public/sample-service:1.2.0",
"liveness_probe": {
"path": "/alive",
"port": 8080,
"type": "http"
},
"readiness_probe": {
"path": "/ready",
"port": 8080,
"type": "http"
},
"resources": {
"limits": {
"cpu": "0.250",
"memory": "256Mi"
},
"requests": {
"cpu": "0.025",
"memory": "64Mi"
}
},
"variables": {
"MY_ENV_VAR": "Hello World!"
}
}
},
"labels": {
"prometheus-name": "sample-service"
},
"service": {
"ports": {
"www": {
"container_port": 8080,
"protocol": "TCP",
"service_port": 8080
}
}
},
"serviceAccountName": "my-service-account"
}
}
}
}
}