Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add port forwarding support and bump to 2.2.0 #19

Merged
merged 5 commits into from
Apr 19, 2024
Merged

Conversation

kanaka
Copy link
Member

@kanaka kanaka commented Apr 18, 2024

Add port forwarding support (conlink -> containers)

  • Add new 'forward' link property. This property is an array of strings
    of the form conlink_port:container_port/proto similar to docker port
    publishing.
  • Add 'link-forward.sh' script that will add (or delete) the iptables
    and route rules to accomplish the port forwarding from one interface
    to an IP on another interface with port remappping (NAT/masquerade).
  • Add a test10 example that shows a single forward definition forwarding
    to two container replicas and shows two forward defintions both
    forwarding to a single container service/port.

Also, small refactor in how docker's eth0 interface is detected and renamed (to support port forwarding) and some refactor to run-tests.sh to support tests invocations that are compose exec calls (i.e. curl from the outside to support port forwarding tests).

- Split out interface detection into intf-exists? function.
- Use 'intf-exists?' to check for 'eth0' (docker host bridge interface)
  and store result in ctx :docker-eth0? property.
- Some minor docs/formating changes.
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jonsmock jonsmock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay (interrupted by a meeting). Looks great to me, and thanks for updating the wording. I think the switch of node1 and node2 also needs the IP in the test to be updated, but otherwise, merge when ready!

The function that runs a docker-compose commmand becomes dc_run and
that's all it does (not wait loop). The main test running function that
includes the retry functionality is split out into a non-compose
specific function called do_test. If the WITH_DC environment variable is
set then it uses dc_run to run a command, otherwise it invokes the
arguments in a regular shell call.

The dc_wait and dc_test function become trivial wrappers around do_test.
Allow the minimum ping delay over the netem link to be anywhere from
80ms - 85ms instead of 80ms.
- Add new 'forward' link property. This property is an array of strings
  of the form `conlink_port:container_port/proto` similar to docker port
  publishing.
- Add 'link-forward.sh' script that will add (or delete) the iptables
  and route rules to accomplish the port forwarding from one interface
  to an IP on another interface with port remappping (NAT/masquerade).
- Add a test10 example that shows a single forward definition forwarding
  to two container replicas and shows two forward defintions both
  forwarding to a single container service/port.
@kanaka kanaka merged commit cbf89c1 into master Apr 19, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants