StatefulSet should not launch Pod i, if a Pod in the sequence [0,i) has its

DeletionTimestamp set. Fixes 44229.
Rename isTerminated to isTerminating
Adds a test case for at the unit level to prevent regression
This commit is contained in:
Kenneth Owens
2017-04-20 09:10:46 -07:00
parent 8e3d32b141
commit 7d22e64284
4 changed files with 82 additions and 9 deletions

View File

@@ -217,14 +217,14 @@ func isFailed(pod *v1.Pod) bool {
return pod.Status.Phase == v1.PodFailed
}
// isTerminated returns true if pod's deletion Timestamp has been set
func isTerminated(pod *v1.Pod) bool {
// isTerminating returns true if pod's DeletionTimestamp has been set
func isTerminating(pod *v1.Pod) bool {
return pod.DeletionTimestamp != nil
}
// isHealthy returns true if pod is running and ready and has not been terminated
func isHealthy(pod *v1.Pod) bool {
return isRunningAndReady(pod) && !isTerminated(pod)
return isRunningAndReady(pod) && !isTerminating(pod)
}
// newControllerRef returns an ControllerRef pointing to a given StatefulSet.