Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export getPodsByOwnerId to extension API #7225

Merged
merged 1 commit into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/src/extensions/common-api/k8s-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 type { RequestInit } from "@k8slens/node-fetch";
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 forCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForClusterInjectable);
export const forRemoteCluster = asLegacyGlobalFunctionForExtensionApi(createKubeApiForRemoteClusterInjectable);
export const createResourceStack = asLegacyGlobalFunctionForExtensionApi(createResourceStackInjectable);
export const getPodsByOwnerId = asLegacyGlobalFunctionForExtensionApi(getPodsByOwnerIdInjectable);

const getKubeApiDeps = (): KubeApiDependencies => {
const di = getLegacyGlobalDiForExtensionApi();
Expand All @@ -50,7 +52,7 @@ const getKubeApiDeps = (): KubeApiDependencies => {
export interface ExternalKubeApiOptions {
/**
* 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.
*
Expand Down Expand Up @@ -200,7 +202,7 @@ export type {
} 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 {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export class DaemonSetStore extends KubeObjectStore<DaemonSet, DaemonSetApi> {
super(dependencies, api, opts);
}

/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(daemonSet: DaemonSet): Pod[] {
return this.dependencies.getPodsByOwnerId(daemonSet.getId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export class JobStore extends KubeObjectStore<Job, JobApi> {
super(dependencies, api, opts);
}

/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(job: Job): Pod[] {
return this.dependencies.getPodsByOwnerId(job.getId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export class ReplicaSetStore extends KubeObjectStore<ReplicaSet, ReplicaSetApi>
super(dependencies, api, opts);
}

/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(replicaSet: ReplicaSet) {
return this.dependencies.getPodsByOwnerId(replicaSet.getId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export class StatefulSetStore extends KubeObjectStore<StatefulSet, StatefulSetAp
super(dependencies, api, opts);
}

/**
* @deprecated Switch to using `getPodsByOwnerId` directly
*/
getChildPods(statefulSet: StatefulSet) {
return this.dependencies.getPodsByOwnerId(statefulSet.getId());
}
Expand Down