Skip to content

Commit

Permalink
Merge pull request 'Kubernetes: app doesn't start if pull of image ta…
Browse files Browse the repository at this point in the history
…kes longer than 60 seconds' (#14) from feature/23620 into develop
  • Loading branch information
fmichielssen committed Nov 10, 2020
2 parents f665e57 + ab8bd9f commit 1f91b19
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,19 @@ protected Container startContainer(ContainerSpec spec, Proxy proxy) throws Excep

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

// Workaround: waitUntilReady appears to be buggy.
Retrying.retry(i -> Readiness.isReady(kubeClient.resource(startedPod).fromServer().get()), 60, 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");
}
Pod pod = kubeClient.resource(startedPod).fromServer().get();

Service service = null;
Expand Down

0 comments on commit 1f91b19

Please sign in to comment.