Skip to content

Commit 7a4d0da

Browse files
Adds new instance types to allowed list (#10844)
* Adds new instance types to allowed list * Updating missing spots with container instances * Fixing container instance type name tests and one flipped conditional * Adds changeset * Fixing another container test * Continuing to replace dev with lite * Continued changing of dev to lite * fixup changeset * warn about deprecated instance types --------- Co-authored-by: emily-shen <[email protected]>
1 parent 7540fb4 commit 7a4d0da

File tree

14 files changed

+236
-93
lines changed

14 files changed

+236
-93
lines changed

.changeset/hip-ants-wait.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Adds new Container instance types, and rename `dev` to `lite` and `standard` to `standard-1`. The new instance_types are now:
6+
7+
| Instance Type | vCPU | Memory | Disk |
8+
| -------------------------------- | ---- | ------- | ----- |
9+
| lite (previously dev) | 1/16 | 256 MiB | 2 GB |
10+
| basic | 1/4 | 1 GiB | 4 GB |
11+
| standard-1 (previously standard) | 1/2 | 4 GiB | 8 GB |
12+
| standard-2 | 1 | 6 GiB | 12 GB |
13+
| standard-3 | 2 | 8 GiB | 16 GB |
14+
| standard-4 | 4 | 12 GiB | 20 GB |

packages/containers-shared/src/client/models/InstanceType.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,25 @@
55
/**
66
* The instance type will be used to configure vcpu, memory, and disk.
77
*
8-
* - "dev": This will use a configuration of 1/16 vCPU, 256 MiB memory, and 2 GB disk
8+
* - "lite": This will use a configuration of 1/16 vCPU, 256 MiB memory, and 2 GB disk
99
* - "basic": This will use a configuration of 1/4 vCPU, 1 GiB memory, and 4 GB disk
10-
* - "standard": This will use a configuration of 1/2 vCPU, 4 GiB memory, and 4 GB disk
10+
* - "standard-1": This will use a configuration of 1/2 vCPU, 4 GiB memory, and 8 GB disk
11+
* - "standard-2": This will use a configuration of 1 vCPU, 6 GiB memory, and 12 GB disk
12+
* - "standard-3": This will use a configuration of 2 vCPU, 8 GiB memory, and 16 GB disk
13+
* - "standard-4": This will use a configuration of 4 vCPU, 12 GiB memory, and 20 GB disk
14+
* - "standard": This will use a configuration of 1/2 vCPU, 4 GiB memory, and 4 GB disk. Now deprecated.
15+
* - "dev": Is an alias for "lite". Now deprecated.
1116
*
12-
* The default is "dev".
17+
* The default is "lite".
1318
*
1419
*/
1520
export enum InstanceType {
21+
LITE = "lite",
1622
DEV = "dev",
1723
BASIC = "basic",
1824
STANDARD = "standard",
25+
STANDARD_1 = "standard-1",
26+
STANDARD_2 = "standard-2",
27+
STANDARD_3 = "standard-3",
28+
STANDARD_4 = "standard-4",
1929
}

packages/wrangler/src/__tests__/cloudchamber/apply.test.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe("cloudchamber apply", () => {
131131
132132
│ [containers.configuration]
133133
│ image = \\"docker.io/something:hello\\"
134-
│ instance_type = \\"dev\\"
134+
│ instance_type = \\"lite\\"
135135
136136
137137
│ SUCCESS Created application my-container-app (Application ID: abc)
@@ -199,7 +199,7 @@ describe("cloudchamber apply", () => {
199199
200200
│ ...
201201
202-
│ instance_type = \\"dev\\"
202+
│ instance_type = \\"lite\\"
203203
│ [containers.constraints]
204204
│ - tier = 3
205205
│ + tier = 2
@@ -289,7 +289,7 @@ describe("cloudchamber apply", () => {
289289
290290
│ [containers.configuration]
291291
│ image = \\"docker.io/other-app:boop\\"
292-
│ instance_type = \\"dev\\"
292+
│ instance_type = \\"lite\\"
293293
294294
│ [containers.constraints]
295295
│ tier = 1
@@ -377,7 +377,7 @@ describe("cloudchamber apply", () => {
377377
378378
│ [containers.configuration]
379379
│ image = \\"docker.io/other-app:boop\\"
380-
│ instance_type = \\"dev\\"
380+
│ instance_type = \\"lite\\"
381381
382382
│ [containers.constraints]
383383
│ tier = 1
@@ -461,7 +461,7 @@ describe("cloudchamber apply", () => {
461461
462462
│ [containers.configuration]
463463
│ image = \\"docker.io/other-app:boop\\"
464-
│ instance_type = \\"dev\\"
464+
│ instance_type = \\"lite\\"
465465
466466
│ [containers.constraints]
467467
│ tier = 1
@@ -998,7 +998,7 @@ describe("cloudchamber apply", () => {
998998
├ EDIT my-container-app
999999
10001000
│ image = \\"docker.io/beep:boop\\"
1001-
│ instance_type = \\"dev\\"
1001+
│ instance_type = \\"lite\\"
10021002
│ + [containers.configuration.observability.logs]
10031003
│ + enabled = true
10041004
│ [containers.constraints]
@@ -1065,7 +1065,7 @@ describe("cloudchamber apply", () => {
10651065
├ EDIT my-container-app
10661066
10671067
│ image = \\"docker.io/beep:boop\\"
1068-
│ instance_type = \\"dev\\"
1068+
│ instance_type = \\"lite\\"
10691069
│ + [containers.configuration.observability.logs]
10701070
│ + enabled = true
10711071
│ [containers.constraints]
@@ -1136,7 +1136,7 @@ describe("cloudchamber apply", () => {
11361136
11371137
├ EDIT my-container-app
11381138
1139-
│ instance_type = \\"dev\\"
1139+
│ instance_type = \\"lite\\"
11401140
│ [containers.configuration.observability.logs]
11411141
│ - enabled = true
11421142
│ + enabled = false
@@ -1208,7 +1208,7 @@ describe("cloudchamber apply", () => {
12081208
12091209
├ EDIT my-container-app
12101210
1211-
│ instance_type = \\"dev\\"
1211+
│ instance_type = \\"lite\\"
12121212
│ [containers.configuration.observability.logs]
12131213
│ - enabled = true
12141214
│ + enabled = false
@@ -1279,7 +1279,7 @@ describe("cloudchamber apply", () => {
12791279
12801280
├ EDIT my-container-app
12811281
1282-
│ instance_type = \\"dev\\"
1282+
│ instance_type = \\"lite\\"
12831283
│ [containers.configuration.observability.logs]
12841284
│ - enabled = true
12851285
│ + enabled = false
@@ -1353,7 +1353,7 @@ describe("cloudchamber apply", () => {
13531353
13541354
├ EDIT my-container-app
13551355
1356-
│ instance_type = \\"dev\\"
1356+
│ instance_type = \\"lite\\"
13571357
│ [containers.configuration.observability.logs]
13581358
│ - enabled = true
13591359
│ + enabled = false
@@ -1555,7 +1555,7 @@ describe("cloudchamber apply", () => {
15551555
name: "my-container-app",
15561556
instances: 3,
15571557
class_name: "DurableObjectClass",
1558-
instance_type: "dev",
1558+
instance_type: "lite",
15591559
image: "docker.io/beep:boop",
15601560
constraints: {
15611561
tier: 2,
@@ -1583,7 +1583,7 @@ describe("cloudchamber apply", () => {
15831583
15841584
│ [containers.configuration]
15851585
│ image = \\"docker.io/beep:boop\\"
1586-
│ instance_type = \\"dev\\"
1586+
│ instance_type = \\"lite\\"
15871587
15881588
15891589
│ SUCCESS Created application my-container-app (Application ID: abc)
@@ -1709,7 +1709,7 @@ describe("cloudchamber apply", () => {
17091709
│ scheduling_policy = \\"regional\\"
17101710
│ [containers.configuration]
17111711
│ image = \\"docker.io/beep:boop\\"
1712-
│ - instance_type = \\"dev\\"
1712+
│ - instance_type = \\"lite\\"
17131713
│ + instance_type = \\"standard\\"
17141714
│ [containers.constraints]
17151715
│ - tier = 3
@@ -1870,7 +1870,7 @@ describe("cloudchamber apply", () => {
18701870
│ [containers.configuration]
18711871
│ image = \\"docker.io/beep:boop\\"
18721872
│ - instance_type = \\"basic\\"
1873-
│ + instance_type = \\"dev\\"
1873+
│ + instance_type = \\"lite\\"
18741874
│ [containers.constraints]
18751875
│ - tier = 3
18761876
│ + tier = 2
@@ -1884,7 +1884,7 @@ describe("cloudchamber apply", () => {
18841884
`);
18851885
expect(std.stderr).toMatchInlineSnapshot(`""`);
18861886
const app = await applicationReqBodyPromise;
1887-
expect(app.configuration?.instance_type).toEqual("dev");
1887+
expect(app.configuration?.instance_type).toEqual("lite");
18881888
});
18891889

18901890
test("expands image names from managed registry when creating an application", async () => {
@@ -1934,7 +1934,7 @@ describe("cloudchamber apply", () => {
19341934
19351935
│ [containers.configuration]
19361936
│ image = \\"${registry}/some-account-id/hello:1.0\\"
1937-
│ instance_type = \\"dev\\"
1937+
│ instance_type = \\"lite\\"
19381938
19391939
19401940
│ SUCCESS Created application my-container-app (Application ID: abc)
@@ -2000,7 +2000,7 @@ describe("cloudchamber apply", () => {
20002000
20012001
│ [containers.configuration]
20022002
│ image = \\"registry.cloudflare.com/some-account-id/hello:1.0\\"
2003-
│ - instance_type = \\"dev\\"
2003+
│ - instance_type = \\"lite\\"
20042004
│ + instance_type = \\"standard\\"
20052005
│ [containers.constraints]
20062006
│ - tier = 3
@@ -2029,7 +2029,7 @@ describe("cloudchamber apply", () => {
20292029
instances: 3,
20302030
class_name: "DurableObjectClass",
20312031
image: `${registry}/hello:1.0`,
2032-
instance_type: "dev",
2032+
instance_type: "lite",
20332033
constraints: {
20342034
tier: 1,
20352035
},
@@ -2093,6 +2093,6 @@ describe("cloudchamber apply", () => {
20932093
`);
20942094
expect(std.stderr).toMatchInlineSnapshot(`""`);
20952095
const app = await applicationReqBodyPromise;
2096-
expect(app.configuration?.instance_type).toEqual("dev");
2096+
expect(app.configuration?.instance_type).toEqual("lite");
20972097
});
20982098
});

packages/wrangler/src/__tests__/cloudchamber/create.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe("cloudchamber create", () => {
119119
--label Deployment labels [array]
120120
--all-ssh-keys To add all SSH keys configured on your account to be added to this deployment, set this option to true [boolean]
121121
--ssh-key-id ID of the SSH key to add to the deployment [array]
122-
--instance-type Instance type to allocate to this deployment [choices: \\"dev\\", \\"basic\\", \\"standard\\"]
122+
--instance-type Instance type to allocate to this deployment [choices: \\"lite\\", \\"basic\\", \\"standard-1\\", \\"standard-2\\", \\"standard-3\\", \\"standard-4\\"]
123123
--vcpu Number of vCPUs to allocate to this deployment. [number]
124124
--memory Amount of memory (GiB, MiB...) to allocate to this deployment. Ex: 4GiB. [string]
125125
--ipv4 Include an IPv4 in the deployment [boolean]"
@@ -189,8 +189,8 @@ describe("cloudchamber create", () => {
189189
await expect(
190190
runWrangler("cloudchamber create ")
191191
).rejects.toThrowErrorMatchingInlineSnapshot(
192-
` [Error: Processing wrangler.toml configuration:
193-
- "instance_type" should be one of 'dev', 'basic', or 'standard', but got invalid]`
192+
`[Error: Processing wrangler.toml configuration:
193+
- "instance_type" should be one of 'lite', 'basic', 'standard-1', 'standard-2', 'standard-3', or 'standard-4', but got invalid]`
194194
);
195195
});
196196

@@ -204,7 +204,7 @@ describe("cloudchamber create", () => {
204204
image: "hello:world",
205205
location: "sfo06",
206206
vcpu: 2,
207-
instance_type: "dev",
207+
instance_type: "lite",
208208
},
209209
}),
210210

@@ -242,15 +242,15 @@ describe("cloudchamber create", () => {
242242
async ({ request }) => {
243243
// eslint-disable-next-line @typescript-eslint/no-explicit-any
244244
const r = (await request.json()) as Record<string, any>;
245-
expect(r.instance_type).toEqual("dev");
245+
expect(r.instance_type).toEqual("lite");
246246
return HttpResponse.json({});
247247
},
248248
{ once: true }
249249
)
250250
);
251251
expect(std.err).toMatchInlineSnapshot(`""`);
252252
await runWrangler(
253-
"cloudchamber create --image hello:world --location sfo06 --var HELLO:WORLD --var YOU:CONQUERED --instance-type dev --ipv4 true"
253+
"cloudchamber create --image hello:world --location sfo06 --var HELLO:WORLD --var YOU:CONQUERED --instance-type lite --ipv4 true"
254254
);
255255
expect(std.out).toMatchInlineSnapshot(`"{}"`);
256256
});
@@ -284,7 +284,7 @@ describe("cloudchamber create", () => {
284284
setWranglerConfig({
285285
image: "hello:world",
286286
ipv4: true,
287-
instance_type: "dev",
287+
instance_type: "lite",
288288
location: "sfo06",
289289
});
290290
// if values are not read by wrangler, this mock won't work
@@ -296,7 +296,7 @@ describe("cloudchamber create", () => {
296296
async ({ request }) => {
297297
// eslint-disable-next-line @typescript-eslint/no-explicit-any
298298
const r = (await request.json()) as Record<string, any>;
299-
expect(r.instance_type).toEqual("dev");
299+
expect(r.instance_type).toEqual("lite");
300300
return HttpResponse.json({});
301301
},
302302
{ once: true }

packages/wrangler/src/__tests__/cloudchamber/limits.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import type {
1313

1414
const MB = 1000 * 1000;
1515
const commonLimits = {
16-
vcpu_per_deployment: 1,
17-
memory_mib_per_deployment: 4096,
18-
disk_mb_per_deployment: 4000,
16+
vcpu_per_deployment: 4,
17+
memory_mib_per_deployment: 12288,
18+
disk_mb_per_deployment: 20000,
1919
};
2020

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

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

@@ -143,12 +143,12 @@ describe("ensureContainerLimits", () => {
143143
} as CompleteAccountCustomer,
144144
containerConfig: {
145145
vcpu: 1,
146-
memory_mib: 8192,
146+
memory_mib: 999999,
147147
disk_bytes: 4000 * MB,
148148
} as ContainerNormalizedConfig,
149149
})
150150
).rejects.toThrowErrorMatchingInlineSnapshot(
151-
`[Error: Exceeded account limits: Your container configuration uses 8192 MiB of memory which exceeds the account limit of 4096 MiB.]`
151+
`[Error: Exceeded account limits: Your container configuration uses 999999 MiB of memory which exceeds the account limit of 12288 MiB.]`
152152
);
153153
});
154154

@@ -163,11 +163,11 @@ describe("ensureContainerLimits", () => {
163163
containerConfig: {
164164
vcpu: 1,
165165
memory_mib: 4096,
166-
disk_bytes: 6000 * MB,
166+
disk_bytes: 60000 * MB,
167167
} as ContainerNormalizedConfig,
168168
})
169169
).rejects.toThrowErrorMatchingInlineSnapshot(
170-
`[Error: Exceeded account limits: Your container configuration uses 6000 MB of disk which exceeds the account limit of 4000 MB.]`
170+
`[Error: Exceeded account limits: Your container configuration uses 60000 MB of disk which exceeds the account limit of 20000 MB.]`
171171
);
172172
});
173173

0 commit comments

Comments
 (0)