summaryrefslogtreecommitdiff
path: root/libpod/pod_api.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-09 23:06:51 +0200
committerGitHub <noreply@github.com>2020-05-09 23:06:51 +0200
commitdc7d6f4818f4b986cfd15208d53f6765d8fad986 (patch)
treefe6e50f86caace33f971446d2356dffecaea5c4c /libpod/pod_api.go
parent3ff96383f306cecfeed75986078144ad757e3d70 (diff)
parent8238b7e70688e637d58305287a19e4080f619587 (diff)
downloadpodman-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.go20
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,
}