Class: Cluster#
Cluster
beta
Hierarchy#
- Cluster
Implements#
- ClusterModel
- ClusterState
Index#
Constructors#
Properties#
- accessible
- accessibleNamespaces
- activated
- allowedNamespaces
- allowedResources
- apiUrl
- contextHandler
- contextName
- disconnected
- enabled
- eventDisposers
- failureReason
- getAllowedNamespacesErrorCount
- id
- initialized
- initializing
- isAdmin
- isGlobalWatchEnabled
- kubeConfigPath
- kubeCtl
- kubeProxyUrl
- kubeconfigManager
- metadata
- online
- ownerRef
- preferences
- ready
- reconnecting
- whenInitialized
- whenReady
- workspace
Accessors#
Methods#
- activate
- bindEvents
- canI
- canUseWatchApi
- disconnect
- ensureKubectl
- getAllowedNamespaces
- getAllowedResources
- getConnectionStatus
- getKubeconfig
- getMeta
- getMetrics
- getProxyKubeconfig
- getProxyKubeconfigPath
- getState
- init
- isAllowedResource
- isClusterAdmin
- isMetricHidden
- k8sRequest
- pushState
- reconnect
- refresh
- refreshAllowedResources
- refreshConnectionStatus
- refreshMetadata
- setState
- toJSON
- unbindEvents
- updateModel
Constructors#
constructor#
+ new Cluster(model
: ClusterModel): Cluster
Defined in src/main/cluster.ts:257
Parameters:
Name | Type |
---|---|
model |
ClusterModel |
Returns: Cluster
Properties#
accessible#
• accessible: boolean = false
Defined in src/main/cluster.ts:150
Can user access cluster resources
observable
accessibleNamespaces#
• accessibleNamespaces: string[] = []
Implementation of ClusterModel.accessibleNamespaces
Defined in src/main/cluster.ts:218
List of accessible namespaces provided by user in the Cluster Settings
observable
Protected
activated#
• activated: boolean = false
Defined in src/main/cluster.ts:83
allowedNamespaces#
• allowedNamespaces: string[] = []
Defined in src/main/cluster.ts:205
List of allowed namespaces verified via K8S::SelfSubjectAccessReview api
observable
allowedResources#
• allowedResources: string[] = []
Defined in src/main/cluster.ts:212
List of allowed resources
observable
internal
apiUrl#
• apiUrl: string
Defined in src/main/cluster.ts:125
Kubernetes API server URL
observable
contextHandler#
• contextHandler: ContextHandler
Defined in src/main/cluster.ts:74
Context handler
internal
contextName#
• contextName: string
Implementation of ClusterModel.contextName
Defined in src/main/cluster.ts:107
Kubeconfig context name
observable
disconnected#
• disconnected: boolean = true
Defined in src/main/cluster.ts:168
Is cluster disconnected. False if user has selected to connect.
observable
enabled#
• enabled: boolean = false
Defined in src/main/cluster.ts:138
Is cluster instance enabled (disabled clusters are currently hidden)
observable
Protected
eventDisposers#
• eventDisposers: Function[] = []
Defined in src/main/cluster.ts:82
failureReason#
• failureReason: string
Defined in src/main/cluster.ts:174
Connection failure reason
observable
Protected
getAllowedNamespacesErrorCount#
• getAllowedNamespacesErrorCount: number = 0
Defined in src/main/cluster.ts:685
id#
• id: ClusterId
Implementation of ClusterModel.id
Defined in src/main/cluster.ts:62
Unique id for a cluster
initialized#
• initialized: boolean = false
Defined in src/main/cluster.ts:101
Is cluster object initialized
observable
initializing#
• initializing: boolean = false
Defined in src/main/cluster.ts:94
Is cluster object initializinng on-going
observable
isAdmin#
• isAdmin: boolean = false
Defined in src/main/cluster.ts:180
Does user have admin like access
observable
isGlobalWatchEnabled#
• isGlobalWatchEnabled: boolean = false
Defined in src/main/cluster.ts:187
Global watch-api accessibility , e.g. "/api/v1/services?watch=1"
observable
kubeConfigPath#
• kubeConfigPath: string
Implementation of ClusterModel.kubeConfigPath
Defined in src/main/cluster.ts:119
Path to kubeconfig
observable
kubeCtl#
• kubeCtl: Kubectl
Defined in src/main/cluster.ts:68
Kubectl
internal
kubeProxyUrl#
• kubeProxyUrl: string
Defined in src/main/cluster.ts:132
Internal authentication proxy URL
observable
internal
Protected
kubeconfigManager#
• kubeconfigManager: KubeconfigManager
Defined in src/main/cluster.ts:81
metadata#
• metadata: ClusterMetadata
Implementation of ClusterModel.metadata
Defined in src/main/cluster.ts:199
Metadata
observable
online#
• online: boolean = false
Defined in src/main/cluster.ts:144
Is cluster online
observable
ownerRef#
• ownerRef: string
Implementation of ClusterModel.ownerRef
Defined in src/main/cluster.ts:80
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:193
Preferences
observable
ready#
• ready: boolean = false
Defined in src/main/cluster.ts:156
Is cluster instance in usable state
observable
reconnecting#
• reconnecting: boolean = false
Defined in src/main/cluster.ts:162
Is cluster currently reconnecting
observable
whenInitialized#
• whenInitialized: Promise‹void› & object = when(() => this.initialized)
Defined in src/main/cluster.ts:86
whenReady#
• whenReady: Promise‹void› & object = when(() => this.ready)
Defined in src/main/cluster.ts:87
workspace#
• workspace: WorkspaceId
Implementation of ClusterModel.workspace
Defined in src/main/cluster.ts:113
Workspace id
observable
Accessors#
available#
• get available(): boolean
Defined in src/main/cluster.ts:225
Is cluster available
computed
Returns: boolean
isManaged#
• get isManaged(): boolean
Defined in src/main/cluster.ts:277
Is cluster managed by an extension
Returns: boolean
name#
• get name(): string
Defined in src/main/cluster.ts:234
Cluster name
computed
Returns: string
prometheusPreferences#
• get prometheusPreferences(): ClusterPrometheusPreferences
Defined in src/main/cluster.ts:244
Prometheus preferences
computed
internal
Returns: ClusterPrometheusPreferences
version#
• get version(): string
Defined in src/main/cluster.ts:255
Kubernetes version
Returns: string
Methods#
activate#
▸ activate(force
: boolean): Promise‹void›
Defined in src/main/cluster.ts:357
internal
Parameters:
Name | Type | Default | Description |
---|---|---|---|
force |
boolean | false | force activation |
Returns: Promise‹void›
Protected
bindEvents#
▸ bindEvents(): void
Defined in src/main/cluster.ts:326
internal
Returns: void
canI#
▸ canI(resourceAttributes
: V1ResourceAttributes): Promise‹boolean›
Defined in src/main/cluster.ts:574
internal
Parameters:
Name | Type | Description |
---|---|---|
resourceAttributes |
V1ResourceAttributes | resource attributes |
Returns: Promise‹boolean›
canUseWatchApi#
▸ canUseWatchApi(customizeResource
: V1ResourceAttributes): Promise‹boolean›
Defined in src/main/cluster.ts:606
internal
Parameters:
Name | Type | Default |
---|---|---|
customizeResource |
V1ResourceAttributes | {} |
Returns: Promise‹boolean›
disconnect#
▸ disconnect(): void
Defined in src/main/cluster.ts:405
internal
Returns: void
Protected
ensureKubectl#
▸ ensureKubectl(): Promise‹boolean›
Defined in src/main/cluster.ts:385
internal
Returns: Promise‹boolean›
Protected
getAllowedNamespaces#
▸ getAllowedNamespaces(): Promise‹string[]›
Defined in src/main/cluster.ts:687
Returns: Promise‹string[]›
Protected
getAllowedResources#
▸ getAllowedResources(): Promise‹("namespaces" | "nodes" | "events" | "resourcequotas" | "services" | "limitranges" | "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:722
Returns: Promise‹("namespaces" | "nodes" | "events" | "resourcequotas" | "services" | "limitranges" | "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:530
Returns: Promise‹ClusterStatus›
Protected
getKubeconfig#
▸ getKubeconfig(): KubeConfig
Defined in src/main/cluster.ts:483
Returns: KubeConfig
getMeta#
▸ getMeta(): object
Defined in src/main/cluster.ts:673
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:518
internal
Parameters:
Name | Type | Description |
---|---|---|
prometheusPath |
string | path to prometheus service |
queryParams |
IMetricsReqParams & object | query parameters |
Returns: Promise‹any›
getProxyKubeconfig#
▸ getProxyKubeconfig(): Promise‹KubeConfig›
Defined in src/main/cluster.ts:490
internal
Returns: Promise‹KubeConfig›
getProxyKubeconfigPath#
▸ getProxyKubeconfigPath(): Promise‹string›
Defined in src/main/cluster.ts:499
internal
Returns: Promise‹string›
getState#
▸ getState(): ClusterState
Defined in src/main/cluster.ts:634
Serializable cluster-state used for sync btw main <-> renderer
Returns: ClusterState
init#
▸ init(port
: number): Promise‹void›
Defined in src/main/cluster.ts:297
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›
isAllowedResource#
▸ isAllowedResource(kind
: string): boolean
Defined in src/main/cluster.ts:757
Parameters:
Name | Type |
---|---|
kind |
string |
Returns: boolean
isClusterAdmin#
▸ isClusterAdmin(): Promise‹boolean›
Defined in src/main/cluster.ts:595
internal
Returns: Promise‹boolean›
isMetricHidden#
▸ isMetricHidden(resource
: ResourceType): boolean
Defined in src/main/cluster.ts:319
Parameters:
Name | Type |
---|---|
resource |
ResourceType |
Returns: boolean
Protected
k8sRequest#
▸ k8sRequest‹T›(path
: string, options
: RequestPromiseOptions): Promise‹T›
Defined in src/main/cluster.ts:503
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:667
internal
Parameters:
Name | Type | Default | Description |
---|---|---|---|
state |
ClusterState | this.getState() | cluster state |
Returns: void
reconnect#
▸ reconnect(): Promise‹void›
Defined in src/main/cluster.ts:395
internal
Returns: Promise‹void›
refresh#
▸ refresh(opts
: ClusterRefreshOptions): Promise‹void›
Defined in src/main/cluster.ts:424
internal
Parameters:
Name | Type | Default | Description |
---|---|---|---|
opts |
ClusterRefreshOptions | {} | refresh options |
Returns: Promise‹void›
refreshAllowedResources#
▸ refreshAllowedResources(): Promise‹void›
Defined in src/main/cluster.ts:478
internal
Returns: Promise‹void›
refreshConnectionStatus#
▸ refreshConnectionStatus(): Promise‹void›
Defined in src/main/cluster.ts:467
internal
Returns: Promise‹void›
refreshMetadata#
▸ refreshMetadata(): Promise‹void›
Defined in src/main/cluster.ts:443
internal
Returns: Promise‹void›
setState#
▸ setState(state
: ClusterState): void
Defined in src/main/cluster.ts:659
internal
Parameters:
Name | Type | Description |
---|---|---|
state |
ClusterState | cluster state |
Returns: void
toJSON#
▸ toJSON(): ClusterModel
Defined in src/main/cluster.ts:614
Returns: ClusterModel
Protected
unbindEvents#
▸ unbindEvents(): void
Defined in src/main/cluster.ts:346
internal
Returns: void
updateModel#
▸ updateModel(model
: ClusterModel): void
Defined in src/main/cluster.ts:286
Update cluster data model
Parameters:
Name | Type | Description |
---|---|---|
model |
ClusterModel |
Returns: void