summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-17 11:25:19 -0400
committerGitHub <noreply@github.com>2020-04-17 11:25:19 -0400
commit454fc9fecd75f8e5cd9819739de876c121f5989d (patch)
tree77e8a357559d2d5b143471997a2fb6433c8d0be0
parentd31dcb9bbd521fe8e3e78b0ebe2a893634ab2e6b (diff)
parent77d19f847a7488ccaccae769cf6b27f880ebe07b (diff)
downloadpodman-454fc9fecd75f8e5cd9819739de876c121f5989d.tar.gz
podman-454fc9fecd75f8e5cd9819739de876c121f5989d.tar.bz2
podman-454fc9fecd75f8e5cd9819739de876c121f5989d.zip
Merge pull request #5657 from AlbanBedel/network-name-fix
Fix the pod name passed to cni
-rw-r--r--libpod/networking_linux.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index c3a90f481..83344ebbe 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -101,7 +101,19 @@ func (r *Runtime) configureNetNS(ctr *Container, ctrNS ns.NetNS) ([]*cnitypes.Re
requestedMAC = ctr.config.StaticMAC
}
- podNetwork := r.getPodNetwork(ctr.ID(), ctr.Name(), ctrNS.Path(), ctr.config.Networks, ctr.config.PortMappings, requestedIP, requestedMAC)
+ // If we are in a pod use the pod name for the network, otherwise the container name
+ var podName string
+ if ctr.PodID() != "" {
+ pod, err := r.GetPod(ctr.PodID())
+ if err == nil {
+ podName = pod.Name()
+ }
+ }
+ if podName == "" {
+ podName = ctr.Name()
+ }
+
+ podNetwork := r.getPodNetwork(ctr.ID(), podName, ctrNS.Path(), ctr.config.Networks, ctr.config.PortMappings, requestedIP, requestedMAC)
results, err := r.netPlugin.SetUpPod(podNetwork)
if err != nil {