diff options
author | Christian Felder <c.felder@fz-juelich.de> | 2020-03-26 15:12:22 +0100 |
---|---|---|
committer | Christian Felder <c.felder@fz-juelich.de> | 2020-03-27 10:00:01 +0100 |
commit | 91dbdff77e159fb5377cd57733a05c72cbd94c97 (patch) | |
tree | 2774d13e8d045e4ae8a4ec5f3c9829f8d0d391d4 /pkg | |
parent | 90d82eb0349850521fcc53a4ddafa08e0785ebf0 (diff) | |
download | podman-91dbdff77e159fb5377cd57733a05c72cbd94c97.tar.gz podman-91dbdff77e159fb5377cd57733a05c72cbd94c97.tar.bz2 podman-91dbdff77e159fb5377cd57733a05c72cbd94c97.zip |
Add support for specifying CNI networks in podman play kube
Fixes: #5609
Signed-off-by: Christian Felder <c.felder@fz-juelich.de>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/adapter/pods.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go index 9a83e9945..64ebd3954 100644 --- a/pkg/adapter/pods.go +++ b/pkg/adapter/pods.go @@ -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 { |