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.
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