Is there an analog of –server-dry-run option in io.fabric8.kubernetes api (Java client for kubernetes)?

huangapple go评论65阅读模式
英文:

Is there an analog of --server-dry-run option in io.fabric8.kubernetes api (Java client for kubernetes)?

问题

命令行中,我们可以使用kubectl apply --server-dry-run -f example-pod.yml来对yml文件进行试运行,而不会将其持久化。那么我们能否从Java中使用io.fabric8.kubernetes(用于Kubernetes的Java客户端)来实现类似的操作呢?

英文:

In command line we can use kubectl apply --server-dry-run -f example-pod.yml to make a trial run of yml file without persisting it.
Can we do smth similar from Java, using io.fabric8.kubernetes (Java client for kubernetes) ?

答案1

得分: 1

DryRun已在版本5.2.0中实现,根据此问题 https://github.com/fabric8io/kubernetes-client/issues/2588

可以在许多资源上像这样使用:

petClient.inNamespace(currentNamespace).withName("dry-run-delete").dryRun().delete();
英文:

DryRun has been implemented with version 5.2.0 according to this issue https://github.com/fabric8io/kubernetes-client/issues/2588.

It can be used like this on many resources:

petClient.inNamespace(currentNamespace).withName("dry-run-delete").dryRun().delete();

huangapple
  • 本文由 发表于 2020年4月6日 20:49:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/61060249.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定