ComputeCluster
A ComputeCluster is the set of machine pools in the customer's account that Containers and Daemons run on. Declare one to control the pools and their hardware; otherwise Alien adds a default.
import * as alien from "@alienplatform/core"
const cluster = new alien.ComputeCluster("compute")
.pool("general", {
requirements: { cpu: 4, memory: "16Gi", architecture: "arm64" },
scale: { type: "autoscale", min: 2, max: 10 },
})
.build()
const api = new alien.Container("api")
.code({ type: "image", image: "ghcr.io/acme/api:1.4.0" })
.cluster("compute")
.pool("general")
.cpu(1)
.memory("2Gi")
.port(8080)
.permissions("execution")
.build()
export default new alien.Stack("acme")
.add(cluster, "frozen")
.add(api, "live")
.permissions({ profiles: { execution: {} } })
.build()In this stack:
.permissions("execution")names the Container's permission profile, the set of cloud permissions it runs with.executiongrants nothing here, because the Container uses no other resource."live"means Alien creates and updates the Container on every release. See Frozen and live.
| Platform | Provisions |
|---|---|
| AWS | One Auto Scaling group per pool, EC2 instance profile, launch template |
| Google Cloud | One managed instance group per pool, service account, instance template |
| Azure | One Virtual Machine Scale Set per pool, managed identity |
| Kubernetes | Nothing. Describes logical pools in the deployment namespace and applies architecture constraints to Pods. Node sizes, counts, and autoscaling stay with the cluster administrator. |
| Bare metal & on-prem | Pools are labels. Each machine chooses its pool with join --capacity-group, run through your white-labeled setup CLI (acmectl join). Alien doesn't add or remove machines. |
| Local | A Docker network for local containers. No machines. |
Kubernetes rejects accelerators, nested virtualization, custom container CIDRs, provider instance types, and selected zones.
A ComputeCluster is always "frozen". The customer's admin creates it during initial setup. Afterwards, during ongoing management, Alien manages only the machines inside it (see Frozen and live).
On AWS, Google Cloud, and Azure, when a stack has Containers and no cluster, Alien adds one named compute with a general pool sized from the containers.
Options
| Method | Type | Default | Notes |
|---|---|---|---|
.pool(id, config) | ComputePoolInput | none | Repeatable. Each pool becomes its own machine group. See Pools. |
.nodePermissions(profile, opts?) | PermissionProfile, { platforms } | none | Grants the machine identity access to named resources. Limit to platforms with { platforms: ["aws"] }. |
.containerCidr(cidr) | string | "10.244.0.0/16" | Range for container networking. Each machine gets a /24. |
ComputeCluster has no .enabled().
Pools
| Field | Type | Default | Notes |
|---|---|---|---|
requirements.cpu | number | string | required | vCPUs per machine. |
requirements.memory | string | required | Memory per machine, for example "16Gi". |
requirements.ephemeralStorage | string | "20Gi" | Local disk per machine. |
requirements.architecture | "arm64" | "x86_64" | build architecture | |
requirements.nestedVirtualization | boolean | false | Machines that can run VMs. |
requirements.accelerators | { type, count }[] | none | GPUs per machine, for example { type: "nvidia-t4", count: 1 }. |
requirements.dataDisk | { size } | none | An extra empty disk on each machine. size is a quantity such as "200Gi", or a { min, default, max } range each deployment picks from. Not on Kubernetes. |
scale | { type: "fixed", machines } | { type: "autoscale", min, max } | required | Each count is a number or a { min, max, default } range the deployer (the person who sets up the deployment, usually the customer's admin) chooses within. |
dynamicContainers | boolean | false | Lets containers created after initial setup use this pool. Only one pool can opt in. |
failureDomainSpread | number | none | Number of zones to spread across, 1 to 255. |
Machine types
You declare hardware requirements, not machine types. On AWS, Google Cloud, and Azure, Alien picks a machine type for each pool from its requirements. The deployer can choose another one in the deployment settings.
The deployer picks a family, then a size. The list shows only machines that fit the pool:
- the pool's CPU architecture
- nested virtualization, when the pool asks for it
- at least the pool's vCPU, memory, and local disk
- the pool's GPU type and count
Automatic selection picks from a fixed set of machines, so a machine Alien adds to its list never changes what an existing deployment runs. Machines outside that set, such as m8g.xlarge or m8i.24xlarge, run only when the deployer chooses them.
Families
| Category | AWS | Google Cloud | Azure |
|---|---|---|---|
| General purpose | m7g, m8g, m7i, m8i, m8i-flex, m8a | N2, N4 | Dsv4, Dsv5, Dsv6, Dasv6 |
| Compute optimized | c7g, c8g, c8i, c8i-flex, c8a | C3, C4, N4 | Fsv2 |
| Memory optimized | r7g, r8g, r6a, r7i, r8i, r8i-flex, r8a | N2, N4, C4 | Esv5, Esv6 |
| Storage optimized | i4i, i7i, i8g | C3D | Lsv3 |
| Burstable | t4g, t3 | E2 | B |
| GPU | g5, p4d, p5 | N1 with a T4, A2, A3 | NCasT4_v3, NCads_A100_v4, NDisr_H100_v5 |
Most families include every size the provider sells, except bare metal. For example, c8i, m8i, and r8i go from large (2 vCPU) to 96xlarge (384 vCPU), and their Flex variants go to 16xlarge. Burstable, GPU, and some storage families include a fixed set of sizes.
Google Cloud offers only x86 families, because the Google Cloud machine image is x86 only.
Nested virtualization
A pool with nestedVirtualization: true gets only machines that can run VMs:
- AWS: c8i, m8i, r8i, their Flex variants, and i7i. See nested virtualization on Amazon EC2.
- Google Cloud: N2, N4, C3, and C4, except
c3-standard-4,c3-standard-8, andn2-highmem-2ton2-highmem-32. See nested virtualization on Compute Engine. - Azure: Dsv5, Dsv6, Dasv6, Fsv2, Esv5, and Esv6.
Region and quota
Alien checks the region and the quota before initial setup, and before an update that changes a pool's machine type or machine count:
- The deployment's region must offer the machine.
- The customer's quota must cover the machines the pool starts with. Room to grow to the pool's maximum only warns.
A failed check names the machine and region, or the quota that is short.
On Google Cloud, the all-regions CPU check only warns on updates. A deployment set up before Alien could read zones and regional quotas on updates warns on those checks too, until the admin runs initial setup again.
See the quota checks on AWS, Google Cloud, and Azure.
Use it in code
A ComputeCluster has no runtime binding. Workloads reach it by setting .cluster(id) and .pool(name).
Behavior and limits
| Limit | Value |
|---|---|
| Pools accepting dynamic containers | 1 |
| Failure domain spread | 1 to 255 |
| Container CIDR per machine | /24 (254 container addresses) |
dataDisk | Up to 65,536 GiB on AWS and Google Cloud, and 32,767 GiB on Azure. Checked at join on bare metal and on-prem machines. Kubernetes refuses it. Changing the size replaces every machine in the pool, and data on the old disks isn't kept. |
| Cluster ID on Google Cloud | 18 characters. The machine service account is named <prefix>-<id>-sa, and Google Cloud caps service account IDs at 30. |
| CPU reserved per machine | 0.5 vCPU for the node agent and system processes. Plan workloads against the rest. |
Machine counts are the deployer's choice within your bounds. A count given as { min, max, default } lets the deployer pick a value in range during initial setup.
For the general pool Alien generates, the counts are a recommendation sized from container replicas. Initial setup offers up to 100 machines, and the deployer can go higher.
Hardware is matched, not named. Alien turns requirements into a provider machine type when the deployment is set up. The pool's cpu, memory, and ephemeralStorage are machine totals, not what's left for containers.
Changes after initial setup. containerCidr can't change once set.
A pool's machine type can change only to another catalog machine in the same cloud with the same CPU architecture, because the stack's images are built for one architecture. Alien rolls the existing machines over to the new type.
Change a running deployment's pools from the CLI:
alien deployments set-compute customer-1/customer-1 --pool general --machines 3
alien deployments set-compute customer-1/customer-1 --pool general --min 2 --max 6
alien deployments set-compute customer-1/customer-1 --pool general --machine m8g.xlargeThe update replaces the deployment's whole pool map, so the CLI sends the other pools back as it read them. Container CPU and memory aren't sent and keep their values. Scaling a pool to 0 machines asks for confirmation; pass --yes in scripts.
What Alien manages. Initial setup creates the machine groups, identities, and network boundary. After that, with compute-cluster/management, Alien:
- changes machine counts within the declared bounds,
- rolls out new machine images,
- changes the machine type within one architecture.
Machines clear unused images when the disk fills. The machine agent checks the disk that holds container images every 10 seconds. When it is 85% full, the machine agent removes unused images, least recently used first, until the disk is back at 80%. It removes:
- images of the deployment's own containers that no container on the machine uses, running or stopped, and that no current or next release needs,
- data left by an image download the machine agent stopped, for example when a newer release replaced it.
It never removes an image a container uses, an image it first saw less than two minutes ago, or images that other software on the machine pulled from other registries. Removing an image doesn't stop or restart any container.
A new release's images download while the current release keeps serving. That download stops when less than 5% of the disk is free (at least 1 GiB, at most 10%), so cleanup can make room, and is retried with a growing wait of up to 5 minutes.
If a disk still fills, the space is held by images in use or by other data. Give the pool more local disk with ephemeralStorage, or make the images smaller. On bare metal and on-prem machines, keep other data off the disk that holds /var/lib/containerd. On Kubernetes, the kubelet cleans up images instead.
Kubernetes uses existing nodes. Pool CPU, memory, disk, machine counts, autoscaling, and failure-domain spread are the cluster administrator's. Alien enforces only architecture, through Pod scheduling, and warns that the rest isn't enforced.
Permissions
| Set | Grants |
|---|---|
compute-cluster/provision | Creating machine groups, launch templates, and identities. Used by initial setup. |
compute-cluster/management | Rolling updates and scaling within declared bounds. |
compute-cluster/execute | What the machines themselves need (image pull, logs, metadata). |
compute-cluster/heartbeat | Health checks. |