Skip to content

Check Cluster Capacity

POST
/clusters/{cluster_id}/capacity-check
curl --request POST \
--url https://api.mengi.cloud/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/capacity-check \
--header 'Content-Type: application/json' \
--data '{ "kind": "deployment", "cpu_request": 0.5, "memory_request_mb": 512, "replicas": 1, "deployment_type": "docker", "engine": "example", "tier": "single", "exclude_deployment_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "exclude_database_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'

Tell, before creating or resizing a workload, whether it fits on a shared cluster.

Shared clusters cap the CPU and memory requests of everything in the tenant; a pod over the cap is rejected at admission and ends up as a failed deployment or database. This answers the same question up front from the tenant’s live quota. For dedicated clusters and clusters that are not running yet applies is false.

cluster_id
required
Cluster Id
string format: uuid
Media typeapplication/json
CapacityCheckRequest

Describe the workload the user is about to create or resize.

object
kind
required
Kind
string
Allowed values: deployment database
cpu_request
Cpu Request
number
default: 0.5 > 0
memory_request_mb
Memory Request Mb
integer
default: 512 > 0
replicas
Replicas
integer
default: 1
deployment_type
Deployment Type
string
default: docker
engine
Any of:
string
tier
Any of:
string
exclude_deployment_id
Any of:
string format: uuid
exclude_database_id
Any of:
string format: uuid

Successful Response

Media typeapplication/json
CapacityCheckResponse

applies is false when the cluster has no quota to check against (not shared, not running, or the host could not be read); fits is then true and the amounts are zero.

object
applies
required
Applies
boolean
fits
required
Fits
boolean
required
required
ResourceAmountResponse
object
cpu_millicores
required
Cpu Millicores
integer
memory_mb
required
Memory Mb
integer
free
required
ResourceAmountResponse
object
cpu_millicores
required
Cpu Millicores
integer
memory_mb
required
Memory Mb
integer
quota
required
ResourceAmountResponse
object
cpu_millicores
required
Cpu Millicores
integer
memory_mb
required
Memory Mb
integer
used
required
ResourceAmountResponse
object
cpu_millicores
required
Cpu Millicores
integer
memory_mb
required
Memory Mb
integer
message
Any of:
string
Examplegenerated
{
"applies": true,
"fits": true,
"required": {
"cpu_millicores": 1,
"memory_mb": 1
},
"free": {
"cpu_millicores": 1,
"memory_mb": 1
},
"quota": {
"cpu_millicores": 1,
"memory_mb": 1
},
"used": {
"cpu_millicores": 1,
"memory_mb": 1
},
"message": "example"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}