Fix logic for using host namespaces
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
7931cc4f4e
commit
8296898937
1 changed files with 6 additions and 6 deletions
|
@ -112,22 +112,22 @@ func (s *Server) CreatePodSandbox(ctx context.Context, req *pb.CreatePodSandboxR
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up namespaces
|
// set up namespaces
|
||||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostNetwork() == false {
|
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostNetwork() {
|
||||||
err := g.AddOrReplaceLinuxNamespace("network", "")
|
err := g.RemoveLinuxNamespace("network")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostPid() == false {
|
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostPid() {
|
||||||
err := g.AddOrReplaceLinuxNamespace("pid", "")
|
err := g.RemoveLinuxNamespace("pid")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostIpc() == false {
|
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostIpc() {
|
||||||
err := g.AddOrReplaceLinuxNamespace("ipc", "")
|
err := g.RemoveLinuxNamespace("ipc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue