core/src/main/java/io/fabric8/maven/core/service/openshift/OpenshiftBuildService.java
private void waitUntilPodIsReady(String podName, int nAwaitTimeout, final Logger log) throws InterruptedException {
        final CountDownLatch readyLatch = new CountDownLatch(1);
        try (Watch watch = client.pods().withName(podName).watch(new Watcher<Pod>() {
            @Override
            public void eventReceived(Action action, Pod aPod) {
                if(KubernetesHelper.isPodReady(aPod)) {
                    readyLatch.countDown();
                }
            }

            @Override
            public void onClose(KubernetesClientException e) {
                // Ignore
            }
        })) {
            readyLatch.await(nAwaitTimeout, TimeUnit.SECONDS);
        } catch (KubernetesClientException | InterruptedException e) {
            log.error("Could not watch pod", e);
        }
    }
private void waitUntilPodIsReady(String podName, int nAwaitTimeout, final Logger log) throws InterruptedException {
        final CountDownLatch readyLatch = new CountDownLatch(1);
        try (Watch watch = client.pods().withName(podName).watch(new Watcher<Pod>() {
            @Override
            public void eventReceived(Action action, Pod aPod) {
                if(KubernetesHelper.isPodReady(aPod)) {
                    readyLatch.countDown();
                }
            }

            @Override
            public void onClose(KubernetesClientException e) {
                // Ignore
            }
        })) {
            readyLatch.await(nAwaitTimeout, TimeUnit.SECONDS);
        } catch (KubernetesClientException | InterruptedException e) {
            log.error("Could not watch pod", e);
        }
    }
private void waitUntilPodIsReady ( String podName , int nAwaitTimeout , final Logger log ) throws InterruptedException { final CountDownLatch readyLatch = new CountDownLatch ( 1 ) ; try ( Watch watch = client . pods ( ) . withName ( podName ) . watch ( new Watcher < Pod > ( ) { @ Override public void eventReceived ( Action action , Pod aPod ) { if ( KubernetesHelper . isPodReady ( aPod ) ) { readyLatch . countDown ( ) ; } } @ Override public void onClose ( KubernetesClientException e ) { // Ignore } } ) ) { readyLatch . await ( nAwaitTimeout , TimeUnit . SECONDS ) ; } catch ( KubernetesClientException | InterruptedException e ) { log . error ( "Could not watch pod" , e ) ; } }
A Simple utility function to watch over pod until it gets ready

@param podName Name of the pod
@param nAwaitTimeout Time in seconds upto which pod must be watched
@param log Logger object
@throws InterruptedException
A Simple utility function to watch over pod until it gets ready