468
468
_unit = unit.replace('/', '-')
469
469
cluster_hosts[laddr]['backends'][_unit] = _laddr
471
# NOTE(jamespage) no split configurations found, just use
473
if not cluster_hosts:
474
netmask = get_netmask_for_address(addr)
475
cluster_hosts[addr] = {'network': "{}/{}".format(addr, netmask),
476
'backends': {l_unit: addr}}
477
for rid in relation_ids('cluster'):
478
for unit in related_units(rid):
479
_laddr = relation_get('private-address',
482
_unit = unit.replace('/', '-')
483
cluster_hosts[addr]['backends'][_unit] = _laddr
471
# NOTE(jamespage) add backend based on private address - this
472
# with either be the only backend or the fallback if no acls
473
# match in the frontend
474
cluster_hosts[addr] = {}
475
netmask = get_netmask_for_address(addr)
476
cluster_hosts[addr] = {'network': "{}/{}".format(addr, netmask),
477
'backends': {l_unit: addr}}
478
for rid in relation_ids('cluster'):
479
for unit in related_units(rid):
480
_laddr = relation_get('private-address',
483
_unit = unit.replace('/', '-')
484
cluster_hosts[addr]['backends'][_unit] = _laddr
485
ctxt = {'frontends': cluster_hosts}
487
'frontends': cluster_hosts,
488
'default_backend': addr
487
491
if config('haproxy-server-timeout'):
488
492
ctxt['haproxy_server_timeout'] = config('haproxy-server-timeout')