Commit 274e336d authored by Alain Takoudjou's avatar Alain Takoudjou

Fix slave parameters

parent 1eb696a0
......@@ -18,11 +18,11 @@ md5sum = 5b6d18ff660516bf583cf4fe2c2b8059
[template-sozu]
filename = instance-sozu.cfg.jinja2.in
md5sum = 54c9b0eee8b29d2a8084291ca4e9b643
md5sum = ea453374e67377ce5b9acda7976a0a0e
[config.toml]
filename = config.toml.in
md5sum = f5551578f81b01eadc68fe3da2191013
md5sum = 6d15b97ae88f6a6529cc7d993a58a163
[publish-sozu-slave-parameters.cfg]
filename = publish-sozu-slave-parameters.cfg.in
......
......@@ -242,13 +242,13 @@ certificate_chain = "{{ parameter_dict['cert-chain-file'] }}"
# the protocol option indicates if we will use HTTP or TCP proxying
# possible options are "http" or "tcp"
protocol = "{{ cluster_dict['protocol'] }}"
protocol = "{{ cluster_dict.get('protocol', 'http') }}"
# per cluster load balancing algorithm. The possible values are
# "ROUND_ROBIN", "RANDOM", "LEAST_LOADED" and "POWER_OF_TWO". Defaults to "ROUND_ROBIN"
load_balancing = "{{ cluster_dict['load-balancing'] }}"
load_balancing = "{{ cluster_dict.get('load-balancing', 'ROUND_ROBIN') }}"
# metric evaluating the load on the backend. available options: connections, requests, connection_time
load_metric = "{{ cluster_dict['load-metric'] }}"
load_metric = "{{ cluster_dict.get('load-metric', 'connections') }}"
# frontends configuration
# this specifies which listeners; domains, certificates that will be configured for a cluster
......
......@@ -45,36 +45,28 @@ wrapper = ${directory:tmp}/ca-${:name}
{% set name = instance_dict['slave_reference'] -%}
{% set cert_section_name = '${' ~ name ~ '-ssl:cert-file}' -%}
{% set key_section_name = '${' ~ name ~ '-ssl:key-file}' -%}
{% set slave_dict = {
'name': name.replace('-', '_').lower(),
'protocol': instance_dict.get('protocol', 'http'),
'load-balancing': instance_dict.get('load-balancing', 'ROUND_ROBIN'),
'load-metric': instance_dict.get('load-metric', 'connections'),
'frontend-dict': instance_dict['frontend-dict'],
'backend-dict': instance_dict['backend-dict']
} -%}
[{{ name }}-ssl]
<= ca-certificate-base
name = {{ name }}
{% for cluster_name, cluster_dict in slave_dict['frontend-dict'].items() %}
{% for cluster_name, cluster_dict in instance_dict['frontend-dict'].items() %}
{% if cluster_dict.get('deploy-certificate') -%}
{% do slave_dict['frontend-dict'][cluster_name].__setitem__('certificate', '${' ~ name ~ '-ssl:cert-file}') -%}
{% do slave_dict['frontend-dict'][cluster_name].__setitem__('key', '${' ~ name ~ '-ssl:key-file}') -%}
{% do slave_dict['frontend-dict'][cluster_name].__setitem__('certificate-chain', '${' ~ name ~ '-ssl:chain-file}') -%}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('certificate', '${' ~ name ~ '-ssl:cert-file}') -%}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('key', '${' ~ name ~ '-ssl:key-file}') -%}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('certificate-chain', '${' ~ name ~ '-ssl:chain-file}') -%}
{% elif cluster_dict.get('certificate') and cluster_dict.get('key') and cluster_dict.get('certificate-chain') -%}
{{ createfile(name ~ cluster_name ~ "-crt", "${directory:dssl}/" ~ name ~ cluster_name ~ ".crt", cluster_dict['certificate']) }}
{{ createfile(name ~ cluster_name ~ "-key", "${directory:dssl}/" ~ name ~ cluster_name ~ ".key", cluster_dict['key']) }}
{{ createfile(name ~ cluster_name ~ "-chain", "${directory:dssl}/" ~ name ~ cluster_name ~ "-chain.crt", cluster_dict['certificate-chain']) }}
{% do slave_dict['frontend-dict'][cluster_name].__setitem__('certificate', '${' ~ name ~ cluster_name~ '-crt:output}') -%}
{% do slave_dict['frontend-dict'][cluster_name].__setitem__('key', '${' ~ name ~ cluster_name~ '-key:output}') -%}
{% do slave_dict['frontend-dict'][cluster_name].__setitem__('certificate-chain', '${' ~ name ~ cluster_name~ '-chain:output}') -%}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('certificate', '${' ~ name ~ cluster_name~ '-crt:output}') -%}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('key', '${' ~ name ~ cluster_name~ '-key:output}') -%}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('certificate-chain', '${' ~ name ~ cluster_name~ '-chain:output}') -%}
{% endif -%}
{% endfor -%}
{% do cluster_definition_dict.__setitem__(slave_dict['name'], slave_dict) -%}
{% do cluster_definition_dict.__setitem__(instance_dict['name'], instance_dict) -%}
{% endfor -%}
[sozu-parameters]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment