aboutsummaryrefslogtreecommitdiff
path: root/libpod/pod.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-06-09 15:49:21 -0400
committerGitHub <noreply@github.com>2022-06-09 15:49:21 -0400
commite7db6d4893fe4c583dc492f4870a16085f3c9f70 (patch)
tree615e9078760ce3b0b7a2ad382ca5e1b2c266a377 /libpod/pod.go
parent0405e7c161dab4cfc9fdc846b83ca585156e25a1 (diff)
parentb13fc1bf983860d0627155ddbbbf28bf09e29a9e (diff)
downloadpodman-e7db6d4893fe4c583dc492f4870a16085f3c9f70.tar.gz
podman-e7db6d4893fe4c583dc492f4870a16085f3c9f70.tar.bz2
podman-e7db6d4893fe4c583dc492f4870a16085f3c9f70.zip
Merge pull request #14480 from cdoern/infra
patch for pod host networking & other host namespace handling
Diffstat (limited to 'libpod/pod.go')
-rw-r--r--libpod/pod.go27
1 files changed, 3 insertions, 24 deletions
diff --git a/libpod/pod.go b/libpod/pod.go
index 3c8dc43d4..108317637 100644
--- a/libpod/pod.go
+++ b/libpod/pod.go
@@ -178,8 +178,8 @@ func (p *Pod) NetworkMode() string {
return infra.NetworkMode()
}
-// PidMode returns the PID mode given by the user ex: pod, private...
-func (p *Pod) PidMode() string {
+// Namespace Mode returns the given NS mode provided by the user ex: host, private...
+func (p *Pod) NamespaceMode(kind specs.LinuxNamespaceType) string {
infra, err := p.runtime.GetContainer(p.state.InfraContainerID)
if err != nil {
return ""
@@ -187,28 +187,7 @@ func (p *Pod) PidMode() string {
ctrSpec := infra.config.Spec
if ctrSpec != nil && ctrSpec.Linux != nil {
for _, ns := range ctrSpec.Linux.Namespaces {
- if ns.Type == specs.PIDNamespace {
- if ns.Path != "" {
- return fmt.Sprintf("ns:%s", ns.Path)
- }
- return "private"
- }
- }
- return "host"
- }
- return ""
-}
-
-// PidMode returns the PID mode given by the user ex: pod, private...
-func (p *Pod) UserNSMode() string {
- infra, err := p.infraContainer()
- if err != nil {
- return ""
- }
- ctrSpec := infra.config.Spec
- if ctrSpec != nil && ctrSpec.Linux != nil {
- for _, ns := range ctrSpec.Linux.Namespaces {
- if ns.Type == specs.UserNamespace {
+ if ns.Type == kind {
if ns.Path != "" {
return fmt.Sprintf("ns:%s", ns.Path)
}