Commit 222eb31f authored by Robert Bailey's avatar Robert Bailey

Merge pull request #25059 from janetkuo/deployment-availablepods-comment

Fix incorrect comments in IsPodAvailable
parents d9a4e9b4 f3b1aaec
...@@ -286,11 +286,11 @@ func IsPodAvailable(pod *api.Pod, minReadySeconds int32) bool { ...@@ -286,11 +286,11 @@ func IsPodAvailable(pod *api.Pod, minReadySeconds int32) bool {
for _, c := range pod.Status.Conditions { for _, c := range pod.Status.Conditions {
// we only care about pod ready conditions // we only care about pod ready conditions
if c.Type == api.PodReady && c.Status == api.ConditionTrue { if c.Type == api.PodReady && c.Status == api.ConditionTrue {
// 2 cases that this ready condition is valid (passed minReadySeconds, i.e. the pod is ready): // 2 cases that this ready condition is valid (passed minReadySeconds, i.e. the pod is available):
// 1. minReadySeconds <= 0 // 1. minReadySeconds == 0, or
// 2. LastTransitionTime (is set) + minReadySeconds (>0) < current time // 2. LastTransitionTime (is set) + minReadySeconds (>0) < current time
minReadySecondsDuration := time.Duration(minReadySeconds) * time.Second minReadySecondsDuration := time.Duration(minReadySeconds) * time.Second
if minReadySeconds <= 0 || !c.LastTransitionTime.IsZero() && c.LastTransitionTime.Add(minReadySecondsDuration).Before(time.Now()) { if minReadySeconds == 0 || !c.LastTransitionTime.IsZero() && c.LastTransitionTime.Add(minReadySecondsDuration).Before(time.Now()) {
return true return true
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment