Check Cluster Capacity
POST
/clusters/{cluster_id}/capacity-check
const url = 'https://api.mengi.cloud/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/capacity-check';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"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"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”cluster_id
required
Cluster Id
string format: uuid
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
CapacityCheckRequest
Describe the workload the user is about to create or resize.
object
kind
required
Kind
string
cpu_request
Cpu Request
number
memory_request_mb
Memory Request Mb
integer
replicas
Replicas
integer
deployment_type
Deployment Type
string
Responses
Section titled “Responses”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
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>
ValidationErrorobject
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": {} } ]}