code: func waitForPodCondition(kubeClient *unversioned.Client, ns, podName string, condition func(pod *api.Pod) (bool, error),
  	interval, timeout time.Duration) error {
  	err := wait.PollImmediate(interval, timeout, func() (bool, error) {
  		pod, err := kubeClient.Pods(ns).Get(podName)
  		if err != nil {
  			if apierrs.IsNotFound(err) {
  				return false, nil
  			}
  		}
  
  		done, err := condition(pod)
  		if err != nil {
  			return false, err
  		}
  		if done {
  			return true, nil
  		}
  
  		return false, nil
  	})
  
  	if err != nil {
  		return fmt.Errorf("timed out waiting to observe own status as Running")
  	}
  
  	return nil
  }
docs: // waitForPodCondition waits for a pod in state defined by a condition (func)