From 581c17169c8d62cc24d5c9a0041fc5fa1d242177 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Fri, 30 Sep 2016 15:23:38 -0700 Subject: [PATCH] Include attempt in the pod name Signed-off-by: Mrunal Patel --- server/sandbox.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/sandbox.go b/server/sandbox.go index f1a5583e..7d20bc20 100644 --- a/server/sandbox.go +++ b/server/sandbox.go @@ -40,7 +40,7 @@ func (s *sandbox) removeContainer(c *oci.Container) { s.containers.Delete(c.Name()) } -func (s *Server) generatePodIDandName(name, namespace string) (string, string, error) { +func (s *Server) generatePodIDandName(name string, namespace string, attempt uint32) (string, string, error) { var ( err error id = stringid.GenerateNonCryptoID() @@ -48,7 +48,8 @@ func (s *Server) generatePodIDandName(name, namespace string) (string, string, e if namespace == "" { namespace = podDefaultNamespace } - if name, err = s.reservePodName(id, namespace+"-"+name); err != nil { + + if name, err = s.reservePodName(id, fmt.Sprintf("%s-%s-%v", namespace, name, attempt)); err != nil { return "", "", err } return id, name, err @@ -63,9 +64,10 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest } namespace := req.GetConfig().GetMetadata().GetNamespace() + attempt := req.GetConfig().GetMetadata().GetAttempt() var err error - id, name, err := s.generatePodIDandName(name, namespace) + id, name, err := s.generatePodIDandName(name, namespace, attempt) if err != nil { return nil, err }