Skip to content

[ws-manager] Revert #14000 #14029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions components/gitpod-protocol/src/workspace-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export interface WorkspaceClusterDB {
*/
findFiltered(predicate: DeepPartial<WorkspaceClusterFilter>): Promise<WorkspaceClusterWoTLS[]>;
}
export interface WorkspaceClusterFilter
extends Pick<WorkspaceCluster, "name" | "state" | "govern" | "url" | "applicationCluster"> {
export interface WorkspaceClusterFilter extends Pick<WorkspaceCluster, "state" | "govern" | "url"> {
minScore: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ export interface WorkspaceManagerClientProviderSource {
getAllWorkspaceClusters(): Promise<WorkspaceClusterWoTLS[]>;
}


@injectable()
export class WorkspaceManagerClientProviderEnvSource implements WorkspaceManagerClientProviderSource {
protected _clusters: WorkspaceCluster[] | undefined = undefined;
readonly applicationCluster = process.env.GITPOD_INSTALLATION_SHORTNAME ?? "";

public async getWorkspaceCluster(name: string): Promise<WorkspaceCluster | undefined> {
return this.clusters.find((m) => m.name === name && m.applicationCluster === this.applicationCluster);
return this.clusters.find(m => m.name === name);
}

public async getAllWorkspaceClusters(): Promise<WorkspaceClusterWoTLS[]> {
return this.clusters.filter((m) => m.applicationCluster === this.applicationCluster) ?? [];
return this.clusters;
}

protected get clusters(): WorkspaceCluster[] {
Expand Down Expand Up @@ -63,14 +63,13 @@ export class WorkspaceManagerClientProviderEnvSource implements WorkspaceManager
export class WorkspaceManagerClientProviderDBSource implements WorkspaceManagerClientProviderSource {
@inject(WorkspaceClusterDB)
protected readonly db: WorkspaceClusterDB;
readonly applicationCluster = process.env.GITPOD_INSTALLATION_SHORTNAME ?? "";

public async getWorkspaceCluster(name: string): Promise<WorkspaceCluster | undefined> {
return (await this.db.findFiltered({ name, applicationCluster: this.applicationCluster }))[0];
return await this.db.findByName(name);
}

public async getAllWorkspaceClusters(): Promise<WorkspaceClusterWoTLS[]> {
return await this.db.findFiltered({ applicationCluster: this.applicationCluster });
return await this.db.findFiltered({});
}
}

Expand Down Expand Up @@ -106,4 +105,4 @@ export class WorkspaceManagerClientProviderCompositeSource implements WorkspaceM
}
return result;
}
}
}