diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-05-09 23:06:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 23:06:51 +0200 |
commit | dc7d6f4818f4b986cfd15208d53f6765d8fad986 (patch) | |
tree | fe6e50f86caace33f971446d2356dffecaea5c4c /libpod/pod_api.go | |
parent | 3ff96383f306cecfeed75986078144ad757e3d70 (diff) | |
parent | 8238b7e70688e637d58305287a19e4080f619587 (diff) | |
download | podman-dc7d6f4818f4b986cfd15208d53f6765d8fad986.tar.gz podman-dc7d6f4818f4b986cfd15208d53f6765d8fad986.tar.bz2 podman-dc7d6f4818f4b986cfd15208d53f6765d8fad986.zip |
Merge pull request #6152 from mheon/fix_pod_join_cgroupns
Fix bug where pods would unintentionally share cgroupns
Diffstat (limited to 'libpod/pod_api.go')
-rw-r--r-- | libpod/pod_api.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libpod/pod_api.go b/libpod/pod_api.go index 45aa5cb8d..0be9f2573 100644 --- a/libpod/pod_api.go +++ b/libpod/pod_api.go @@ -466,6 +466,24 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) { if err != nil { return nil, err } + + namespaces := map[string]bool{ + "pid": p.config.UsePodPID, + "ipc": p.config.UsePodIPC, + "net": p.config.UsePodNet, + "mount": p.config.UsePodMount, + "user": p.config.UsePodUser, + "uts": p.config.UsePodUTS, + "cgroup": p.config.UsePodCgroupNS, + } + + sharesNS := []string{} + for nsStr, include := range namespaces { + if include { + sharesNS = append(sharesNS, nsStr) + } + } + inspectData := define.InspectPodData{ ID: p.ID(), Name: p.Name(), @@ -480,7 +498,7 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) { CreateInfra: false, InfraContainerID: p.state.InfraContainerID, InfraConfig: nil, - SharedNamespaces: nil, + SharedNamespaces: sharesNS, NumContainers: uint(len(containers)), Containers: ctrs, } |