英文:
How to get the status of deployment using kubernetes-client in java
问题
我正在尝试在Java中使用kubernetes-client执行json-patch,从而触发部署。示例代码如下:
ExtensionsV1beta1Api api = new ExtensionsV1beta1Api(ClientBuilder.standard().build());
ExtensionsV1beta1Deployment deploy =
PatchUtils.patch(
ExtensionsV1beta1Deployment.class,
() ->
api.patchNamespacedDeploymentCall(
deploymentName,
namespace,
new V1Patch(jsonPatchStr),
null,
null,
null,
null,
null),
V1Patch.PATCH_FORMAT_JSON_PATCH,
api.getApiClient());
log.info("json-patching started for " + deploymentName + " , the deployment is: "
+ deploy);
json-patch正常工作,新的pod使用所需的更改被创建。理想情况下,我希望在所需的所有pod都被创建之前等待我的线程,然后继续进行下一个步骤。因此,我想寻求帮助,找出如何跟踪执行json-patch后部署的状态。
英文:
I am trying to use kubernetes-client in java to perform a json-patch which intern triggers a deployment. Sample code is as follows
ExtensionsV1beta1Api api = new ExtensionsV1beta1Api(ClientBuilder.standard().build());
ExtensionsV1beta1Deployment deploy =
PatchUtils.patch(
ExtensionsV1beta1Deployment.class,
() ->
api.patchNamespacedDeploymentCall(
deploymentName,
namespace,
new V1Patch(jsonPatchStr),
null,
null,
null,
null,
null),
V1Patch.PATCH_FORMAT_JSON_PATCH,
api.getApiClient());
log.info("json-patching started for " + deploymentName + " , the deployment is: "
+ deploy);
The json-patch is working and new pods are created with the required changes. Ideally, I want to wait my thread until all the required pods are created and then move on to my next time, so I wanted some help in finding out how to track the deployment status for the json-patch performed.
答案1
得分: 1
不要回答我要翻译的问题。以下是要翻译的内容:
"Instead of putting the tests on your java client, I would suggest to let k8s to deal with this kind of dependencies by adding startup probes
Basically it will let you deploy all pods in any order but will have a restriction of when the k8s would start the pods on a simple health check of another pod
英文:
Instead of putting the tests on your java client, I would suggest to let k8s to deal with this kind of dependencies by adding startup probes
Basically it will let you deploy all pods in any order but will have a restriction of when the k8s would start the pods on a simple health check of another pod
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论