runr_rightsizing (Data Source)
A project's rightsizing recommendation (rightsizing): every night RunR compares what the project's pods used at most in the last 14 days with its size and recommends a smaller one — or a larger one after OOM kills, CPU throttling or memory close to its limit. Without a recommendation, status says why (collecting, right_sized, not_eligible).
Applying or dismissing a recommendation stays an action (runr projects rightsizing apply|dismiss); with Terraform, feed the size into the project explicitly, e.g. resources = { cpu = data.runr_rightsizing.x.recommended.cpu, memory_mb = data.runr_rightsizing.x.recommended.memory_mb } — then the configuration, not RunR, owns the size. Needs metrics.view on the project.
Example Usage#
# The project exists already: its id comes from a lookup by name (runr_project.api.id would
# make a cycle with the size below).
data "runr_project" "existing" {
name = "orders-api"
}
data "runr_rightsizing" "api" {
project_id = data.runr_project.existing.id
}
# Take the recommended size explicitly once there is one: the configuration owns the size.
resource "runr_project" "api" {
name = "orders-api"
type = "faas"
runtime = "python"
region_id = data.runr_region.eu.id
resources = data.runr_rightsizing.api.recommended == null ? null : {
cpu = data.runr_rightsizing.api.recommended.cpu
memory_mb = data.runr_rightsizing.api.recommended.memory_mb
}
}
output "rightsizing" {
value = data.runr_rightsizing.api.status
}
Schema#
Required#
project_id(String) Project id.
Read-Only#
blocked(Attributes) Why applying would be refused now (region capacity, a fixed allocation). (see below for nested schema)collecting(Attributes) How much data the project has toward its first recommendation (collecting). (see below for nested schema)computed_at(String) When the recommendation was made.current(Attributes) The project's size now; null without a recommendation. (see below for nested schema)direction(String)down,upormixed; null without a recommendation.evidence(Attributes) What the recommendation is based on (one pod's readings). (see below for nested schema)pending_deploy(Boolean) An applied size the running deployment does not have yet.reason(String) Why a project isnot_eligible:gpu,stopped,not_running,unsupported,no_metricsordisabled.reasons(List of String) Why, in words.recommended(Attributes) The recommended size; null without a recommendation. (see below for nested schema)savings(Attributes) The monthly difference the Billing module estimates (positive: saved); null without billing. (see below for nested schema)status(String)open,snoozed,dismissedorapplied(a recommendation), orcollecting(not enough data yet),right_sizedornot_eligible.
Nested Schema for blocked#
Read-Only:
code(String) Refusal code.message(String) Message.
Nested Schema for collecting#
Read-Only:
days(Number) Days with data.required_days(Number) Days needed.required_sessions(Number) Sessions needed.sessions(Number) Sessions with data.window_days(Number) Days looked at.
Nested Schema for current#
Read-Only:
cpu(String) CPU as a Kubernetes quantity (250m), asrunr_project.resources.cputakes it.cpu_m(Number) CPU in millicores.memory_mb(Number) Memory in MiB (runr_project.resources.memory_mb).
Nested Schema for evidence#
Read-Only:
always_on(Boolean) The workload never scales to zero.cpu_max_m(Number) Highest CPU (millicores).cpu_p95_m(Number) 95th percentile of CPU (millicores).days(Number) Days with data.memory_max_mb(Number) Highest memory working set (MiB).memory_near_limit(Boolean) Memory came close to its limit.memory_p95_mb(Number) 95th percentile of memory (MiB).oom_kills(Number) OOM kills.sessions(Number) Sessions with data.throttled_ratio(Number) Share of throttled CPU periods.window_days(Number) Days looked at.
Nested Schema for recommended#
Read-Only:
cpu(String) CPU as a Kubernetes quantity (250m), asrunr_project.resources.cputakes it.cpu_m(Number) CPU in millicores.memory_mb(Number) Memory in MiB (runr_project.resources.memory_mb).
Nested Schema for savings#
Read-Only:
basis(String)reserved(always-on, pay as you go),usage(scale to zero: 0) orfixed.currency(String) Currency.monthly(Number) Monthly amount.