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

Merge pull request #453 from jim-docker/issue-393-job-remove-pods-too

Remove related pods when removing Job resource
This commit is contained in:
Jim Ehrismann 2020-06-16 11:18:54 -04:00 committed by GitHub
commit d48b463ea7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { autobind } from "../../utils";
import { IAffinity, WorkloadKubeObject } from "../workload-kube-object";
import { IPodContainer } from "./pods.api";
import { KubeApi } from "../kube-api";
import { JsonApiParams } from "../json-api";
@autobind()
export class Job extends WorkloadKubeObject {
@ -88,6 +89,13 @@ export class Job extends WorkloadKubeObject {
const containers: IPodContainer[] = get(this, "spec.template.spec.containers", [])
return [...containers].map(container => container.image)
}
delete() {
const params: JsonApiParams = {
query: { propagationPolicy: "Background" }
}
return super.delete(params)
}
}
export const jobApi = new KubeApi({

View File

@ -5,6 +5,7 @@ import { KubeJsonApiData, KubeJsonApiDataList } from "./kube-json-api";
import { autobind, formatDuration } from "../utils";
import { ItemObject } from "../item.store";
import { apiKube } from "./index";
import { JsonApiParams } from "./json-api";
import { resourceApplierApi } from "./endpoints/resource-applier.api";
export type IKubeObjectConstructor<T extends KubeObject = any> = (new (data: KubeJsonApiData | any) => T) & {
@ -152,7 +153,7 @@ export class KubeObject implements ItemObject {
});
}
delete() {
return apiKube.del(this.selfLink);
delete(params?: JsonApiParams) {
return apiKube.del(this.selfLink, params);
}
}