Merge pull request #27428 from gmarek/staticPods
Automatic merge from submit-queue WaitForRunningReady also waits for PodsSuccess Ref. #27095 - fixes the test, doesn't fix the problem. cc @yujuhong @fejta
This commit is contained in:
		| @@ -548,9 +548,10 @@ func WaitForPodsSuccess(c *client.Client, ns string, successPodLabels map[string | |||||||
| // that it requires the list of pods on every iteration. This is useful, for | // that it requires the list of pods on every iteration. This is useful, for | ||||||
| // example, in cluster startup, because the number of pods increases while | // example, in cluster startup, because the number of pods increases while | ||||||
| // waiting. | // waiting. | ||||||
| // If ignoreSuccessPods is true, pods in the "Success" state are ignored and | // If ignoreLabels is not empty, pods matching this selector are ignored and | ||||||
| // this function waits for minPods to enter Running/Ready. Otherwise an error is | // this function waits for minPods to enter Running/Ready and for all pods | ||||||
| // returned even if there are minPods pods, some of which are in Running/Ready | // matching ignoreLabels to enter Success phase. Otherwise an error is returned | ||||||
|  | // even if there are minPods pods, some of which are in Running/Ready | ||||||
| // and some in Success. This is to allow the client to decide if "Success" | // and some in Success. This is to allow the client to decide if "Success" | ||||||
| // means "Ready" or not. | // means "Ready" or not. | ||||||
| func WaitForPodsRunningReady(c *client.Client, ns string, minPods int32, timeout time.Duration, ignoreLabels map[string]string) error { | func WaitForPodsRunningReady(c *client.Client, ns string, minPods int32, timeout time.Duration, ignoreLabels map[string]string) error { | ||||||
| @@ -558,6 +559,14 @@ func WaitForPodsRunningReady(c *client.Client, ns string, minPods int32, timeout | |||||||
| 	start := time.Now() | 	start := time.Now() | ||||||
| 	Logf("Waiting up to %v for all pods (need at least %d) in namespace '%s' to be running and ready", | 	Logf("Waiting up to %v for all pods (need at least %d) in namespace '%s' to be running and ready", | ||||||
| 		timeout, minPods, ns) | 		timeout, minPods, ns) | ||||||
|  | 	wg := sync.WaitGroup{} | ||||||
|  | 	wg.Add(1) | ||||||
|  | 	var waitForSuccessError error | ||||||
|  | 	go func() { | ||||||
|  | 		waitForSuccessError = WaitForPodsSuccess(c, ns, ignoreLabels, timeout) | ||||||
|  | 		wg.Done() | ||||||
|  | 	}() | ||||||
|  |  | ||||||
| 	if wait.PollImmediate(Poll, timeout, func() (bool, error) { | 	if wait.PollImmediate(Poll, timeout, func() (bool, error) { | ||||||
| 		// We get the new list of pods and replication controllers in every | 		// We get the new list of pods and replication controllers in every | ||||||
| 		// iteration because more pods come online during startup and we want to | 		// iteration because more pods come online during startup and we want to | ||||||
| @@ -612,6 +621,10 @@ func WaitForPodsRunningReady(c *client.Client, ns string, minPods int32, timeout | |||||||
| 	}) != nil { | 	}) != nil { | ||||||
| 		return fmt.Errorf("Not all pods in namespace '%s' running and ready within %v", ns, timeout) | 		return fmt.Errorf("Not all pods in namespace '%s' running and ready within %v", ns, timeout) | ||||||
| 	} | 	} | ||||||
|  | 	wg.Wait() | ||||||
|  | 	if waitForSuccessError != nil { | ||||||
|  | 		return waitForSuccessError | ||||||
|  | 	} | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 k8s-merge-robot
					k8s-merge-robot