From 5f8225c009fcf297139c54c7b329da4aff679ece Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Thu, 2 May 2019 19:33:19 -0700 Subject: [PATCH] runsc: don't create an empty network namespace if NetworkHost is set With this change, we will be able to run runsc do in a host network namespace. PiperOrigin-RevId: 246436660 Change-Id: I8ea18b1053c88fe2feed74239b915fe7a151ce34 --- runsc/sandbox/sandbox.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index 9d8cfa451..bc69a9d61 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -472,6 +472,8 @@ func (s *Sandbox) createSandboxProcess(spec *specs.Spec, conf *boot.Config, bund if ns, ok := specutils.GetNS(specs.NetworkNamespace, spec); ok && conf.Network != boot.NetworkNone { log.Infof("Sandbox will be started in the container's network namespace: %+v", ns) nss = append(nss, ns) + } else if conf.Network == boot.NetworkHost { + log.Infof("Sandbox will be started in the host network namespace") } else { log.Infof("Sandbox will be started in new network namespace") nss = append(nss, specs.LinuxNamespace{Type: specs.NetworkNamespace})