Skip to content

Commit

Permalink
add pod ip logging for orchestrator (airbytehq#11714)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhizor authored Apr 5, 2022
1 parent 741fcb1 commit e49cd37
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public void create(final Map<String, String> allLabels,
.withVolumeMounts(volumeMounts)
.build();

final Pod pod = new PodBuilder()
final Pod podToCreate = new PodBuilder()
.withApiVersion("v1")
.withNewMetadata()
.withName(getInfo().name())
Expand All @@ -307,7 +307,7 @@ public void create(final Map<String, String> allLabels,
// should only create after the kubernetes API creates the pod
final var createdPod = kubernetesClient.pods()
.inNamespace(getInfo().namespace())
.createOrReplace(pod);
.createOrReplace(podToCreate);

log.info("Waiting for pod to be running...");
try {
Expand All @@ -321,11 +321,13 @@ public void create(final Map<String, String> allLabels,
throw new RuntimeException(e);
}

final var containerState = kubernetesClient.pods()
final var podStatus = kubernetesClient.pods()
.inNamespace(kubePodInfo.namespace())
.withName(kubePodInfo.name())
.get()
.getStatus()
.getStatus();

final var containerState = podStatus
.getContainerStatuses()
.get(0)
.getState();
Expand All @@ -334,6 +336,8 @@ public void create(final Map<String, String> allLabels,
throw new RuntimeException("Pod was not running, state was: " + containerState);
}

log.info(String.format("Pod %s/%s is running on %s", kubePodInfo.namespace(), kubePodInfo.name(), podStatus.getPodIP()));

final var updatedFileMap = new HashMap<>(fileMap);
updatedFileMap.put(KUBE_POD_INFO, Jsons.serialize(kubePodInfo));

Expand Down

0 comments on commit e49cd37

Please sign in to comment.