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

Setting a grace period when deleting resource #2269

Closed
sknot-rh opened this issue Jun 8, 2020 · 3 comments · Fixed by #2324
Closed

Setting a grace period when deleting resource #2269

sknot-rh opened this issue Jun 8, 2020 · 3 comments · Fixed by #2324
Assignees
Labels

Comments

@sknot-rh
Copy link
Contributor

sknot-rh commented Jun 8, 2020

Hi,
I was deleting a resource using this

operation().inNamespace(namespace).withName(name).cascading(cascading).withGracePeriod(gracePeriod).delete();

Since cascading has been deprecated in 4.10.2 (currently using) I updated the code to

operation().inNamespace(namespace).withName(name).withPropagationPolicy(cascading ? DeletionPropagation.FOREGROUND : DeletionPropagation.ORPHAN).delete();

But I cannot set withGracePeriod(long) anymore.
I can do

operation().inNamespace(namespace).withName(name).withGracePeriod(gracePeriod).delete();

but there the propagation policy is not set.

How can I set both of these properties?

Thanks

@sknot-rh sknot-rh changed the title Setting a grace period to deleted resource Setting a grace period when deleting resource Jun 9, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jul 2, 2020
@rohanKanojia rohanKanojia self-assigned this Jul 3, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jul 10, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Jul 13, 2020
rohanKanojia added a commit that referenced this issue Jul 13, 2020
@sknot-rh
Copy link
Contributor Author

sknot-rh commented Jul 16, 2020

It seems this made it into 4.10.3 however I am still not able to do

KubernetesClient kc = new DefaultKubernetesClient();
kc.apps().statefulSets().inNamespace("ns").withName("name").withGracePeriod(42L).withPropagationPolicy(DeletionPropagation.FOREGROUND).delete();

@rohanKanojia
Copy link
Member

I think it's available like this:

client.apps().deployments().inNamespace("rokumar").withName("nginx").withPropagationPolicy(DeletionPropagation.FOREGROUND).withGracePeriod(0L).delete();

@sknot-rh
Copy link
Contributor Author

Aha! Thanks

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