I am creating a pod in k8 client go and making a watch to get notified for when the pod has completed so that i can read the logs of the pod. The watch interface doesnt seem
You keep could keep checking the pod status in a loop and whenever the status changes to successful, you're done
for {
pod, _ := clientset.CoreV1().Pods(Namespace).Get(podName, metav1.GetOptions{})
if pod.Status.Phase != corev1.PodPending {
break
}
}
pod, _ := clientset.CoreV1().Pods(corev1.NamespaceDefault).Get(podName, metav1.GetOptions{})
if pod.Status.Phase != corev1.PodSucceeded {
return false, fmt.Errorf("Pod did not succeed/complete")
}
return true, nil