diff --git a/src/common/cluster-store.ts b/src/common/cluster-store.ts index 6cfc4fb7db..a382006cdc 100644 --- a/src/common/cluster-store.ts +++ b/src/common/cluster-store.ts @@ -129,10 +129,6 @@ export class ClusterStore extends BaseStore { return this.clusters.size > 0; } - hasContextInWorkspace(name: string, workspaceId: string) { - return this.clustersList.some(cluster => cluster.contextName === name && cluster.workspace === workspaceId); - } - getById(id: ClusterId): Cluster { return this.clusters.get(id); } diff --git a/src/common/cluster-store_test.ts b/src/common/cluster-store_test.ts index 77eb688cfc..3c0369def3 100644 --- a/src/common/cluster-store_test.ts +++ b/src/common/cluster-store_test.ts @@ -198,13 +198,6 @@ describe("config with existing clusters", () => { expect(storedClusters[1].preferences.terminalCWD).toBe('/foo2') expect(storedClusters[2].id).toBe('cluster3') }) - - it("allows to test if store already has context in workspace", async () => { - const existingContext = clusterStore.hasContextInWorkspace('foo', 'default'); - expect(existingContext).toBeTruthy - const nonExistingContext = clusterStore.hasContextInWorkspace('foo2', 'foo'); - expect(existingContext).toBeFalsy - }) }) describe("pre 2.0 config with an existing cluster", () => { diff --git a/src/renderer/components/+add-cluster/add-cluster.tsx b/src/renderer/components/+add-cluster/add-cluster.tsx index 4dd5371973..a0414541d8 100644 --- a/src/renderer/components/+add-cluster/add-cluster.tsx +++ b/src/renderer/components/+add-cluster/add-cluster.tsx @@ -99,10 +99,7 @@ export class AddCluster extends React.Component { getContexts(config: KubeConfig): Map { const contexts = new Map(); splitConfig(config).forEach(config => { - const isExists = clusterStore.hasContextInWorkspace(config.currentContext, workspaceStore.currentWorkspaceId); - if (!isExists) { - contexts.set(config.currentContext, config); - } + contexts.set(config.currentContext, config); }) return contexts }