On 04/08/2017 01:27 AM, Aleksandar Lazic wrote:
Hi Frederic
Hi Aleksandar,
Am 07-04-2017 15:00, schrieb Frederic Lecaille:
Hello Haproxy ML,
Here are patches attached to this mail to add "server templates"
feature to haproxy.
Please can you explain a little bit more the use case, thanks.
I'm sure there is a valid use case but I don't understand it.
haproxy allocates as much as possible everything required before
starting doing its job. This is the case for 'server' objects. A static
predefined list of servers, written in configuration files, is
potentially allocated for each backend during configuration files parsing.
With server templates, haproxy could preallocate 'server' objects which
would derive from 'default-server' (with same settings as default server
settings), but with remaining parameters which are unknown at parsing
time (for instance their names, addresses, anything else). In fact here,
names or addresses are particular settings: a default server has not any
default name or default address.
With server templates, haproxy would not have to allocate any 'server'
after having parsed its configuration files. It could use an already
allocated server template and set its remaining settings which were
unknown at configuration files parsing time.
This may be useful to instantiate servers which are discovered after
having parsed any configuration files.
The two first patches consist in moving code to be reused both during
'server' lines parsing and during and server templates
initializations.
A new CLI command has also been added (see "init server-templates
backend).
I think this is a more general request which could be discussed in
another thread. From my point of view, regarding server templates, as
they are more dynamic than 'server's, they are not supposed to be saved,
because potentially different between two different haproxy runs.
Regards,
Fred.