func ensureAllJobPodsRunning(c clientset.Interface, ns, jobName string, parallelism int32) error {
	label := labels.SelectorFromSet(labels.Set(map[string]string{e2ejob.JobSelectorKey: jobName}))
	options := metav1.ListOptions{LabelSelector: label.String()}
	pods, err := c.CoreV1().Pods(ns).List(context.TODO(), options)
	if err != nil {
		return err
	}
	podsSummary := make([]string, 0, parallelism)
	count := int32(0)
	for _, p := range pods.Items {
		if p.Status.Phase == v1.PodRunning {
			count++
		}
		podsSummary = append(podsSummary, fmt.Sprintf("%s (%s: %s)", p.ObjectMeta.Name, p.Status.Phase, p.Status.Message))
	}
	if count != parallelism {
		return fmt.Errorf("job has %d of %d expected running pods: %s", count, parallelism, strings.Join(podsSummary, ", "))
	}
	return nil
}
// ensureAllJobPodsRunning uses c to check in the Job named jobName in ns
// is running, returning an error if the expected parallelism is not
// satisfied.
ensureAllJobPodsRunning uses c to check in the Job named jobName in ns
is running, returning an error if the expected parallelism is not
satisfied.
// ensureAllJobPodsRunning uses c to check in the Job named jobName in ns // is running returning an error if the expected parallelism is not // satisfied .
func ensureAllJobPodsRunning(c clientset.Interface, ns, jobName string, parallelism int32) error {
	label := labels.SelectorFromSet(labels.Set(map[string]string{e2ejob.JobSelectorKey: jobName}))
	options := metav1.ListOptions{LabelSelector: label.String()}
	pods, err := c.CoreV1().Pods(ns).List(context.TODO(), options)
	if err != nil {
		return err
	}
	podsSummary := make([]string, 0, parallelism)
	count := int32(0)
	for _, p := range pods.Items {
		if p.Status.Phase == v1.PodRunning {
			count++
		}
		podsSummary = append(podsSummary, fmt.Sprintf("%s (%s: %s)", p.ObjectMeta.Name, p.Status.Phase, p.Status.Message))
	}
	if count != parallelism {
		return fmt.Errorf("job has %d of %d expected running pods: %s", count, parallelism, strings.Join(podsSummary, ", "))
	}
	return nil
}
func ensureAllJobPodsRunning ( c clientset . Interface , ns , jobName string , parallelism int32 ) error { label := labels . SelectorFromSet ( labels . Set ( map [ string ] string { e2ejob . JobSelectorKey : jobName } ) ) options := metav1 . ListOptions { LabelSelector : label . String ( ) } pods , err := c . CoreV1 ( ) . Pods ( ns ) . List ( context . TODO ( ) , options ) if err != nil { return err } podsSummary := make ( [ ] string , 0 , parallelism ) count := int32 ( 0 ) for _ , p := range pods . Items { if p . Status . Phase == v1 . PodRunning { count ++ } podsSummary = append ( podsSummary , fmt . Sprintf ( " " , p . ObjectMeta . Name , p . Status . Phase , p . Status . Message ) ) } if count != parallelism { return fmt . Errorf ( " " , count , parallelism , strings . Join ( podsSummary , " " ) ) } return nil }
ensureAllJobPodsRunning uses c to check in the Job named jobName in ns
is running, returning an error if the expected parallelism is not
satisfied.
ensureAllJobPodsRunning uses c to check in the Job named jobName in ns is running returning an error if the expected parallelism is not satisfied .