server: restore sandbox created time from disk
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
59e3f98b6d
commit
3bd4811b3b
2 changed files with 8 additions and 1 deletions
|
@ -271,7 +271,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
g.AddAnnotation("crio/kube_name", kubeName)
|
||||
|
||||
created := time.Now()
|
||||
g.AddAnnotation("ocid/created", created.Format(time.RFC3339Nano))
|
||||
g.AddAnnotation("crio/created", created.Format(time.RFC3339Nano))
|
||||
|
||||
sb := &sandbox{
|
||||
id: id,
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/containers/image/types"
|
||||
|
@ -200,6 +201,11 @@ func (s *Server) loadSandbox(id string) error {
|
|||
|
||||
privileged := m.Annotations["crio/privileged_runtime"] == "true"
|
||||
|
||||
created, err := time.Parse(time.RFC3339Nano, m.Annotations["crio/created"])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sb := &sandbox{
|
||||
id: id,
|
||||
name: name,
|
||||
|
@ -214,6 +220,7 @@ func (s *Server) loadSandbox(id string) error {
|
|||
shmPath: m.Annotations["crio/shm_path"],
|
||||
privileged: privileged,
|
||||
resolvPath: m.Annotations["crio/resolv_path"],
|
||||
created: created,
|
||||
}
|
||||
|
||||
// We add a netNS only if we can load a permanent one.
|
||||
|
|
Loading…
Reference in a new issue