@@ -14,17 +14,17 @@ export interface WorkspaceManagerClientProviderSource {
14
14
getAllWorkspaceClusters ( ) : Promise < WorkspaceClusterWoTLS [ ] > ;
15
15
}
16
16
17
-
18
17
@injectable ( )
19
18
export class WorkspaceManagerClientProviderEnvSource implements WorkspaceManagerClientProviderSource {
20
19
protected _clusters : WorkspaceCluster [ ] | undefined = undefined ;
20
+ readonly applicationCluster = process . env . GITPOD_INSTALLATION_SHORTNAME ?? "" ;
21
21
22
22
public async getWorkspaceCluster ( name : string ) : Promise < WorkspaceCluster | undefined > {
23
- return this . clusters . find ( m => m . name === name ) ;
23
+ return this . clusters . find ( ( m ) => m . name === name && m . applicationCluster === this . applicationCluster ) ;
24
24
}
25
25
26
26
public async getAllWorkspaceClusters ( ) : Promise < WorkspaceClusterWoTLS [ ] > {
27
- return this . clusters ;
27
+ return this . clusters . filter ( ( m ) => m . applicationCluster === this . applicationCluster ) ?? [ ] ;
28
28
}
29
29
30
30
protected get clusters ( ) : WorkspaceCluster [ ] {
@@ -63,13 +63,14 @@ export class WorkspaceManagerClientProviderEnvSource implements WorkspaceManager
63
63
export class WorkspaceManagerClientProviderDBSource implements WorkspaceManagerClientProviderSource {
64
64
@inject ( WorkspaceClusterDB )
65
65
protected readonly db : WorkspaceClusterDB ;
66
+ readonly applicationCluster = process . env . GITPOD_INSTALLATION_SHORTNAME ?? "" ;
66
67
67
68
public async getWorkspaceCluster ( name : string ) : Promise < WorkspaceCluster | undefined > {
68
- return await this . db . findByName ( name ) ;
69
+ return ( await this . db . findFiltered ( { name, applicationCluster : this . applicationCluster } ) ) [ 0 ] ;
69
70
}
70
71
71
72
public async getAllWorkspaceClusters ( ) : Promise < WorkspaceClusterWoTLS [ ] > {
72
- return await this . db . findFiltered ( { } ) ;
73
+ return await this . db . findFiltered ( { applicationCluster : this . applicationCluster } ) ;
73
74
}
74
75
}
75
76
@@ -105,4 +106,4 @@ export class WorkspaceManagerClientProviderCompositeSource implements WorkspaceM
105
106
}
106
107
return result ;
107
108
}
108
- }
109
+ }
0 commit comments