You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/08/30 10:28:32 UTC
[brooklyn-server] 02/02: ensure pod name is recorded even if task finishes very quickly
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 9f71752d0280822d8213c6b514af12054776218f
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Mon Aug 29 16:28:54 2022 +0100
ensure pod name is recorded even if task finishes very quickly
---
.../org/apache/brooklyn/tasks/kubectl/ContainerTaskFactory.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/software/base/src/main/java/org/apache/brooklyn/tasks/kubectl/ContainerTaskFactory.java b/software/base/src/main/java/org/apache/brooklyn/tasks/kubectl/ContainerTaskFactory.java
index 0cb3cd9236..a9555f38f5 100644
--- a/software/base/src/main/java/org/apache/brooklyn/tasks/kubectl/ContainerTaskFactory.java
+++ b/software/base/src/main/java/org/apache/brooklyn/tasks/kubectl/ContainerTaskFactory.java
@@ -440,15 +440,15 @@ public class ContainerTaskFactory<T extends ContainerTaskFactory<T,RET>,RET> imp
long startupReportDelay = 1000; // report any start longer than 1s
while (timer.isNotExpired()) {
phase = checkPodPhase(entity, kubeJobName);
+ if (phase!=PodPhases.Unknown && Strings.isBlank(result.kubePodName)) {
+ result.kubePodName = runTask(entity, newSimpleTaskFactory(String.format(PODS_NAME_CMD, namespace, kubeJobName)).summary("Get pod name").allowingNonZeroExitCode().newTask(), false, true).get().trim();
+ }
if (phase == PodPhases.Failed || phase == PodPhases.Succeeded || phase == PodPhases.Running) {
if (startupReportDelay>5000) LOG.info("Container detected in state "+phase+" after "+Duration.millis(System.currentTimeMillis()-first));
else LOG.debug("Container detected in state "+phase+" after "+Duration.millis(System.currentTimeMillis()-first));
return phase;
}
- if (phase!=PodPhases.Unknown && Strings.isBlank(result.kubePodName)) {
- result.kubePodName = runTask(entity, newSimpleTaskFactory(String.format(PODS_NAME_CMD, namespace, kubeJobName)).summary("Get pod name").allowingNonZeroExitCode().newTask(), false, true).get().trim();
- }
if (phase == PodPhases.Pending && Strings.isNonBlank(result.kubePodName)) {
// if pending, need to look for errors
String failedEvents = runTask(entity, newSimpleTaskFactory(String.format(SCOPED_EVENTS_FAILED_JSON_CMD, namespace, result.kubePodName)).summary("Check pod failed events").allowingNonZeroExitCode().newTask(),