Hi Cyril, Baptiste,

Just a quick response on this part to clear up some confusion.

On Mon, Jul 20, 2015 at 01:11:22AM +0200, Cyril Bonté wrote:
> >The idea here would to create a new flag on the server to tell HAProxy
> >which IP to use. The server would be enabled when the IP has been
> >provided by the expected tool.
> >IE, a new server directive could be "init-addr" (for inital IP
> >address) and would take a list of directive from 'libc', 'dns',
> >'a.b.c.d' (arbitrary IP address), etc... (non exhaustive live, more to
> >come...)
> >Currently, HAProxy works like this: "init-addr libc,dns"
> >A new value could be "init-addr dns"
> >Or "init-addr 1.2.3.4,dns"

In fact not, right now it's only "init-addr libc" since we cannot do DNS
during init time.

> To be clear, does it mean that we could meet such configuration ?
>   server server1 host1.somewhere:80 init-addr 127.0.0.1,libc,dns
> 
> Which would mean :
> - Use the init IP first
> - At start up, try to resolve whith the libc resolver
> - At runtime, try to resolve with HAProxy resolvers.

The purpose of init-addr was not this in fact but to declare how to
resolve the initial address. Ultimately if Baptiste's DNS code can
work out of the poll loop, we could consider using it for the very
first resolution. In your case, the idea would be to have then :

   init-addr dns,libc,127.0.0.1

or :

   init-addr dns,libc,none

This means :
  - try to resolve the name using DNS ;
  - if it fails, try again using libc ;
  - if it fails, use 127.0.0.1 or don't set any address

This last option (hard-coded value or "none") allows the server to
start eventhough the resolution failed. We wanted to support an extra
keyword such as "last" when haproxy is restarted and a dump file is
present to provide the last IP address. It will solve the different
needs of different people who want to set some preferences on config
or on last dump, or on dns, etc...

> Then, maybe we'll have to prevent such (un)funny things :
>   server server1 192.0.2.1:80 init-addr 127.0.0.1,libc,dns

It's not absurd because this address is also the one used by the checks
by default and some people might want it to continue to work this way.

Regards,
Willy


Reply via email to