aboutsummaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-11-30 10:23:28 -0600
committerbaude <bbaude@redhat.com>2018-12-03 15:49:17 -0600
commit9c359a31d542074ff686a2f9ad29deee73e92d79 (patch)
treee53e04da83ac3c4def3118025f50e35fc836f83f /pkg
parent5f6ad82524ca7a3281c8464c84b4f9be4ff90aef (diff)
downloadpodman-9c359a31d542074ff686a2f9ad29deee73e92d79.tar.gz
podman-9c359a31d542074ff686a2f9ad29deee73e92d79.tar.bz2
podman-9c359a31d542074ff686a2f9ad29deee73e92d79.zip
create pod on the fly
when a user specifies --pod to podman create|run, we should create that pod automatically. the port bindings from the container are then inherited by the infra container. this signicantly improves the workflow of running containers inside pods with podman. the user is still encouraged to use podman pod create to have more granular control of the pod create options. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/spec/createconfig.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index a0fd40318..25f8cd7a1 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -496,8 +496,13 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime) ([]lib
// CreatePortBindings iterates ports mappings and exposed ports into a format CNI understands
func (c *CreateConfig) CreatePortBindings() ([]ocicni.PortMapping, error) {
+ return NatToOCIPortBindings(c.PortBindings)
+}
+
+// NatToOCIPortBindings iterates a nat.portmap slice and creates []ocicni portmapping slice
+func NatToOCIPortBindings(ports nat.PortMap) ([]ocicni.PortMapping, error) {
var portBindings []ocicni.PortMapping
- for containerPb, hostPb := range c.PortBindings {
+ for containerPb, hostPb := range ports {
var pm ocicni.PortMapping
pm.ContainerPort = int32(containerPb.Int())
for _, i := range hostPb {