Profiles
Each workload in Humanitec has an associated Workload Profile. This is defined in a Deployment Set via the profiles
property in the module
object. The parameters for the deployment set are specified via the spec
property. The content of the spec
property depends on the features that a particular Workload Profile supports.
module
to refer to workload, but 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
.Example
The following deployment set defines a single workload with the profile: humanitec/default-profile
. The workload contains 1 container and has an environment variable of MY_ENV_VAR
set in it.
{
"modules": {
"my-workload": {
"externals": {},
"profile": "humanitec/default-module",
"spec": {
"containers": {
"my-container": {
"id": "sample-service",
"image": "registry.humanitec.io/public/sample-service:1.2.0",
"variables": {
"MY_ENV_VAR": "Hello World!"
}
}
}
}
}
},
"shared": {}
}
Features
Feature | 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. |
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 forCronJobs. |
Example
{
"containers": {
"my-container": {
"id": "sample-service",
"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": {
"daily-run": {
"schedule": "0 23 * * *",
"containers": {
"main-container": {
"command": [
"node",
"daily-cron.js"
]
}
}
},
"6-hour-run": {
"schedule": "15 1,7,13,19 * * *",
"containers": {
"main-container": {
"args": [
"--hours",
"6"
]
}
}
}
},
"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
{
"containers": {
"my-container": {
"id": "sample-service",
"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. |
ingress | Create Ingress objects to make the workload accessible from outside the cluster via a DNS name. |
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
{
"labels": {
"prometheus-name": "my-workload"
},
"containers": {
"my-container": {
"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!"
}
}
},
"ingress": {
"rules": {
"externals.dns": {
"http": {
"*": {
"port": 8080,
"type": "default"
}
}
}
}
},
"service": {
"ports": {
"www": {
"service_port": 8080
}
}
},
"serviceAccountName": "my-service-account"
}