diff options
author | Brent Baude <bbaude@redhat.com> | 2021-05-07 14:14:59 -0500 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2021-06-01 10:13:18 -0500 |
commit | 7ef3981abe2412727840a2886489a08c03a05299 (patch) | |
tree | a616723311b745a6902199d296c6655d1307497e /cmd/podman/common | |
parent | 7dd463bad1b53802caf3cc1e1e1cc4a250e1667a (diff) | |
download | podman-7ef3981abe2412727840a2886489a08c03a05299.tar.gz podman-7ef3981abe2412727840a2886489a08c03a05299.tar.bz2 podman-7ef3981abe2412727840a2886489a08c03a05299.zip |
Enable port forwarding on host
Using the gvproxy application on the host, we can now port forward from
the machine vm on the host. It requires that 'gvproxy' be installed in
an executable location. gvproxy can be found in the
containers/gvisor-tap-vsock github repo.
[NO TESTS NEEDED]
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman/common')
-rw-r--r-- | cmd/podman/common/netflags.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/podman/common/netflags.go b/cmd/podman/common/netflags.go index 9941bc716..4f634f355 100644 --- a/cmd/podman/common/netflags.go +++ b/cmd/podman/common/netflags.go @@ -85,7 +85,10 @@ func DefineNetFlags(cmd *cobra.Command) { ) } -func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) { +// NetFlagsToNetOptions parses the network flags for the given cmd. +// The netnsFromConfig bool is used to indicate if the --network flag +// should always be parsed regardless if it was set on the cli. +func NetFlagsToNetOptions(cmd *cobra.Command, netnsFromConfig bool) (*entities.NetOptions, error) { var ( err error ) @@ -193,7 +196,9 @@ func NetFlagsToNetOptions(cmd *cobra.Command) (*entities.NetOptions, error) { return nil, err } - if cmd.Flags().Changed("network") { + // parse the --network value only when the flag is set or we need to use + // the netns config value, e.g. when --pod is not used + if netnsFromConfig || cmd.Flag("network").Changed { network, err := cmd.Flags().GetString("network") if err != nil { return nil, err |