Skip to content

# Class: Cluster

Cluster

`beta`

## Hierarchy

- Cluster

## Implements

- ClusterModel
- ClusterState

## Index

### Constructors

- constructor

### Properties

- accessible
- accessibleNamespaces
- activated
- allowedNamespaces
- allowedResources
- apiUrl
- contextHandler
- contextName
- disconnected
- enabled
- eventDisposers
- failureReason
- id
- initialized
- initializing
- isAdmin
- kubeConfigPath
- kubeCtl
- kubeProxyUrl
- kubeconfigManager
- metadata
- online
- ownerRef
- preferences
- ready
- reconnecting
- whenInitialized
- whenReady
- workspace

### Accessors

- available
- isManaged
- name
- prometheusPreferences
- version

### Methods

- activate
- bindEvents
- canI
- disconnect
- ensureKubectl
- getAllowedNamespaces
- getAllowedResources
- getConnectionStatus
- getKubeconfig
- getMeta
- getMetrics
- getProxyKubeconfig
- getProxyKubeconfigPath
- getState
- init
- isClusterAdmin
- k8sRequest
- pushState
- reconnect
- refresh
- refreshAllowedResources
- refreshConnectionStatus
- refreshMetadata
- setState
- toJSON
- unbindEvents
- updateModel

## Constructors

### constructor

+ new Cluster(`model`: ClusterModel): Cluster

Defined in src/main/cluster.ts:249

Parameters:

Name | Type
--- | ---
`model` | ClusterModel

Returns: Cluster

## Properties

### accessible

• accessible: boolean = false

Defined in src/main/cluster.ts:149

Can user access cluster resources

`observable`

### accessibleNamespaces

• accessibleNamespaces: string[] = []

Implementation of ClusterModel.accessibleNamespaces

Defined in src/main/cluster.ts:210

List of accessible namespaces

`observable`

### `Protected` activated

• activated: boolean = false

Defined in src/main/cluster.ts:81

### allowedNamespaces

• allowedNamespaces: string[] = []

Defined in src/main/cluster.ts:197

List of allowed namespaces

`observable`

### allowedResources

• allowedResources: string[] = []

Defined in src/main/cluster.ts:204

List of allowed resources

`observable`

`internal`

### apiUrl

• apiUrl: string

Defined in src/main/cluster.ts:124

Kubernetes API server URL

`observable`

### contextHandler

• contextHandler: ContextHandler

Defined in src/main/cluster.ts:72

Context handler

`internal`

### contextName

• contextName: string

Implementation of ClusterModel.contextName

Defined in src/main/cluster.ts:106

Kubeconfig context name

`observable`

### disconnected

• disconnected: boolean = true

Defined in src/main/cluster.ts:167

Is cluster disconnected. False if user has selected to connect.

`observable`

### enabled

• enabled: boolean = false

Defined in src/main/cluster.ts:137

Is cluster instance enabled (disabled clusters are currently hidden)

`observable`

### `Protected` eventDisposers

• eventDisposers: Function[] = []

Defined in src/main/cluster.ts:80

### failureReason

• failureReason: string

Defined in src/main/cluster.ts:173

Connection failure reason

`observable`

### id

• id: ClusterId

Implementation of ClusterModel.id

Defined in src/main/cluster.ts:60

Unique id for a cluster

### initialized

• initialized: boolean = false

Defined in src/main/cluster.ts:100

Is cluster object initialized

`observable`

### initializing

• initializing: boolean = false

Defined in src/main/cluster.ts:92

Is cluster object initializinng on-going

`observable`

### isAdmin

• isAdmin: boolean = false

Defined in src/main/cluster.ts:179

Does user have admin like access

`observable`

### kubeConfigPath

• kubeConfigPath: string

Implementation of ClusterModel.kubeConfigPath

Defined in src/main/cluster.ts:118

Path to kubeconfig

`observable`

### kubeCtl

• kubeCtl: Kubectl

Defined in src/main/cluster.ts:66

Kubectl

`internal`

### kubeProxyUrl

• kubeProxyUrl: string

Defined in src/main/cluster.ts:131

Internal authentication proxy URL

`observable`

`internal`

### `Protected` kubeconfigManager

• kubeconfigManager: KubeconfigManager

Defined in src/main/cluster.ts:79

### metadata

• metadata: ClusterMetadata

Implementation of ClusterModel.metadata

Defined in src/main/cluster.ts:191

Metadata

`observable`

### online

• online: boolean = false

Defined in src/main/cluster.ts:143

Is cluster online

`observable`

### ownerRef

• ownerRef: string

Implementation of ClusterModel.ownerRef

Defined in src/main/cluster.ts:78

Owner reference

If extension sets this it needs to also mark cluster as enabled on activate (or when added to a store)

### preferences

• preferences: ClusterPreferences

Implementation of ClusterModel.preferences

Defined in src/main/cluster.ts:185

Preferences

`observable`

### ready

• ready: boolean = false

Defined in src/main/cluster.ts:155

Is cluster instance in usable state

`observable`

### reconnecting

• reconnecting: boolean = false

Defined in src/main/cluster.ts:161

Is cluster currently reconnecting

`observable`

### whenInitialized

• whenInitialized: Promise‹void› & object = when(() => this.initialized)

Defined in src/main/cluster.ts:84

### whenReady

• whenReady: Promise‹void› & object = when(() => this.ready)

Defined in src/main/cluster.ts:85

### workspace

• workspace: WorkspaceId

Implementation of ClusterModel.workspace

Defined in src/main/cluster.ts:112

Workspace id

`observable`

## Accessors

### available

• get available(): boolean

Defined in src/main/cluster.ts:217

Is cluster available

`computed`

Returns: boolean

### isManaged

• get isManaged(): boolean

Defined in src/main/cluster.ts:263

Is cluster managed by an extension

Returns: boolean

### name

• get name(): string

Defined in src/main/cluster.ts:226

Cluster name

`computed`

Returns: string

### prometheusPreferences

• get prometheusPreferences(): ClusterPrometheusPreferences

Defined in src/main/cluster.ts:236

Prometheus preferences

`computed`

`internal`

Returns: ClusterPrometheusPreferences

### version

• get version(): string

Defined in src/main/cluster.ts:247

Kubernetes version

Returns: string

## Methods

### activate

▸ activate(`force`: boolean): Promise‹void›

Defined in src/main/cluster.ts:337

`internal`

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`force` | boolean | false | force activation

Returns: Promise‹void›

### `Protected` bindEvents

▸ bindEvents(): void

Defined in src/main/cluster.ts:307

`internal`

Returns: void

### canI

▸ canI(`resourceAttributes`: V1ResourceAttributes): Promise‹boolean›

Defined in src/main/cluster.ts:538

`internal`

Parameters:

Name | Type | Description
--- | --- | ---
`resourceAttributes` | V1ResourceAttributes | resource attributes

Returns: Promise‹boolean›

### disconnect

▸ disconnect(): void

Defined in src/main/cluster.ts:386

`internal`

Returns: void

### `Protected` ensureKubectl

▸ ensureKubectl(): Promise‹boolean›

Defined in src/main/cluster.ts:367

`internal`

Returns: Promise‹boolean›

### `Protected` getAllowedNamespaces

▸ getAllowedNamespaces(): Promise‹string[]›

Defined in src/main/cluster.ts:637

Returns: Promise‹string[]›

### `Protected` getAllowedResources

▸ getAllowedResources(): Promise‹("namespaces" | "nodes" | "events" | "resourcequotas" | "services" | "secrets" | "configmaps" | "ingresses" | "networkpolicies" | "persistentvolumeclaims" | "persistentvolumes" | "storageclasses" | "pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "jobs" | "cronjobs" | "endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets")[]›

Defined in src/main/cluster.ts:657

Returns: Promise‹("namespaces" | "nodes" | "events" | "resourcequotas" | "services" | "secrets" | "configmaps" | "ingresses" | "networkpolicies" | "persistentvolumeclaims" | "persistentvolumes" | "storageclasses" | "pods" | "daemonsets" | "deployments" | "statefulsets" | "replicasets" | "jobs" | "cronjobs" | "endpoints" | "customresourcedefinitions" | "horizontalpodautoscalers" | "podsecuritypolicies" | "poddisruptionbudgets")[]›

### `Protected` getConnectionStatus

▸ getConnectionStatus(): Promise‹ClusterStatus›

Defined in src/main/cluster.ts:494

Returns: Promise‹ClusterStatus›

### `Protected` getKubeconfig

▸ getKubeconfig(): KubeConfig

Defined in src/main/cluster.ts:449

Returns: KubeConfig

### getMeta

▸ getMeta(): object

Defined in src/main/cluster.ts:625

Returns: object

- accessible: boolean = this.accessible

- disconnected: boolean = this.disconnected

- id: string = this.id

- initialized: boolean = this.initialized

- name: string = this.contextName

- online: boolean = this.online

- ready: boolean = this.ready

### getMetrics

▸ getMetrics(`prometheusPath`: string, `queryParams`: IMetricsReqParams & object): Promise‹any›

Defined in src/main/cluster.ts:482

`internal`

Parameters:

Name | Type | Description
--- | --- | ---
`prometheusPath` | string | path to prometheus service
`queryParams` | IMetricsReqParams & object | query parameters

Returns: Promise‹any›

### getProxyKubeconfig

▸ getProxyKubeconfig(): KubeConfig

Defined in src/main/cluster.ts:456

`internal`

Returns: KubeConfig

### getProxyKubeconfigPath

▸ getProxyKubeconfigPath(): string

Defined in src/main/cluster.ts:463

`internal`

Returns: string

### getState

▸ getState(): ClusterState

Defined in src/main/cluster.ts:587

Serializable cluster-state used for sync btw main <-> renderer

Returns: ClusterState

### init

▸ init(`port`: number): Promise‹void›

Defined in src/main/cluster.ts:282

Initialize a cluster (can be done only in main process)

`internal`

Parameters:

Name | Type | Description
--- | --- | ---
`port` | number | port where internal auth proxy is listening

Returns: Promise‹void›

### isClusterAdmin

▸ isClusterAdmin(): Promise‹boolean›

Defined in src/main/cluster.ts:559

`internal`

Returns: Promise‹boolean›

### `Protected` k8sRequest

▸ k8sRequest‹T›(`path`: string, `options`: RequestPromiseOptions): Promise‹T›

Defined in src/main/cluster.ts:467

Type parameters:

▪ T

Parameters:

Name | Type | Default
--- | --- | ---
`path` | string | -
`options` | RequestPromiseOptions | {}

Returns: Promise‹T›

### pushState

▸ pushState(`state`: ClusterState): void

Defined in src/main/cluster.ts:619

`internal`

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`state` | ClusterState | this.getState() | cluster state

Returns: void

### reconnect

▸ reconnect(): Promise‹void›

Defined in src/main/cluster.ts:376

`internal`

Returns: Promise‹void›

### refresh

▸ refresh(`opts`: ClusterRefreshOptions): Promise‹void›

Defined in src/main/cluster.ts:403

`internal`

Parameters:

Name | Type | Default | Description
--- | --- | --- | ---
`opts` | ClusterRefreshOptions | {} | refresh options

Returns: Promise‹void›

### refreshAllowedResources

▸ refreshAllowedResources(): Promise‹void›

Defined in src/main/cluster.ts:444

`internal`

Returns: Promise‹void›

### refreshConnectionStatus

▸ refreshConnectionStatus(): Promise‹void›

Defined in src/main/cluster.ts:434

`internal`

Returns: Promise‹void›

### refreshMetadata

▸ refreshMetadata(): Promise‹void›

Defined in src/main/cluster.ts:423

`internal`

Returns: Promise‹void›

### setState

▸ setState(`state`: ClusterState): void

Defined in src/main/cluster.ts:611

`internal`

Parameters:

Name | Type | Description
--- | --- | ---
`state` | ClusterState | cluster state

Returns: void

### toJSON

▸ toJSON(): ClusterModel

Defined in src/main/cluster.ts:567

Returns: ClusterModel

### `Protected` unbindEvents

▸ unbindEvents(): void

Defined in src/main/cluster.ts:327

internal

Returns: void

### updateModel

▸ updateModel(`model`: ClusterModel): void

Defined in src/main/cluster.ts:272

Update cluster data model

Parameters:

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

Returns: void