Kubectl should support cascading deletes for Jobs
gautam-rl opened this issue · 1 comments
gautam-rl commented
Describe the bug
Kubectl doesn't make it possible to delete a Job and have the delete cascade to the underlying pod. By default it appears to orphan the pod as described here: https://kubernetes.io/docs/concepts/workloads/controllers/job/#ttl-mechanism-for-finished-jobs.
Client Version
20.0.1
Kubernetes Version
1.29
Java Version
Java 21
To Reproduce
Create a job and then delete it using Kubectl:
Kubectl.delete(V1Job.class)
.apiClient(client)
.name(jobId)
.namespace(namespace)
.ignoreNotFound(true)
.execute());
Expected behavior
It should be possible to pass in .deleteOptions()
and cascade or do foreground propagation.
Additional context
As a workaround we can use the batchApi:
V1Status v1Status =
batchApi.deleteNamespacedJob(jobId, namespace).propagationPolicy("Foreground").execute();
brendandburns commented
Feel free to send a PR to support this.