Skip to content

Commit

Permalink
Use extra paramter for pod-wait-time
Browse files Browse the repository at this point in the history
  • Loading branch information
LEDfan committed Nov 9, 2020
1 parent 8ba1258 commit ab8bd9f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,16 @@ protected Container startContainer(ContainerSpec spec, Proxy proxy) throws Excep

Pod startedPod = kubeClient.pods().inNamespace(effectiveKubeNamespace).create(patchedPod);

int totalWaitMs = Integer.parseInt(environment.getProperty("proxy.container-wait-time", "20000"));
Retrying.retry(i -> Readiness.isReady(kubeClient.resource(startedPod).fromServer().get()), totalWaitMs / 1000, 1000);
int totalWaitMs = Integer.parseInt(environment.getProperty("proxy.kubernetes.pod-wait-time", "60000"));
int maxTries = totalWaitMs / 1000;
Retrying.retry(i -> {
if (!Readiness.isReady(kubeClient.resource(startedPod).fromServer().get())) {
if (i > 1 && log != null) log.debug(String.format("Container not ready yet, trying again (%d/%d)", i, maxTries));
return false;
}
return true;
}
, maxTries, 1000);
if (!Readiness.isReady(kubeClient.resource(startedPod).fromServer().get())) {
throw new ContainerProxyException("Container did not become ready in time");
}
Expand Down

0 comments on commit ab8bd9f

Please sign in to comment.