Skip to content

Commit

Permalink
[server] Ensure PVC workspace class does not change
Browse files Browse the repository at this point in the history
  • Loading branch information
Furisto committed Sep 7, 2022
1 parent eb9b579 commit 7458a10
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
10 changes: 10 additions & 0 deletions components/server/src/workspace/workspace-classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ export namespace WorkspaceClasses {
return getDefaultId(workspaceClasses);
}

// todo: remove this once pvc has been rolled out
if (previousWorkspaceClass.endsWith("-pvc")) {
return previousWorkspaceClass;
}

const config = workspaceClasses.find((c) => c.id === previousWorkspaceClass);
if (!config) {
log.error(
Expand Down Expand Up @@ -186,6 +191,11 @@ export namespace WorkspaceClasses {
const current = classes.find((c) => c.id === currentClassId);
let substitute = classes.find((c) => c.id === substituteClassId);

// todo: remove this once pvc has been rolled out
if (currentClassId.endsWith("-pvc")) {
return currentClassId;
}

if (current?.marker?.moreResources) {
if (substitute?.marker?.moreResources) {
return substitute?.id;
Expand Down
17 changes: 14 additions & 3 deletions components/server/src/workspace/workspace-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,20 @@ export class WorkspaceStarter {

featureFlags = featureFlags.concat(["workspace_class_limiting"]);
} else {
workspaceClass = "default";
if (await this.entitlementService.userGetsMoreResources(user)) {
workspaceClass = "gitpodio-internal-xl";
// todo: remove this once pvc has been rolled out
const prebuildClass = await WorkspaceClasses.getFromPrebuild(
ctx,
workspace,
this.workspaceDb.trace(ctx),
);
if (prebuildClass?.endsWith("-pvc")) {
workspaceClass = prebuildClass;
// ####
} else {
workspaceClass = "default";
if (await this.entitlementService.userGetsMoreResources(user)) {
workspaceClass = "gitpodio-internal-xl";
}
}
}

Expand Down

0 comments on commit 7458a10

Please sign in to comment.