Skip to content

Commit a8bbdd6

Browse files
committed
proxy sandbox removal with strictly exact ip
1 parent b33668c commit a8bbdd6

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/orchestrator/internal/proxy/proxy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func (p *SandboxProxy) AddSandbox(sandboxID, ip string) {
4343
p.sandboxes.Insert(sandboxID, ip)
4444
}
4545

46-
func (p *SandboxProxy) RemoveSandbox(sandboxID string) {
47-
p.sandboxes.Remove(sandboxID)
46+
func (p *SandboxProxy) RemoveSandbox(sandboxID string, ip string) {
47+
p.sandboxes.RemoveCb(sandboxID, func(k string, v string, ok bool) bool { return ok && v == ip })
4848
}
4949

5050
func (p *SandboxProxy) Start() error {

packages/orchestrator/internal/sandbox/sandbox_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ func NewSandbox(
322322

323323
cleanup.Add(func() error {
324324
dns.Remove(config.SandboxId, ips.HostIP())
325-
proxy.RemoveSandbox(config.SandboxId)
325+
proxy.RemoveSandbox(config.SandboxId, ips.HostIP())
326326

327327
return nil
328328
})

packages/orchestrator/internal/server/sandboxes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ func (s *server) Delete(ctxConn context.Context, in *orchestrator.SandboxDeleteR
183183

184184
// Don't allow connecting to the sandbox anymore.
185185
s.dns.Remove(in.SandboxId, sbx.Slot.HostIP())
186-
s.proxy.RemoveSandbox(in.SandboxId)
186+
s.proxy.RemoveSandbox(in.SandboxId, sbx.Slot.HostIP())
187187

188188
// Remove the sandbox from the cache to prevent loading it again in API during the time the instance is stopping.
189189
// Old comment:

0 commit comments

Comments
 (0)