From 02c6df04364a7e21399f7a8f65c634a2a4422848 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 10 May 2022 20:30:09 +0800 Subject: [PATCH] Treat Timestamp as nanoseconds which response by PodSandboxStatus(e.g. CRI-O) and fix zero Timestamp without setting (e.g. containerd) change to now. --- pkg/kubelet/kuberuntime/kuberuntime_manager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager.go b/pkg/kubelet/kuberuntime/kuberuntime_manager.go index 78e2ce5f2b5..beaf5884f92 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager.go @@ -1536,7 +1536,7 @@ func (m *kubeGenericRuntimeManager) GetPodStatus(ctx context.Context, uid kubety sandboxStatuses := []*runtimeapi.PodSandboxStatus{} containerStatuses := []*kubecontainer.Status{} - var timestamp time.Time + timestamp := time.Now() podIPs := []string{} for idx, podSandboxID := range podSandboxIDs { @@ -1580,7 +1580,7 @@ func (m *kubeGenericRuntimeManager) GetPodStatus(ctx context.Context, uid kubety } else { // Get the statuses of all containers visible to the pod and // timestamp from sandboxStatus. - timestamp = time.Unix(resp.Timestamp, 0) + timestamp = time.Unix(0, resp.Timestamp) for _, cs := range resp.ContainersStatuses { cStatus := m.convertToKubeContainerStatus(cs) containerStatuses = append(containerStatuses, cStatus)