mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Merge pull request #87900 from alculquicondor/rm_log
Remove Error log for nil StartTime in preemption candidates
This commit is contained in:
commit
cf3ba4a26e
@ -33,23 +33,16 @@ func GetPodFullName(pod *v1.Pod) string {
|
|||||||
return pod.Name + "_" + pod.Namespace
|
return pod.Name + "_" + pod.Namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPodStartTime returns start time of the given pod.
|
// GetPodStartTime returns start time of the given pod or current timestamp
|
||||||
|
// if it hasn't started yet.
|
||||||
func GetPodStartTime(pod *v1.Pod) *metav1.Time {
|
func GetPodStartTime(pod *v1.Pod) *metav1.Time {
|
||||||
if pod.Status.StartTime != nil {
|
if pod.Status.StartTime != nil {
|
||||||
return pod.Status.StartTime
|
return pod.Status.StartTime
|
||||||
}
|
}
|
||||||
// Should not reach here as the start time of a running time should not be nil
|
// Assumed pods and bound pods that haven't started don't have a StartTime yet.
|
||||||
// Return current timestamp as the default value.
|
|
||||||
// This will not affect the calculation of earliest timestamp of all the pods on one node,
|
|
||||||
// because current timestamp is always after the StartTime of any pod in good state.
|
|
||||||
klog.Errorf("pod.Status.StartTime is nil for pod %s. Should not reach here.", pod.Name)
|
|
||||||
return &metav1.Time{Time: time.Now()}
|
return &metav1.Time{Time: time.Now()}
|
||||||
}
|
}
|
||||||
|
|
||||||
// lessFunc is a function that receives two items and returns true if the first
|
|
||||||
// item should be placed before the second one when the list is sorted.
|
|
||||||
type lessFunc = func(item1, item2 interface{}) bool
|
|
||||||
|
|
||||||
// GetEarliestPodStartTime returns the earliest start time of all pods that
|
// GetEarliestPodStartTime returns the earliest start time of all pods that
|
||||||
// have the highest priority among all victims.
|
// have the highest priority among all victims.
|
||||||
func GetEarliestPodStartTime(victims *extenderv1.Victims) *metav1.Time {
|
func GetEarliestPodStartTime(victims *extenderv1.Victims) *metav1.Time {
|
||||||
|
Loading…
Reference in New Issue
Block a user