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
|
||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostNetwork() == false {
|
||||
err := g.AddOrReplaceLinuxNamespace("network", "")
|
||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostNetwork() {
|
||||
err := g.RemoveLinuxNamespace("network")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostPid() == false {
|
||||
err := g.AddOrReplaceLinuxNamespace("pid", "")
|
||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostPid() {
|
||||
err := g.RemoveLinuxNamespace("pid")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostIpc() == false {
|
||||
err := g.AddOrReplaceLinuxNamespace("ipc", "")
|
||||
if req.GetConfig().GetLinux().GetNamespaceOptions().GetHostIpc() {
|
||||
err := g.RemoveLinuxNamespace("ipc")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue