Skip to main content

Module instance_catalog

Module instance_catalog 

Source
Expand description

Instance type catalog and selection algorithm for cloud compute infrastructure.

This module provides:

  • A static catalog of known instance types across AWS, GCP, and Azure
  • Resource quantity parsing (CPU strings, Kubernetes-style memory/storage quantities)
  • An algorithm to select the optimal instance type for a given workload

The catalog is the single source of truth for instance type specifications. It is used by the preflights system to automatically populate CapacityGroup.instance_type and CapacityGroup.profile based on the containers in a stack.

Structs§

CatalogGpu
Static GPU specification for catalog entries (no heap allocation).
InstanceSelection
Result of instance type selection.
InstanceTypeSpec
A known instance type with its hardware specifications.
WorkloadRequirements
Aggregated resource requirements from all containers in a capacity group.

Enums§

Architecture
CPU architecture.
InstanceFamily
Instance family classification.

Functions§

auto_select_series
The series automatic selection may pick from, in catalog (preference) order.
catalog_for_platform
Get all instance types for a given platform.
default_architecture
Default machine architecture for images built for a managed cloud.
find_instance_type
Find a specific instance type by name and platform.
is_same_architecture_aws_machine
Whether a capacity group may move from AWS machine old to new without setup: both are catalog machines of one CPU architecture, so the stack’s images still run on the new one.
is_same_architecture_machine
Whether two catalog machines belong to the given cloud and share a CPU architecture.
max_configurable_ephemeral_storage_bytes
Maximum workload storage that the current cloud controllers can turn into their provider-backed root disk after adding 25% filesystem headroom and 12 GiB of runtime overhead. Keep these bounds in sync with the provider controller contract; rejecting here is preferable to failing after cloud resources have already been created.
parse_cpu
Parse a CPU quantity string to f64.
parse_memory_bytes
Parse a memory or storage quantity string to bytes.
select_family
Select instance family based on workload characteristics.
select_instance_type
Select the best instance type for a workload on a given platform.
select_instance_type_with_room
Like select_instance_type, but only from the series that have room for machines machines. has_room answers for one machine type of a series. The ordinary selection runs first; a pick whose series has no room removes that series and selection runs again, so every preference of the ordinary selection (local disk before a configurable one, the smallest machine that fits, catalog order between equal machines) still applies to the series that remain. When no series has room, the result is the plain selection, so the caller’s quota check reports the refusal. Pass the machines the pool launches with.