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

Set ownerReference to manually triggered cron jobs (#3229)

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2021-07-02 08:10:37 -04:00 committed by GitHub
parent 2708ca63ed
commit 189f017b2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,6 +31,7 @@ import { Notifications } from "../notifications";
import { cssNames } from "../../utils"; import { cssNames } from "../../utils";
import { Input } from "../input"; import { Input } from "../input";
import { systemName, maxLength } from "../input/input_validators"; import { systemName, maxLength } from "../input/input_validators";
import type { IKubeObjectMetadata } from "../../api/kube-object";
interface Props extends Partial<DialogProps> { interface Props extends Partial<DialogProps> {
} }
@ -91,9 +92,19 @@ export class CronJobTriggerDialog extends Component<Props> {
await jobApi.create({ await jobApi.create({
name: this.jobName, name: this.jobName,
namespace: cronjob.getNs() namespace: cronjob.getNs(),
}, { }, {
spec: cronjobDefinition.spec.jobTemplate.spec spec: cronjobDefinition.spec.jobTemplate.spec,
metadata: {
ownerReferences: [{
apiVersion: cronjob.apiVersion,
blockOwnerDeletion: true,
controller: true,
kind: cronjob.kind,
name: cronjob.metadata.name,
uid: cronjob.metadata.uid,
}],
} as IKubeObjectMetadata
}); });
close(); close();