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

Kubectl should support cascading deletes for Jobs #3463

Open
gautam-rl opened this issue Jun 4, 2024 · 1 comment
Open

Kubectl should support cascading deletes for Jobs #3463

gautam-rl opened this issue Jun 4, 2024 · 1 comment

Comments

@gautam-rl
Copy link

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
Copy link
Contributor

Feel free to send a PR to support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants