mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
back to public
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
350f87e065
commit
71a5516e0b
@ -393,8 +393,10 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
this.pushState();
|
this.pushState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
/**
|
||||||
protected async refreshMetadata() {
|
* @internal
|
||||||
|
*/
|
||||||
|
@action async refreshMetadata() {
|
||||||
logger.info(`[CLUSTER]: refreshMetadata`, this.getMeta());
|
logger.info(`[CLUSTER]: refreshMetadata`, this.getMeta());
|
||||||
const metadata = await detectorRegistry.detectForCluster(this);
|
const metadata = await detectorRegistry.detectForCluster(this);
|
||||||
const existingMetadata = this.metadata;
|
const existingMetadata = this.metadata;
|
||||||
@ -410,8 +412,10 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
this.accessible = connectionStatus == ClusterStatus.AccessGranted;
|
this.accessible = connectionStatus == ClusterStatus.AccessGranted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
/**
|
||||||
protected async refreshAllowedResources() {
|
* @internal
|
||||||
|
*/
|
||||||
|
@action async refreshAllowedResources() {
|
||||||
this.allowedNamespaces = await this.getAllowedNamespaces();
|
this.allowedNamespaces = await this.getAllowedNamespaces();
|
||||||
this.allowedResources = await this.getAllowedResources();
|
this.allowedResources = await this.getAllowedResources();
|
||||||
}
|
}
|
||||||
@ -490,7 +494,11 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async canI(resourceAttributes: V1ResourceAttributes): Promise<boolean> {
|
/**
|
||||||
|
* @internal
|
||||||
|
* @param resourceAttributes resource attributes
|
||||||
|
*/
|
||||||
|
async canI(resourceAttributes: V1ResourceAttributes): Promise<boolean> {
|
||||||
const authApi = this.getProxyKubeconfig().makeApiClient(AuthorizationV1Api);
|
const authApi = this.getProxyKubeconfig().makeApiClient(AuthorizationV1Api);
|
||||||
try {
|
try {
|
||||||
const accessReview = await authApi.createSelfSubjectAccessReview({
|
const accessReview = await authApi.createSelfSubjectAccessReview({
|
||||||
@ -505,7 +513,10 @@ export class Cluster implements ClusterModel, ClusterState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async isClusterAdmin(): Promise<boolean> {
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
async isClusterAdmin(): Promise<boolean> {
|
||||||
return this.canI({
|
return this.canI({
|
||||||
namespace: "kube-system",
|
namespace: "kube-system",
|
||||||
resource: "*",
|
resource: "*",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user