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. |
| Machines | Pools are labels. Each host chooses its pool with alien-deploy join --capacity-group. Alien doesn't add or remove hosts. |
| 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-l4", count: 1 }. |
requirements.dataDisk | { size } | none | An extra empty block device each host must provide. Machines platform only. |
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. |
You declare hardware requirements, not instance types. The deployer picks provider machine types in deployment settings.
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 | Machines platform only. Other clouds and Kubernetes refuse it. |
| 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 m6i.largeThe 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,
- on AWS, changes the machine type within one architecture.
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. |