Skip to content

Commit 7458a10

Browse files
committed
[server] Ensure PVC workspace class does not change
1 parent eb9b579 commit 7458a10

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

components/server/src/workspace/workspace-classes.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ export namespace WorkspaceClasses {
8585
return getDefaultId(workspaceClasses);
8686
}
8787

88+
// todo: remove this once pvc has been rolled out
89+
if (previousWorkspaceClass.endsWith("-pvc")) {
90+
return previousWorkspaceClass;
91+
}
92+
8893
const config = workspaceClasses.find((c) => c.id === previousWorkspaceClass);
8994
if (!config) {
9095
log.error(
@@ -186,6 +191,11 @@ export namespace WorkspaceClasses {
186191
const current = classes.find((c) => c.id === currentClassId);
187192
let substitute = classes.find((c) => c.id === substituteClassId);
188193

194+
// todo: remove this once pvc has been rolled out
195+
if (currentClassId.endsWith("-pvc")) {
196+
return currentClassId;
197+
}
198+
189199
if (current?.marker?.moreResources) {
190200
if (substitute?.marker?.moreResources) {
191201
return substitute?.id;

components/server/src/workspace/workspace-starter.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -903,9 +903,20 @@ export class WorkspaceStarter {
903903

904904
featureFlags = featureFlags.concat(["workspace_class_limiting"]);
905905
} else {
906-
workspaceClass = "default";
907-
if (await this.entitlementService.userGetsMoreResources(user)) {
908-
workspaceClass = "gitpodio-internal-xl";
906+
// todo: remove this once pvc has been rolled out
907+
const prebuildClass = await WorkspaceClasses.getFromPrebuild(
908+
ctx,
909+
workspace,
910+
this.workspaceDb.trace(ctx),
911+
);
912+
if (prebuildClass?.endsWith("-pvc")) {
913+
workspaceClass = prebuildClass;
914+
// ####
915+
} else {
916+
workspaceClass = "default";
917+
if (await this.entitlementService.userGetsMoreResources(user)) {
918+
workspaceClass = "gitpodio-internal-xl";
919+
}
909920
}
910921
}
911922

0 commit comments

Comments
 (0)