summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-06 18:45:25 +0200
committerGitHub <noreply@github.com>2020-04-06 18:45:25 +0200
commite318b09b6800ddb013ddf3b9a2fb99ebc55bd920 (patch)
tree8c43be5292fdf5d3c0686572b89a8e92e6e8fe25 /pkg
parent09f553cc8054a670cb2c333ee47de4311d325635 (diff)
parent91dbdff77e159fb5377cd57733a05c72cbd94c97 (diff)
downloadpodman-e318b09b6800ddb013ddf3b9a2fb99ebc55bd920.tar.gz
podman-e318b09b6800ddb013ddf3b9a2fb99ebc55bd920.tar.bz2
podman-e318b09b6800ddb013ddf3b9a2fb99ebc55bd920.zip
Merge pull request #5620 from cfelder/play-kube-networking
Add support for specifying CNI networks in podman play kube
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/pods.go18
1 files changed, 17 insertions, 1 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index 102eabd8b..7c2a84cc7 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -343,7 +343,7 @@ func (r *LocalRuntime) CreatePod(ctx context.Context, cli *cliconfig.PodCreateVa
logrus.Debugf("Pod will use host networking")
options = append(options, libpod.WithPodHostNetwork())
case "":
- return "", errors.Errorf("invalid value passed to --net: must provide a comma-separated list of CNI networks or host")
+ return "", errors.Errorf("invalid value passed to --network: must provide a comma-separated list of CNI networks or host")
default:
// We'll assume this is a comma-separated list of CNI
// networks.
@@ -595,6 +595,22 @@ func (r *LocalRuntime) PlayKubeYAML(ctx context.Context, c *cliconfig.KubePlayVa
podPorts := getPodPorts(podYAML.Spec.Containers)
podOptions = append(podOptions, libpod.WithInfraContainerPorts(podPorts))
+ if c.Flag("network").Changed {
+ netValue := c.String("network")
+ switch strings.ToLower(netValue) {
+ case "bridge", "host":
+ return nil, errors.Errorf("invalid value passed to --network: bridge or host networking must be configured in YAML")
+ case "":
+ return nil, errors.Errorf("invalid value passed to --network: must provide a comma-separated list of CNI networks")
+ default:
+ // We'll assume this is a comma-separated list of CNI
+ // networks.
+ networks := strings.Split(netValue, ",")
+ logrus.Debugf("Pod joining CNI networks: %v", networks)
+ podOptions = append(podOptions, libpod.WithPodNetworks(networks))
+ }
+ }
+
// Create the Pod
pod, err = r.NewPod(ctx, podOptions...)
if err != nil {