From 80a789bce37d232feaf5dfc1c07a4a3bf33cb724 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 11 May 2017 10:43:50 +0200 Subject: [PATCH] server: store sandbox creation time Signed-off-by: Antonio Murdaca --- server/sandbox.go | 2 ++ server/sandbox_run.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/server/sandbox.go b/server/sandbox.go index 0f57f557..ffcef13f 100644 --- a/server/sandbox.go +++ b/server/sandbox.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" "sync" + "time" "github.com/Sirupsen/logrus" "github.com/containernetworking/cni/pkg/ns" @@ -145,6 +146,7 @@ type sandbox struct { privileged bool resolvPath string hostname string + created time.Time } const ( diff --git a/server/sandbox_run.go b/server/sandbox_run.go index 9fa6bc7e..fb0abe42 100644 --- a/server/sandbox_run.go +++ b/server/sandbox_run.go @@ -8,6 +8,7 @@ import ( "strconv" "strings" "syscall" + "time" "github.com/Sirupsen/logrus" "github.com/containers/storage" @@ -269,6 +270,9 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest g.AddAnnotation("crio/hostname", hostname) g.AddAnnotation("crio/kube_name", kubeName) + created := time.Now() + g.AddAnnotation("ocid/created", created.Format(time.RFC3339Nano)) + sb := &sandbox{ id: id, namespace: namespace, @@ -285,6 +289,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest privileged: privileged, resolvPath: resolvPath, hostname: hostname, + created: created, } defer func() {