Skip to content
14 changes: 14 additions & 0 deletions .changeset/hip-ants-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"wrangler": patch
---

Adds new Container instance types, and rename `dev` to `lite` and `standard` to `standard-1`. The new instance_types are now:

| Instance Type | vCPU | Memory | Disk |
| -------------------------------- | ---- | ------- | ----- |
| lite (previously dev) | 1/16 | 256 MiB | 2 GB |
| basic | 1/4 | 1 GiB | 4 GB |
| standard-1 (previously standard) | 1/2 | 4 GiB | 8 GB |
| standard-2 | 1 | 6 GiB | 12 GB |
| standard-3 | 2 | 8 GiB | 16 GB |
| standard-4 | 4 | 12 GiB | 20 GB |
16 changes: 13 additions & 3 deletions packages/containers-shared/src/client/models/InstanceType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@
/**
* The instance type will be used to configure vcpu, memory, and disk.
*
* - "dev": This will use a configuration of 1/16 vCPU, 256 MiB memory, and 2 GB disk
* - "lite": This will use a configuration of 1/16 vCPU, 256 MiB memory, and 2 GB disk
* - "basic": This will use a configuration of 1/4 vCPU, 1 GiB memory, and 4 GB disk
* - "standard": This will use a configuration of 1/2 vCPU, 4 GiB memory, and 4 GB disk
* - "standard-1": This will use a configuration of 1/2 vCPU, 4 GiB memory, and 8 GB disk
* - "standard-2": This will use a configuration of 1 vCPU, 6 GiB memory, and 12 GB disk
* - "standard-3": This will use a configuration of 2 vCPU, 8 GiB memory, and 16 GB disk
* - "standard-4": This will use a configuration of 4 vCPU, 12 GiB memory, and 20 GB disk
* - "standard": This will use a configuration of 1/2 vCPU, 4 GiB memory, and 4 GB disk. Now deprecated.
* - "dev": Is an alias for "lite". Now deprecated.
*
* The default is "dev".
* The default is "lite".
*
*/
export enum InstanceType {
LITE = "lite",
DEV = "dev",
BASIC = "basic",
STANDARD = "standard",
STANDARD_1 = "standard-1",
STANDARD_2 = "standard-2",
STANDARD_3 = "standard-3",
STANDARD_4 = "standard-4",
}
40 changes: 20 additions & 20 deletions packages/wrangler/src/__tests__/cloudchamber/apply.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"docker.io/something:hello\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ SUCCESS Created application my-container-app (Application ID: abc)
Expand Down Expand Up @@ -199,7 +199,7 @@ describe("cloudchamber apply", () => {
│ ...
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.constraints]
│ - tier = 3
│ + tier = 2
Expand Down Expand Up @@ -289,7 +289,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"docker.io/other-app:boop\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.constraints]
│ tier = 1
Expand Down Expand Up @@ -377,7 +377,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"docker.io/other-app:boop\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.constraints]
│ tier = 1
Expand Down Expand Up @@ -461,7 +461,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"docker.io/other-app:boop\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.constraints]
│ tier = 1
Expand Down Expand Up @@ -998,7 +998,7 @@ describe("cloudchamber apply", () => {
├ EDIT my-container-app
│ image = \\"docker.io/beep:boop\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ + [containers.configuration.observability.logs]
│ + enabled = true
│ [containers.constraints]
Expand Down Expand Up @@ -1065,7 +1065,7 @@ describe("cloudchamber apply", () => {
├ EDIT my-container-app
│ image = \\"docker.io/beep:boop\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ + [containers.configuration.observability.logs]
│ + enabled = true
│ [containers.constraints]
Expand Down Expand Up @@ -1136,7 +1136,7 @@ describe("cloudchamber apply", () => {
├ EDIT my-container-app
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.configuration.observability.logs]
│ - enabled = true
│ + enabled = false
Expand Down Expand Up @@ -1208,7 +1208,7 @@ describe("cloudchamber apply", () => {
├ EDIT my-container-app
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.configuration.observability.logs]
│ - enabled = true
│ + enabled = false
Expand Down Expand Up @@ -1279,7 +1279,7 @@ describe("cloudchamber apply", () => {
├ EDIT my-container-app
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.configuration.observability.logs]
│ - enabled = true
│ + enabled = false
Expand Down Expand Up @@ -1353,7 +1353,7 @@ describe("cloudchamber apply", () => {
├ EDIT my-container-app
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ [containers.configuration.observability.logs]
│ - enabled = true
│ + enabled = false
Expand Down Expand Up @@ -1555,7 +1555,7 @@ describe("cloudchamber apply", () => {
name: "my-container-app",
instances: 3,
class_name: "DurableObjectClass",
instance_type: "dev",
instance_type: "lite",
image: "docker.io/beep:boop",
constraints: {
tier: 2,
Expand Down Expand Up @@ -1583,7 +1583,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"docker.io/beep:boop\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ SUCCESS Created application my-container-app (Application ID: abc)
Expand Down Expand Up @@ -1709,7 +1709,7 @@ describe("cloudchamber apply", () => {
│ scheduling_policy = \\"regional\\"
│ [containers.configuration]
│ image = \\"docker.io/beep:boop\\"
│ - instance_type = \\"dev\\"
│ - instance_type = \\"lite\\"
│ + instance_type = \\"standard\\"
│ [containers.constraints]
│ - tier = 3
Expand Down Expand Up @@ -1870,7 +1870,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"docker.io/beep:boop\\"
│ - instance_type = \\"basic\\"
│ + instance_type = \\"dev\\"
│ + instance_type = \\"lite\\"
│ [containers.constraints]
│ - tier = 3
│ + tier = 2
Expand All @@ -1884,7 +1884,7 @@ describe("cloudchamber apply", () => {
`);
expect(std.stderr).toMatchInlineSnapshot(`""`);
const app = await applicationReqBodyPromise;
expect(app.configuration?.instance_type).toEqual("dev");
expect(app.configuration?.instance_type).toEqual("lite");
});

test("expands image names from managed registry when creating an application", async () => {
Expand Down Expand Up @@ -1934,7 +1934,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"${registry}/some-account-id/hello:1.0\\"
│ instance_type = \\"dev\\"
│ instance_type = \\"lite\\"
│ SUCCESS Created application my-container-app (Application ID: abc)
Expand Down Expand Up @@ -2000,7 +2000,7 @@ describe("cloudchamber apply", () => {
│ [containers.configuration]
│ image = \\"registry.cloudflare.com/some-account-id/hello:1.0\\"
│ - instance_type = \\"dev\\"
│ - instance_type = \\"lite\\"
│ + instance_type = \\"standard\\"
│ [containers.constraints]
│ - tier = 3
Expand Down Expand Up @@ -2029,7 +2029,7 @@ describe("cloudchamber apply", () => {
instances: 3,
class_name: "DurableObjectClass",
image: `${registry}/hello:1.0`,
instance_type: "dev",
instance_type: "lite",
constraints: {
tier: 1,
},
Expand Down Expand Up @@ -2093,6 +2093,6 @@ describe("cloudchamber apply", () => {
`);
expect(std.stderr).toMatchInlineSnapshot(`""`);
const app = await applicationReqBodyPromise;
expect(app.configuration?.instance_type).toEqual("dev");
expect(app.configuration?.instance_type).toEqual("lite");
});
});
16 changes: 8 additions & 8 deletions packages/wrangler/src/__tests__/cloudchamber/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe("cloudchamber create", () => {
--label Deployment labels [array]
--all-ssh-keys To add all SSH keys configured on your account to be added to this deployment, set this option to true [boolean]
--ssh-key-id ID of the SSH key to add to the deployment [array]
--instance-type Instance type to allocate to this deployment [choices: \\"dev\\", \\"basic\\", \\"standard\\"]
--instance-type Instance type to allocate to this deployment [choices: \\"lite\\", \\"basic\\", \\"standard-1\\", \\"standard-2\\", \\"standard-3\\", \\"standard-4\\"]
--vcpu Number of vCPUs to allocate to this deployment. [number]
--memory Amount of memory (GiB, MiB...) to allocate to this deployment. Ex: 4GiB. [string]
--ipv4 Include an IPv4 in the deployment [boolean]"
Expand Down Expand Up @@ -189,8 +189,8 @@ describe("cloudchamber create", () => {
await expect(
runWrangler("cloudchamber create ")
).rejects.toThrowErrorMatchingInlineSnapshot(
` [Error: Processing wrangler.toml configuration:
- "instance_type" should be one of 'dev', 'basic', or 'standard', but got invalid]`
`[Error: Processing wrangler.toml configuration:
- "instance_type" should be one of 'lite', 'basic', 'standard-1', 'standard-2', 'standard-3', or 'standard-4', but got invalid]`
);
});

Expand All @@ -204,7 +204,7 @@ describe("cloudchamber create", () => {
image: "hello:world",
location: "sfo06",
vcpu: 2,
instance_type: "dev",
instance_type: "lite",
},
}),

Expand Down Expand Up @@ -242,15 +242,15 @@ describe("cloudchamber create", () => {
async ({ request }) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const r = (await request.json()) as Record<string, any>;
expect(r.instance_type).toEqual("dev");
expect(r.instance_type).toEqual("lite");
return HttpResponse.json({});
},
{ once: true }
)
);
expect(std.err).toMatchInlineSnapshot(`""`);
await runWrangler(
"cloudchamber create --image hello:world --location sfo06 --var HELLO:WORLD --var YOU:CONQUERED --instance-type dev --ipv4 true"
"cloudchamber create --image hello:world --location sfo06 --var HELLO:WORLD --var YOU:CONQUERED --instance-type lite --ipv4 true"
);
expect(std.out).toMatchInlineSnapshot(`"{}"`);
});
Expand Down Expand Up @@ -284,7 +284,7 @@ describe("cloudchamber create", () => {
setWranglerConfig({
image: "hello:world",
ipv4: true,
instance_type: "dev",
instance_type: "lite",
location: "sfo06",
});
// if values are not read by wrangler, this mock won't work
Expand All @@ -296,7 +296,7 @@ describe("cloudchamber create", () => {
async ({ request }) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const r = (await request.json()) as Record<string, any>;
expect(r.instance_type).toEqual("dev");
expect(r.instance_type).toEqual("lite");
return HttpResponse.json({});
},
{ once: true }
Expand Down
18 changes: 9 additions & 9 deletions packages/wrangler/src/__tests__/cloudchamber/limits.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import type {

const MB = 1000 * 1000;
const commonLimits = {
vcpu_per_deployment: 1,
memory_mib_per_deployment: 4096,
disk_mb_per_deployment: 4000,
vcpu_per_deployment: 4,
memory_mib_per_deployment: 12288,
disk_mb_per_deployment: 20000,
};

vi.mock("@cloudflare/containers-shared", async (importOriginal) => {
Expand Down Expand Up @@ -94,7 +94,7 @@ describe("ensureContainerLimits", () => {
} as ContainerNormalizedConfig,
})
).rejects.toThrowErrorMatchingInlineSnapshot(
`[Error: Exceeded account limits: Your container configuration uses 4000 MB of disk which exceeds the account limit of 2000 MB.]`
`[Error: Exceeded account limits: Your container configuration uses 8000 MB of disk which exceeds the account limit of 2000 MB.]`
);
});

Expand Down Expand Up @@ -129,7 +129,7 @@ describe("ensureContainerLimits", () => {
} as ContainerNormalizedConfig,
})
).rejects.toThrowErrorMatchingInlineSnapshot(
`[Error: Exceeded account limits: Your container configuration uses 5 vCPU which exceeds the account limit of 1 vCPU.]`
`[Error: Exceeded account limits: Your container configuration uses 5 vCPU which exceeds the account limit of 4 vCPU.]`
);
});

Expand All @@ -143,12 +143,12 @@ describe("ensureContainerLimits", () => {
} as CompleteAccountCustomer,
containerConfig: {
vcpu: 1,
memory_mib: 8192,
memory_mib: 999999,
disk_bytes: 4000 * MB,
} as ContainerNormalizedConfig,
})
).rejects.toThrowErrorMatchingInlineSnapshot(
`[Error: Exceeded account limits: Your container configuration uses 8192 MiB of memory which exceeds the account limit of 4096 MiB.]`
`[Error: Exceeded account limits: Your container configuration uses 999999 MiB of memory which exceeds the account limit of 12288 MiB.]`
);
});

Expand All @@ -163,11 +163,11 @@ describe("ensureContainerLimits", () => {
containerConfig: {
vcpu: 1,
memory_mib: 4096,
disk_bytes: 6000 * MB,
disk_bytes: 60000 * MB,
} as ContainerNormalizedConfig,
})
).rejects.toThrowErrorMatchingInlineSnapshot(
`[Error: Exceeded account limits: Your container configuration uses 6000 MB of disk which exceeds the account limit of 4000 MB.]`
`[Error: Exceeded account limits: Your container configuration uses 60000 MB of disk which exceeds the account limit of 20000 MB.]`
);
});

Expand Down
Loading
Loading