Merge pull request #433 from sameo/topic/sandboxrun-fixes
server: Fix RunPodSandbox error path
This commit is contained in:
commit
0854c081ec
1 changed files with 6 additions and 5 deletions
|
@ -282,19 +282,20 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
||||||
hostname: hostname,
|
hostname: hostname,
|
||||||
}
|
}
|
||||||
|
|
||||||
s.addSandbox(sb)
|
|
||||||
if err = s.podIDIndex.Add(id); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
s.removeSandbox(id)
|
||||||
if err2 := s.podIDIndex.Delete(id); err2 != nil {
|
if err2 := s.podIDIndex.Delete(id); err2 != nil {
|
||||||
logrus.Warnf("couldn't delete pod id %s from idIndex", id)
|
logrus.Warnf("couldn't delete pod id %s from idIndex", id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
s.addSandbox(sb)
|
||||||
|
if err = s.podIDIndex.Add(id); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
for k, v := range annotations {
|
for k, v := range annotations {
|
||||||
g.AddAnnotation(k, v)
|
g.AddAnnotation(k, v)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue