Skip to content

Commit 02c6df0

Browse files
dimsyaojunyu
authored andcommitted
Treat Timestamp as nanoseconds which response by PodSandboxStatus(e.g. CRI-O) and fix zero Timestamp without setting (e.g. containerd) change to now.
1 parent 2108e54 commit 02c6df0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/kubelet/kuberuntime/kuberuntime_manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,7 +1536,7 @@ func (m *kubeGenericRuntimeManager) GetPodStatus(ctx context.Context, uid kubety
15361536

15371537
sandboxStatuses := []*runtimeapi.PodSandboxStatus{}
15381538
containerStatuses := []*kubecontainer.Status{}
1539-
var timestamp time.Time
1539+
timestamp := time.Now()
15401540

15411541
podIPs := []string{}
15421542
for idx, podSandboxID := range podSandboxIDs {
@@ -1580,7 +1580,7 @@ func (m *kubeGenericRuntimeManager) GetPodStatus(ctx context.Context, uid kubety
15801580
} else {
15811581
// Get the statuses of all containers visible to the pod and
15821582
// timestamp from sandboxStatus.
1583-
timestamp = time.Unix(resp.Timestamp, 0)
1583+
timestamp = time.Unix(0, resp.Timestamp)
15841584
for _, cs := range resp.ContainersStatuses {
15851585
cStatus := m.convertToKubeContainerStatus(cs)
15861586
containerStatuses = append(containerStatuses, cStatus)

0 commit comments

Comments
 (0)