1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Export getPodsByOwnerId to extension API (#7225)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
Co-authored-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Antti Lustila 2023-03-24 16:17:13 +02:00 committed by GitHub
parent 3931c90d30
commit 8dc0177cb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 2 deletions

View File

@ -32,11 +32,13 @@ import type { KubeJsonApi as InternalKubeJsonApi } from "../../common/k8s-api/ku
import createKubeJsonApiInjectable from "../../common/k8s-api/create-kube-json-api.injectable"; import createKubeJsonApiInjectable from "../../common/k8s-api/create-kube-json-api.injectable";
import type { RequestInit } from "@k8slens/node-fetch"; import type { RequestInit } from "@k8slens/node-fetch";
import createKubeJsonApiForClusterInjectable from "../../common/k8s-api/create-kube-json-api-for-cluster.injectable"; import createKubeJsonApiForClusterInjectable from "../../common/k8s-api/create-kube-json-api-for-cluster.injectable";
import getPodsByOwnerIdInjectable from "../../renderer/components/+workloads-pods/get-pods-by-owner-id.injectable";
export const apiManager = asLegacyGlobalForExtensionApi(apiManagerInjectable); export const apiManager = asLegacyGlobalForExtensionApi(apiManagerInjectable);
export const forCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForClusterInjectable); export const forCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForClusterInjectable);
export const forRemoteCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForRemoteClusterInjectable); export const forRemoteCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForRemoteClusterInjectable);
export const createResourceStack = asLegacyGlobalFunctionForExtensionApi(createResourceStackInjectable); export const createResourceStack = asLegacyGlobalFunctionForExtensionApi(createResourceStackInjectable);
export const getPodsByOwnerId = asLegacyGlobalFunctionForExtensionApi(getPodsByOwnerIdInjectable);
const getKubeApiDeps = (): KubeApiDependencies => { const getKubeApiDeps = (): KubeApiDependencies => {
const di = getLegacyGlobalDiForExtensionApi(); const di = getLegacyGlobalDiForExtensionApi();
@ -50,7 +52,7 @@ const getKubeApiDeps = (): KubeApiDependencies => {
export interface ExternalKubeApiOptions { export interface ExternalKubeApiOptions {
/** /**
* If `true` then on creation of the `KubeApi`instance a call to `apiManager.registerApi` will be * If `true` then on creation of the `KubeApi`instance a call to `apiManager.registerApi` will be
* made. This is `true` by default to maintain backwards compatability. * made. This is `true` by default to maintain backwards compatibility.
* *
* Setting this to `false` might make `KubeObject`'s details drawer stop working. * Setting this to `false` might make `KubeObject`'s details drawer stop working.
* *
@ -200,7 +202,7 @@ export type {
} from "../../common/k8s-api/kube-object.store"; } from "../../common/k8s-api/kube-object.store";
/** /**
* @deprecated This type is only present for backwards compatable typescript support * @deprecated This type is only present for backwards compatible typescript support
*/ */
export interface IgnoredKubeApiOptions { export interface IgnoredKubeApiOptions {
/** /**

View File

@ -18,6 +18,9 @@ export class DaemonSetStore extends KubeObjectStore<DaemonSet, DaemonSetApi> {
super(dependencies, api, opts); super(dependencies, api, opts);
} }
/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(daemonSet: DaemonSet): Pod[] { getChildPods(daemonSet: DaemonSet): Pod[] {
return this.dependencies.getPodsByOwnerId(daemonSet.getId()); return this.dependencies.getPodsByOwnerId(daemonSet.getId());
} }

View File

@ -19,6 +19,9 @@ export class JobStore extends KubeObjectStore<Job, JobApi> {
super(dependencies, api, opts); super(dependencies, api, opts);
} }
/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(job: Job): Pod[] { getChildPods(job: Job): Pod[] {
return this.dependencies.getPodsByOwnerId(job.getId()); return this.dependencies.getPodsByOwnerId(job.getId());
} }

View File

@ -18,6 +18,9 @@ export class ReplicaSetStore extends KubeObjectStore<ReplicaSet, ReplicaSetApi>
super(dependencies, api, opts); super(dependencies, api, opts);
} }
/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(replicaSet: ReplicaSet) { getChildPods(replicaSet: ReplicaSet) {
return this.dependencies.getPodsByOwnerId(replicaSet.getId()); return this.dependencies.getPodsByOwnerId(replicaSet.getId());
} }

View File

@ -18,6 +18,9 @@ export class StatefulSetStore extends KubeObjectStore<StatefulSet, StatefulSetAp
super(dependencies, api, opts); super(dependencies, api, opts);
} }
/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(statefulSet: StatefulSet) { getChildPods(statefulSet: StatefulSet) {
return this.dependencies.getPodsByOwnerId(statefulSet.getId()); return this.dependencies.getPodsByOwnerId(statefulSet.getId());
} }