mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
Fix incorrect comments in IsPodAvailable
This commit is contained in:
parent
f29d597d02
commit
f3b1aaeca6
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user