y8/rancher-localroute

Allow specifying of HOST_IP

whs opened this issue · 4 comments

whs commented

I'm running Rancher in vagrant environment. As vagrant has a hard requirement that the first NIC is NAT interface, the public interface will never be the first one.

I've seen a mention of HOST_IP at https://github.com/y8/rancher-localroute/blob/master/iptables-poller#L116 . Is that implemented? I tried spawning a container with HOST_IP env set but it still use the first interface address.

y8 commented

Hi.

Ooppsie, yeah, HOST_IP is not implemented yet. But seems like it's also a good idea to make it possible to set the interface name?

y8 commented

Okay, we're bumped in few other related cases, so I'm going this way:

  1. You can explicitly set the POLLER_HOST_IP with 1 or more IP addresses separated by ','.
  2. You can set an interface name with POLLER_IFACE, then all ip's available on this interface will be used to populate iptables, like POLLER_IFACE=eth0.
  3. If this this variables are not set, then the first non lo interface will be used.

I'll push the updated version a bit later tomorrow.

y8 commented

Also, if no POLLER_HOST_IP given, we should poll selected interface for IP changes as well.

y8 commented

Version 0.2.0 released, upgrade to the yopp/rancher-localroute:0.2.0 for the fix.

In your case just set the POLLER_IFACE to the name of the Vargant interface.