Resources / CapacityPolicy

CapacityPolicy

Turns a measured resource into an action before its limit (spec 0047 section 8): the value of a number in an object, as a fraction of the tested ceiling, warns at one threshold and, at the next, creates a request object from a template within limits and a spending budget. Above the budget nothing is created and an Incident asks a person.

Overview

APIplatform.etorm.com/v1alpha1
Resourcecapacitypolicies (cluster-scoped inside its cluster)
Short namescap
Available inthe platform and project clusters
Statuswritten by a controller through /status

Minimal example

apiVersion: platform.etorm.com/v1alpha1
kind: CapacityPolicy
metadata:
  name: example
spec:
  subject: "<subject>"
  metric:
    group: "<group>"
    version: "<version>"
    plural: "<plural>"
    name: "<name>"
    path: "<path>"
  ceiling: 1

Spec

FieldTypeRequiredDefaultAllowedDescription
subjectstringyeslength 1 to 200What is measured, in words (for example: the size of the API store).
metricobjectyesWhere the measured number is.
metric.groupstringyesAPI group of the object.
metric.versionstringyesAPI version of the object.
metric.pluralstringyesPlural resource name of the object.
metric.namestringyesName of the object.
metric.clusterstring"root"Logical cluster of the object (default root).
metric.pathstringyesup to 200 charactersDotted path of the number, for example status.sealedBytes.
ceilingnumberyesThe tested ceiling in the units of the number (the owning spec records it). The fraction is the value divided by this.
warnAtnumber0.50 to 1From this fraction the policy is in Warning.
actAtnumber0.70 to 1From this fraction the policy acts.
actionobjectWhat to do at actAt: create one object from a template (a ShardMigration request, an ExternalNode replica).
action.createFromobject
action.createFrom.namePrefixstringyeslength 1 to 50Created objects are named <prefix>-<n>.
action.createFrom.clusterstring"root"Logical cluster to create in.
action.createFrom.templateobject (free-form)yesThe object to create: apiVersion, kind and spec; the name and the label etorm.com/capacity-policy are set by the controller.
limitsobjectHow far the policy may go on its own.
limits.maxCreatedinteger31 to 50At most this many live objects created by this policy.
limits.cooldownSecondsinteger3600at least 0Wait between two creations.
costobjectSpending guard, money in integer micro-units of the account currency.
cost.perUnitMicrointegerat least 0What one created object costs per month.
cost.budgetMicrointegerat least 0The most the created objects may cost per month together.

Status

FieldTypeRequiredDefaultAllowedDescription
phasestring (one of)NoData, Ok, Warning, Acting, AtLimitWhere the measurement stands.
observedGenerationintegerThe generation of the spec this status describes.
valuenumberThe measured number.
fractionnumbervalue / ceiling, rounded to three decimals.
projectedSecondsToLimitintegerAt the growth of the last samples, the seconds until the ceiling (absent when not growing).
sampleslist of objectHourly samples, the last 48.
samples[].atintegerUnix time.
samples[].valuenumberThe number then.
createdlist of stringObjects this policy created (names).
createdCountintegerLive objects created by this policy.
lastActionAtintegerUnix time of the last creation.
conditionslist of objectReady and Degraded, with the metric, the threshold and the projected time as the message.
conditions[].typestringReady or Degraded.
conditions[].statusstringTrue, False or Unknown.

Columns in listings

ColumnFrom
Subject.spec.subject
Used.status.fraction
Phase.status.phase
Created.status.createdCount

All resources