@k8slens/extensions 6.3.0-git.9c64ddd59e.0 → 6.3.0-git.aedc47551a.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/src/common/certificate-authorities/inject-system-cas.injectable.d.ts +6 -0
  2. package/dist/src/common/certificate-authorities/request-system-cas-token.d.ts +5 -0
  3. package/dist/src/common/certificate-authorities/request-system-cas.injectable.darwin.d.ts +2 -0
  4. package/dist/src/common/certificate-authorities/request-system-cas.injectable.linux.d.ts +2 -0
  5. package/dist/src/common/certificate-authorities/request-system-cas.injectable.testing-env.d.ts +2 -0
  6. package/dist/src/common/certificate-authorities/request-system-cas.injectable.win32.d.ts +2 -0
  7. package/dist/src/common/cluster/authorization-namespace-review.injectable.d.ts +19 -0
  8. package/dist/src/common/cluster/authorization-review.injectable.d.ts +8 -3
  9. package/dist/src/common/cluster/cluster.d.ts +13 -6
  10. package/dist/src/common/cluster/list-api-resources.injectable.d.ts +13 -0
  11. package/dist/src/common/cluster/visibility-channel.d.ts +7 -0
  12. package/dist/src/common/cluster-types.d.ts +0 -6
  13. package/dist/src/common/fs/exec-file.injectable.d.ts +6 -3
  14. package/dist/src/common/ipc/cluster.d.ts +0 -3
  15. package/dist/src/common/k8s/create-resource-stack.injectable.d.ts +5 -0
  16. package/dist/src/common/k8s/resource-stack.d.ts +25 -6
  17. package/dist/src/common/k8s-api/endpoints/helm-releases.api/request-update.injectable.d.ts +2 -6
  18. package/dist/src/common/kube-helpers/channels.d.ts +25 -0
  19. package/dist/src/extensions/common-api/k8s-api.d.ts +12 -1
  20. package/dist/src/extensions/extension-api.js +77 -899
  21. package/dist/src/main/cluster/manager.d.ts +2 -2
  22. package/dist/src/main/cluster/visibility-handler.injectable.d.ts +5 -0
  23. package/dist/src/main/cluster/visible-cluster.injectable.d.ts +2 -0
  24. package/dist/src/main/electron-app/runnables/setup-ipc-main-handlers/setup-ipc-main-handlers.d.ts +1 -5
  25. package/dist/src/main/helm/exec-helm/exec-env.global-override-for-injectable.d.ts +9 -0
  26. package/dist/src/main/helm/exec-helm/exec-env.injectable.d.ts +2 -0
  27. package/dist/src/main/helm/helm-service/update-helm-release.injectable.d.ts +1 -2
  28. package/dist/src/main/kubectl/apply-all-handler.injectable.d.ts +5 -0
  29. package/dist/src/main/kubectl/delete-all-handler.injectable.d.ts +5 -0
  30. package/dist/src/main/kubectl/kubectl-apply-all.injectable.d.ts +2 -0
  31. package/dist/src/main/kubectl/kubectl-delete-all.injectable.d.ts +2 -0
  32. package/dist/src/main/resource-applier/resource-applier.d.ts +6 -5
  33. package/dist/src/main/routes/resource-applier/create-resource-route.injectable.d.ts +13 -1
  34. package/dist/src/renderer/components/cluster-manager/cluster-frame-handler.d.ts +11 -1
  35. package/dist/src/renderer/components/cluster-manager/emit-cluster-visibility.injectable.d.ts +5 -0
  36. package/dist/src/renderer/components/dock/upgrade-chart/upgrade-chart-model.injectable.d.ts +2 -4
  37. package/dist/src/renderer/components/dock/upgrade-chart/view.d.ts +1 -1
  38. package/dist/src/renderer/ipc/index.d.ts +0 -8
  39. package/dist/src/renderer/kubectl/apply-all.injectable.d.ts +2 -0
  40. package/dist/src/renderer/kubectl/delete-all.injectable.d.ts +2 -0
  41. package/dist/src/test-utils/skippers.d.ts +13 -0
  42. package/package.json +1 -1
  43. package/dist/src/common/__tests__/system-ca.test.d.ts +0 -1
  44. package/dist/src/common/system-ca.d.ts +0 -24
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ declare const injectSystemCAsInjectable: import("@ogre-tools/injectable").Injectable<() => Promise<void>, unknown, void>;
6
+ export default injectSystemCAsInjectable;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ export declare const requestSystemCAsInjectionToken: import("@ogre-tools/injectable").InjectionToken<() => Promise<string[]>, void>;
@@ -0,0 +1,2 @@
1
+ declare const requestSystemCAsInjectable: import("@ogre-tools/injectable").Injectable<() => Promise<string[]>, () => Promise<string[]>, void>;
2
+ export default requestSystemCAsInjectable;
@@ -0,0 +1,2 @@
1
+ declare const requestSystemCAsInjectable: import("@ogre-tools/injectable").Injectable<() => Promise<never[]>, () => Promise<string[]>, void>;
2
+ export default requestSystemCAsInjectable;
@@ -0,0 +1,2 @@
1
+ declare const requestSystemCAsInjectable: import("@ogre-tools/injectable").Injectable<() => Promise<never[]>, () => Promise<string[]>, void>;
2
+ export default requestSystemCAsInjectable;
@@ -0,0 +1,2 @@
1
+ declare const requestSystemCAsInjectable: import("@ogre-tools/injectable").Injectable<() => Promise<string[]>, () => Promise<string[]>, void>;
2
+ export default requestSystemCAsInjectable;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ import type { KubeConfig } from "@kubernetes/client-node";
6
+ import type { KubeApiResource } from "../rbac";
7
+ /**
8
+ * Requests the permissions for actions on the kube cluster
9
+ * @param namespace The namespace of the resources
10
+ * @param availableResources List of available resources in the cluster to resolve glob values fir api groups
11
+ * @returns list of allowed resources names
12
+ */
13
+ export type RequestNamespaceResources = (namespace: string, availableResources: KubeApiResource[]) => Promise<string[]>;
14
+ /**
15
+ * @param proxyConfig This config's `currentContext` field must be set, and will be used as the target cluster
16
+ */
17
+ export type AuthorizationNamespaceReview = (proxyConfig: KubeConfig) => RequestNamespaceResources;
18
+ declare const authorizationNamespaceReviewInjectable: import("@ogre-tools/injectable").Injectable<AuthorizationNamespaceReview, unknown, void>;
19
+ export default authorizationNamespaceReviewInjectable;
@@ -3,10 +3,15 @@
3
3
  * Licensed under MIT License. See LICENSE in root directory for more information.
4
4
  */
5
5
  import type { KubeConfig, V1ResourceAttributes } from "@kubernetes/client-node";
6
+ /**
7
+ * Requests the permissions for actions on the kube cluster
8
+ * @param resourceAttributes The descriptor of the action that is desired to be known if it is allowed
9
+ * @returns `true` if the actions described are allowed
10
+ */
6
11
  export type CanI = (resourceAttributes: V1ResourceAttributes) => Promise<boolean>;
7
12
  /**
8
13
  * @param proxyConfig This config's `currentContext` field must be set, and will be used as the target cluster
9
- */
10
- export declare function authorizationReview(proxyConfig: KubeConfig): CanI;
11
- declare const authorizationReviewInjectable: import("@ogre-tools/injectable").Injectable<typeof authorizationReview, unknown, void>;
14
+ */
15
+ export type AuthorizationReview = (proxyConfig: KubeConfig) => CanI;
16
+ declare const authorizationReviewInjectable: import("@ogre-tools/injectable").Injectable<AuthorizationReview, unknown, void>;
12
17
  export default authorizationReviewInjectable;
@@ -9,13 +9,15 @@ import type { KubeconfigManager } from "../../main/kubeconfig-manager/kubeconfig
9
9
  import type { KubeResource } from "../rbac";
10
10
  import type { VersionDetector } from "../../main/cluster-detectors/version-detector";
11
11
  import type { DetectorRegistry } from "../../main/cluster-detectors/detector-registry";
12
- import type { ClusterState, ClusterRefreshOptions, ClusterMetricsResourceType, ClusterId, ClusterMetadata, ClusterModel, ClusterPreferences, ClusterPrometheusPreferences, UpdateClusterModel, ClusterConfigData } from "../cluster-types";
12
+ import type { ClusterState, ClusterMetricsResourceType, ClusterId, ClusterMetadata, ClusterModel, ClusterPreferences, ClusterPrometheusPreferences, UpdateClusterModel, ClusterConfigData } from "../cluster-types";
13
13
  import { ClusterStatus } from "../cluster-types";
14
14
  import type { CanI } from "./authorization-review.injectable";
15
15
  import type { ListNamespaces } from "./list-namespaces.injectable";
16
16
  import type { Logger } from "../logger";
17
17
  import type { BroadcastMessage } from "../ipc/broadcast-message.injectable";
18
18
  import type { LoadConfigfromFile } from "../kube-helpers/load-config-from-file.injectable";
19
+ import type { RequestNamespaceResources } from "./authorization-namespace-review.injectable";
20
+ import type { RequestListApiResources } from "./list-api-resources.injectable";
19
21
  export interface ClusterDependencies {
20
22
  readonly directoryForKubeConfigs: string;
21
23
  readonly logger: Logger;
@@ -24,6 +26,8 @@ export interface ClusterDependencies {
24
26
  createContextHandler: (cluster: Cluster) => ClusterContextHandler;
25
27
  createKubectl: (clusterVersion: string) => Kubectl;
26
28
  createAuthorizationReview: (config: KubeConfig) => CanI;
29
+ createAuthorizationNamespaceReview: (config: KubeConfig) => RequestNamespaceResources;
30
+ createListApiResources: (cluster: Cluster) => RequestListApiResources;
27
31
  createListNamespaces: (config: KubeConfig) => ListNamespaces;
28
32
  createVersionDetector: (cluster: Cluster) => VersionDetector;
29
33
  broadcastMessage: BroadcastMessage;
@@ -225,16 +229,19 @@ export declare class Cluster implements ClusterModel, ClusterState {
225
229
  disconnect(): void;
226
230
  /**
227
231
  * @internal
228
- * @param opts refresh options
229
232
  */
230
- refresh(opts?: ClusterRefreshOptions): Promise<void>;
233
+ refresh(): Promise<void>;
231
234
  /**
232
235
  * @internal
233
236
  */
237
+ refreshAccessibilityAndMetadata(): Promise<void>;
238
+ /**
239
+ * @internal
240
+ */
234
241
  refreshMetadata(): Promise<void>;
235
242
  /**
236
- * @internal
237
- */
243
+ * @internal
244
+ */
238
245
  private refreshAccessibility;
239
246
  /**
240
247
  * @internal
@@ -279,7 +286,7 @@ export declare class Cluster implements ClusterModel, ClusterState {
279
286
  */
280
287
  broadcastConnectUpdate(message: string, isError?: boolean): void;
281
288
  protected getAllowedNamespaces(proxyConfig: KubeConfig): Promise<string[]>;
282
- protected getAllowedResources(canI: CanI): Promise<KubeResource[]>;
289
+ protected getAllowedResources(listApiResources: RequestListApiResources, requestNamespaceResources: RequestNamespaceResources): Promise<KubeResource[]>;
283
290
  isAllowedResource(kind: string): boolean;
284
291
  isMetricHidden(resource: ClusterMetricsResourceType): boolean;
285
292
  get nodeShellImage(): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ import type { KubeApiResource } from "../rbac";
6
+ import type { Cluster } from "./cluster";
7
+ export type RequestListApiResources = () => Promise<KubeApiResource[]>;
8
+ /**
9
+ * @param proxyConfig This config's `currentContext` field must be set, and will be used as the target cluster
10
+ */
11
+ export type ListApiResources = (cluster: Cluster) => RequestListApiResources;
12
+ declare const listApiResourcesInjectable: import("@ogre-tools/injectable").Injectable<ListApiResources, unknown, void>;
13
+ export default listApiResourcesInjectable;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ import type { ClusterId } from "../cluster-types";
6
+ import type { MessageChannel } from "../utils/channel/message-channel-listener-injection-token";
7
+ export declare const clusterVisibilityChannel: MessageChannel<ClusterId | null>;
@@ -150,12 +150,6 @@ export declare enum ClusterMetricsResourceType {
150
150
  * The default node shell image
151
151
  */
152
152
  export declare const initialNodeShellImage = "docker.io/alpine:3.13";
153
- /**
154
- * The arguments for requesting to refresh a cluster's metadata
155
- */
156
- export interface ClusterRefreshOptions {
157
- refreshMetadata?: boolean;
158
- }
159
153
  /**
160
154
  * The data representing a cluster's state, for passing between main and renderer
161
155
  */
@@ -1,10 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import type { ExecFileException, ExecFileOptions } from "child_process";
3
3
  import type { AsyncResult } from "../utils/async-result";
4
+ export type ExecFileError = ExecFileException & {
5
+ stderr: string;
6
+ };
4
7
  export interface ExecFile {
5
- (filePath: string, args: string[], options?: ExecFileOptions): Promise<AsyncResult<string, ExecFileException & {
6
- stderr: string;
7
- }>>;
8
+ (filePath: string): Promise<AsyncResult<string, ExecFileError>>;
9
+ (filePath: string, argsOrOptions: string[] | ExecFileOptions): Promise<AsyncResult<string, ExecFileError>>;
10
+ (filePath: string, args: string[], options: ExecFileOptions): Promise<AsyncResult<string, ExecFileError>>;
8
11
  }
9
12
  declare const execFileInjectable: import("@ogre-tools/injectable").Injectable<ExecFile, unknown, void>;
10
13
  export default execFileInjectable;
@@ -5,10 +5,7 @@
5
5
  export declare const clusterActivateHandler = "cluster:activate";
6
6
  export declare const clusterSetFrameIdHandler = "cluster:set-frame-id";
7
7
  export declare const clusterVisibilityHandler = "cluster:visibility";
8
- export declare const clusterRefreshHandler = "cluster:refresh";
9
8
  export declare const clusterDisconnectHandler = "cluster:disconnect";
10
- export declare const clusterKubectlApplyAllHandler = "cluster:kubectl-apply-all";
11
- export declare const clusterKubectlDeleteAllHandler = "cluster:kubectl-delete-all";
12
9
  export declare const clusterStates = "cluster:states";
13
10
  /**
14
11
  * This channel is broadcast on whenever the cluster fails to list namespaces
@@ -0,0 +1,5 @@
1
+ import type { KubernetesCluster } from "../catalog-entities";
2
+ import type { ResourceApplyingStack } from "./resource-stack";
3
+ export type CreateResourceStack = (cluster: KubernetesCluster, name: string) => ResourceApplyingStack;
4
+ declare const createResourceStackInjectable: import("@ogre-tools/injectable").Injectable<CreateResourceStack, unknown, void>;
5
+ export default createResourceStackInjectable;
@@ -1,8 +1,27 @@
1
1
  import type { KubernetesCluster } from "../catalog-entities";
2
+ import type { AsyncResult } from "../utils/async-result";
3
+ import type { Logger } from "../logger";
4
+ import type { KubectlApplyAll, KubectlDeleteAll } from "../kube-helpers/channels";
5
+ import type { ReadDirectory } from "../fs/read-directory.injectable";
6
+ import type { JoinPaths } from "../path/join-paths.injectable";
7
+ import type { ReadFile } from "../fs/read-file.injectable";
8
+ export interface ResourceApplyingStack {
9
+ kubectlApplyFolder(folderPath: string, templateContext?: any, extraArgs?: string[]): Promise<string>;
10
+ kubectlDeleteFolder(folderPath: string, templateContext?: any, extraArgs?: string[]): Promise<string>;
11
+ }
12
+ export interface ResourceStackDependencies {
13
+ readonly logger: Logger;
14
+ kubectlApplyAll: KubectlApplyAll;
15
+ kubectlDeleteAll: KubectlDeleteAll;
16
+ readDirectory: ReadDirectory;
17
+ joinPaths: JoinPaths;
18
+ readFile: ReadFile;
19
+ }
2
20
  export declare class ResourceStack {
3
- protected cluster: KubernetesCluster;
4
- protected name: string;
5
- constructor(cluster: KubernetesCluster, name: string);
21
+ protected readonly dependencies: ResourceStackDependencies;
22
+ protected readonly cluster: KubernetesCluster;
23
+ protected readonly name: string;
24
+ constructor(dependencies: ResourceStackDependencies, cluster: KubernetesCluster, name: string);
6
25
  /**
7
26
  *
8
27
  * @param folderPath folder path that is searched for files defining kubernetes resources.
@@ -15,8 +34,8 @@ export declare class ResourceStack {
15
34
  * @param templateContext sets the template parameters that are to be applied to any templated kubernetes resources that are to be applied.
16
35
  */
17
36
  kubectlDeleteFolder(folderPath: string, templateContext?: any, extraArgs?: string[]): Promise<string>;
18
- protected applyResources(resources: string[], extraArgs?: string[]): Promise<string>;
19
- protected deleteResources(resources: string[], extraArgs?: string[]): Promise<string>;
20
- protected appendKubectlArgs(kubectlArgs: string[]): string[];
37
+ protected applyResources(resources: string[], extraArgs?: string[]): Promise<AsyncResult<string, string>>;
38
+ protected deleteResources(resources: string[], extraArgs?: string[]): Promise<AsyncResult<string, string>>;
39
+ protected getAdditionalArgs(kubectlArgs: string[]): string[];
21
40
  protected renderTemplates(folderPath: string, templateContext: any): Promise<string[]>;
22
41
  }
@@ -1,14 +1,10 @@
1
+ import type { AsyncResult } from "../../../utils/async-result";
1
2
  interface HelmReleaseUpdatePayload {
2
3
  repo: string;
3
4
  chart: string;
4
5
  version: string;
5
6
  values: string;
6
7
  }
7
- export type RequestHelmReleaseUpdate = (name: string, namespace: string, payload: HelmReleaseUpdatePayload) => Promise<{
8
- updateWasSuccessful: true;
9
- } | {
10
- updateWasSuccessful: false;
11
- error: unknown;
12
- }>;
8
+ export type RequestHelmReleaseUpdate = (name: string, namespace: string, payload: HelmReleaseUpdatePayload) => Promise<AsyncResult<void, unknown>>;
13
9
  declare const requestHelmReleaseUpdateInjectable: import("@ogre-tools/injectable").Injectable<RequestHelmReleaseUpdate, unknown, void>;
14
10
  export default requestHelmReleaseUpdateInjectable;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) OpenLens Authors. All rights reserved.
3
+ * Licensed under MIT License. See LICENSE in root directory for more information.
4
+ */
5
+ import type { Asyncify } from "type-fest";
6
+ import type { RequestChannelHandler } from "../../main/utils/channel/channel-listeners/listener-tokens";
7
+ import type { ClusterId } from "../cluster-types";
8
+ import type { AsyncResult } from "../utils/async-result";
9
+ import type { RequestChannel } from "../utils/channel/request-channel-listener-injection-token";
10
+ export interface KubectlApplyAllArgs {
11
+ clusterId: ClusterId;
12
+ resources: string[];
13
+ extraArgs: string[];
14
+ }
15
+ export declare const kubectlApplyAllChannel: RequestChannel<KubectlApplyAllArgs, AsyncResult<string, string>>;
16
+ export type KubectlApplyAll = Asyncify<RequestChannelHandler<typeof kubectlApplyAllChannel>>;
17
+ export declare const kubectlApplyAllInjectionToken: import("@ogre-tools/injectable").InjectionToken<(req: KubectlApplyAllArgs) => Promise<AsyncResult<string, string>>, void>;
18
+ export interface KubectlDeleteAllArgs {
19
+ clusterId: ClusterId;
20
+ resources: string[];
21
+ extraArgs: string[];
22
+ }
23
+ export declare const kubectlDeleteAllChannel: RequestChannel<KubectlDeleteAllArgs, AsyncResult<string, string>>;
24
+ export type KubectlDeleteAll = Asyncify<RequestChannelHandler<typeof kubectlDeleteAllChannel>>;
25
+ export declare const kubectlDeleteAllInjectionToken: import("@ogre-tools/injectable").InjectionToken<(req: KubectlDeleteAllArgs) => Promise<AsyncResult<string, string>>, void>;
@@ -2,11 +2,22 @@
2
2
  * Copyright (c) OpenLens Authors. All rights reserved.
3
3
  * Licensed under MIT License. See LICENSE in root directory for more information.
4
4
  */
5
- export { ResourceStack } from "../../common/k8s/resource-stack";
5
+ import type { ResourceApplyingStack } from "../../common/k8s/resource-stack";
6
+ import type { KubernetesCluster } from "./catalog";
6
7
  export declare const apiManager: import("../../common/k8s-api/api-manager").ApiManager;
7
8
  export declare const forCluster: import("../../common/k8s-api/create-kube-api-for-cluster.injectable").CreateKubeApiForCluster;
8
9
  export declare const forRemoteCluster: import("../../common/k8s-api/create-kube-api-for-remote-cluster.injectable").CreateKubeApiForRemoteCluster;
9
10
  export { KubeApi } from "../../common/k8s-api/kube-api";
11
+ export declare const createResourceStack: import("../../common/k8s/create-resource-stack.injectable").CreateResourceStack;
12
+ /**
13
+ * @deprecated Switch to using `Common.createResourceStack` instead
14
+ */
15
+ export declare class ResourceStack implements ResourceApplyingStack {
16
+ private readonly impl;
17
+ constructor(cluster: KubernetesCluster, name: string);
18
+ kubectlApplyFolder(folderPath: string, templateContext?: any, extraArgs?: string[] | undefined): Promise<string>;
19
+ kubectlDeleteFolder(folderPath: string, templateContext?: any, extraArgs?: string[] | undefined): Promise<string>;
20
+ }
10
21
  /**
11
22
  * @deprecated This type is unused
12
23
  */