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
| API | platform.etorm.com/v1alpha1 |
| Resource | capacitypolicies (cluster-scoped inside its cluster) |
| Short names | cap |
| Available in | the platform and project clusters |
| Status | written 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
| Field | Type | Required | Default | Allowed | Description |
|---|---|---|---|---|---|
subject | string | yes | length 1 to 200 | What is measured, in words (for example: the size of the API store). | |
metric | object | yes | Where the measured number is. | ||
metric.group | string | yes | API group of the object. | ||
metric.version | string | yes | API version of the object. | ||
metric.plural | string | yes | Plural resource name of the object. | ||
metric.name | string | yes | Name of the object. | ||
metric.cluster | string | "root" | Logical cluster of the object (default root). | ||
metric.path | string | yes | up to 200 characters | Dotted path of the number, for example status.sealedBytes. | |
ceiling | number | yes | The tested ceiling in the units of the number (the owning spec records it). The fraction is the value divided by this. | ||
warnAt | number | 0.5 | 0 to 1 | From this fraction the policy is in Warning. | |
actAt | number | 0.7 | 0 to 1 | From this fraction the policy acts. | |
action | object | What to do at actAt: create one object from a template (a ShardMigration request, an ExternalNode replica). | |||
action.createFrom | object | ||||
action.createFrom.namePrefix | string | yes | length 1 to 50 | Created objects are named <prefix>-<n>. | |
action.createFrom.cluster | string | "root" | Logical cluster to create in. | ||
action.createFrom.template | object (free-form) | yes | The object to create: apiVersion, kind and spec; the name and the label etorm.com/capacity-policy are set by the controller. | ||
limits | object | How far the policy may go on its own. | |||
limits.maxCreated | integer | 3 | 1 to 50 | At most this many live objects created by this policy. | |
limits.cooldownSeconds | integer | 3600 | at least 0 | Wait between two creations. | |
cost | object | Spending guard, money in integer micro-units of the account currency. | |||
cost.perUnitMicro | integer | at least 0 | What one created object costs per month. | ||
cost.budgetMicro | integer | at least 0 | The most the created objects may cost per month together. |
Status
| Field | Type | Required | Default | Allowed | Description |
|---|---|---|---|---|---|
phase | string (one of) | NoData, Ok, Warning, Acting, AtLimit | Where the measurement stands. | ||
observedGeneration | integer | The generation of the spec this status describes. | |||
value | number | The measured number. | |||
fraction | number | value / ceiling, rounded to three decimals. | |||
projectedSecondsToLimit | integer | At the growth of the last samples, the seconds until the ceiling (absent when not growing). | |||
samples | list of object | Hourly samples, the last 48. | |||
samples[].at | integer | Unix time. | |||
samples[].value | number | The number then. | |||
created | list of string | Objects this policy created (names). | |||
createdCount | integer | Live objects created by this policy. | |||
lastActionAt | integer | Unix time of the last creation. | |||
conditions | list of object | Ready and Degraded, with the metric, the threshold and the projected time as the message. | |||
conditions[].type | string | Ready or Degraded. | |||
conditions[].status | string | True, False or Unknown. |
Columns in listings
| Column | From |
|---|---|
| Subject | .spec.subject |
| Used | .status.fraction |
| Phase | .status.phase |
| Created | .status.createdCount |