Merge pull request #291 from nalind/clearindex
Clear index entries when removing pods or ctrs
This commit is contained in:
commit
4cfbdb261e
1 changed files with 9 additions and 0 deletions
|
@ -60,6 +60,9 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR
|
||||||
|
|
||||||
s.releaseContainerName(c.Name())
|
s.releaseContainerName(c.Name())
|
||||||
s.removeContainer(c)
|
s.removeContainer(c)
|
||||||
|
if err := s.ctrIDIndex.Delete(c.ID()); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to delete container %s in pod sandbox %s from index: %v", c.Name(), sb.id, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := label.UnreserveLabel(sb.processLabel); err != nil {
|
if err := label.UnreserveLabel(sb.processLabel); err != nil {
|
||||||
|
@ -85,9 +88,15 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR
|
||||||
s.releaseContainerName(podInfraContainer.Name())
|
s.releaseContainerName(podInfraContainer.Name())
|
||||||
s.removeContainer(podInfraContainer)
|
s.removeContainer(podInfraContainer)
|
||||||
sb.infraContainer = nil
|
sb.infraContainer = nil
|
||||||
|
if err := s.ctrIDIndex.Delete(podInfraContainer.ID()); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to delete infra container %s in pod sandbox %s from index: %v", podInfraContainer.ID(), sb.id, err)
|
||||||
|
}
|
||||||
|
|
||||||
s.releasePodName(sb.name)
|
s.releasePodName(sb.name)
|
||||||
s.removeSandbox(sb.id)
|
s.removeSandbox(sb.id)
|
||||||
|
if err := s.podIDIndex.Delete(sb.id); err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to pod sandbox %s from index: %v", sb.id, err)
|
||||||
|
}
|
||||||
|
|
||||||
resp := &pb.RemovePodSandboxResponse{}
|
resp := &pb.RemovePodSandboxResponse{}
|
||||||
logrus.Debugf("RemovePodSandboxResponse %+v", resp)
|
logrus.Debugf("RemovePodSandboxResponse %+v", resp)
|
||||||
|
|
Loading…
Reference in a new issue