Avoid panics when logging a nil pod.deletionTimestamp

This commit is contained in:
Tomas Tormo 2024-01-12 08:45:36 +00:00
parent 157da7d52e
commit 9a3f1a3164

View File

@ -951,7 +951,7 @@ func FilterActivePods(logger klog.Logger, pods []*v1.Pod) []*v1.Pod {
if IsPodActive(p) {
result = append(result, p)
} else {
logger.V(4).Info("Ignoring inactive pod", "pod", klog.KObj(p), "phase", p.Status.Phase, "deletionTime", p.DeletionTimestamp)
logger.V(4).Info("Ignoring inactive pod", "pod", klog.KObj(p), "phase", p.Status.Phase, "deletionTime", klog.SafePtr(p.DeletionTimestamp))
}
}
return result