summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2018-11-19 13:20:56 -0600
committerbaude <bbaude@redhat.com>2018-11-20 09:49:34 -0600
commit690c52a113124efcedccb84e44198e7602f064ec (patch)
tree9a11d0ad045ae8f72354a80ede4068f0a9cbbeab /libpod/options.go
parent4eecc8cf70728d733aa8d1c948093d9ae4a334df (diff)
downloadpodman-690c52a113124efcedccb84e44198e7602f064ec.tar.gz
podman-690c52a113124efcedccb84e44198e7602f064ec.tar.bz2
podman-690c52a113124efcedccb84e44198e7602f064ec.zip
Allow users to expose ports from the pod to the host
we need to allow users to expose ports to the host for the purposes of networking, like a webserver. the port exposure must be done at the time the pod is created. strictly speaking, the port exposure occurs on the infra container. Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 8d044313b..507847d65 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1295,3 +1295,14 @@ func WithInfraContainer() PodCreateOption {
return nil
}
}
+
+// WithInfraContainerPorts tells the pod to add port bindings to the pause container
+func WithInfraContainerPorts(bindings []ocicni.PortMapping) PodCreateOption {
+ return func(pod *Pod) error {
+ if pod.valid {
+ return ErrPodFinalized
+ }
+ pod.config.InfraContainer.PortBindings = bindings
+ return nil
+ }
+}