Skip to content

# Class: ClusterStore

Store for all added clusters

`beta`

## Hierarchy

- Singleton

↳ ClusterStore

## Index

### Accessors

- activeCluster
- activeClusterId
- clusters
- clustersList
- connectedClustersList
- enabledClustersList

### Methods

- addCluster
- addClusters
- getById
- getByWorkspaceId
- removeById
- removeByWorkspaceId
- removeCluster
- getInstance
- resetInstance

## Accessors

### activeCluster

• get activeCluster(): Cluster

Defined in src/extensions/stores/cluster-store.ts:50

Get active cluster (a cluster which is currently visible)

`deprecated` use `clusterStore.getById(workspaceStore.currentWorkspace.activeClusterId)`

Returns: Cluster

### activeClusterId

• get activeClusterId(): string

Defined in src/extensions/stores/cluster-store.ts:23

Active cluster id

`deprecated` use `workspaceStore.currentWorkspace.activeClusterId`

Returns: string

• set activeClusterId(`id`: ClusterId): void

Defined in src/extensions/stores/cluster-store.ts:33

Set active cluster id

`deprecated` use `LensExtension.navigate()`

Parameters:

Name | Type
--- | ---
`id` | ClusterId

Returns: void

### clusters

• get clusters(): ObservableMap‹string, Cluster›

Defined in src/extensions/stores/cluster-store.ts:41

Map of all clusters

Returns: ObservableMap‹string, Cluster›

### clustersList

• get clustersList(): Cluster[]

Defined in src/extensions/stores/cluster-store.ts:57

Array of all clusters

Returns: Cluster[]

### connectedClustersList

• get connectedClustersList(): Cluster[]

Defined in src/extensions/stores/cluster-store.ts:71

Array of all clusters that have active connection to a Kubernetes cluster

Returns: Cluster[]

### enabledClustersList

• get enabledClustersList(): Cluster[]

Defined in src/extensions/stores/cluster-store.ts:64

Array of all enabled clusters

Returns: Cluster[]

## Methods

### addCluster

▸ addCluster(`model`: ClusterModel | Cluster): Cluster

Defined in src/extensions/stores/cluster-store.ts:103

Add a cluster to store

Parameters:

Name | Type | Description
--- | --- | ---
`model` | ClusterModel | Cluster | cluster

Returns: Cluster

### addClusters

▸ addClusters(...`models`: ClusterModel[]): Cluster[]

Defined in src/extensions/stores/cluster-store.ts:95

Add clusters to store

Parameters:

Name | Type | Description
--- | --- | ---
`...models` | ClusterModel[] | list of cluster models

Returns: Cluster[]

### getById

▸ getById(`id`: ClusterId): Cluster

Defined in src/extensions/stores/cluster-store.ts:79

Get cluster object by cluster id

Parameters:

Name | Type | Description
--- | --- | ---
`id` | ClusterId | cluster id

Returns: Cluster

### getByWorkspaceId

▸ getByWorkspaceId(`workspaceId`: string): Cluster[]

Defined in src/extensions/stores/cluster-store.ts:87

Get all clusters belonging to a workspace

Parameters:

Name | Type | Description
--- | --- | ---
`workspaceId` | string | workspace id

Returns: Cluster[]

### removeById

▸ removeById(`clusterId`: ClusterId): Promise‹void›

Defined in src/extensions/stores/cluster-store.ts:119

Remove a cluster from store by id

Parameters:

Name | Type | Description
--- | --- | ---
`clusterId` | ClusterId | cluster id

Returns: Promise‹void›

### removeByWorkspaceId

▸ removeByWorkspaceId(`workspaceId`: string): void

Defined in src/extensions/stores/cluster-store.ts:127

Remove all clusters belonging to a workspaces

Parameters:

Name | Type | Description
--- | --- | ---
`workspaceId` | string | workspace id

Returns: void

### removeCluster

▸ removeCluster(`model`: ClusterModel): Promise‹void›

Defined in src/extensions/stores/cluster-store.ts:111

Remove a cluster from store

Parameters:

Name | Type | Description
--- | --- | ---
`model` | ClusterModel | cluster

Returns: Promise‹void›

### `Static` getInstance

▸ getInstance‹T›(...`args`: ConstructorParameters‹Constructor‹T››): T

Inherited from ExtensionStore.getInstance

Defined in src/common/utils/singleton.ts:15

Type parameters:

▪ T

Parameters:

Name | Type
--- | ---
`...args` | ConstructorParameters‹Constructor‹T››

Returns: T

### `Static` resetInstance

▸ resetInstance(): void

Inherited from ExtensionStore.resetInstance

Defined in src/common/utils/singleton.ts:23

Returns: void