Skip to content

Commit cf3ba4a

Browse files
authored
Merge pull request kubernetes#87900 from alculquicondor/rm_log
Remove Error log for nil StartTime in preemption candidates
2 parents 888bfd6 + e9e11de commit cf3ba4a

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

pkg/scheduler/util/utils.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,16 @@ func GetPodFullName(pod *v1.Pod) string {
3333
return pod.Name + "_" + pod.Namespace
3434
}
3535

36-
// GetPodStartTime returns start time of the given pod.
36+
// GetPodStartTime returns start time of the given pod or current timestamp
37+
// if it hasn't started yet.
3738
func GetPodStartTime(pod *v1.Pod) *metav1.Time {
3839
if pod.Status.StartTime != nil {
3940
return pod.Status.StartTime
4041
}
41-
// Should not reach here as the start time of a running time should not be nil
42-
// Return current timestamp as the default value.
43-
// This will not affect the calculation of earliest timestamp of all the pods on one node,
44-
// because current timestamp is always after the StartTime of any pod in good state.
45-
klog.Errorf("pod.Status.StartTime is nil for pod %s. Should not reach here.", pod.Name)
42+
// Assumed pods and bound pods that haven't started don't have a StartTime yet.
4643
return &metav1.Time{Time: time.Now()}
4744
}
4845

49-
// lessFunc is a function that receives two items and returns true if the first
50-
// item should be placed before the second one when the list is sorted.
51-
type lessFunc = func(item1, item2 interface{}) bool
52-
5346
// GetEarliestPodStartTime returns the earliest start time of all pods that
5447
// have the highest priority among all victims.
5548
func GetEarliestPodStartTime(victims *extenderv1.Victims) *metav1.Time {

0 commit comments

Comments
 (0)