Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Paul Graydon
slapos
Commits
2d3959df
Commit
2d3959df
authored
Nov 20, 2023
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sozu fixup for slave instance
parent
274e336d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
23 deletions
+38
-23
software/sozu/buildout.hash.cfg
software/sozu/buildout.hash.cfg
+4
-4
software/sozu/config.toml.in
software/sozu/config.toml.in
+7
-6
software/sozu/instance-sozu-slave-input-schema.json
software/sozu/instance-sozu-slave-input-schema.json
+4
-4
software/sozu/instance-sozu.cfg.jinja2.in
software/sozu/instance-sozu.cfg.jinja2.in
+5
-3
software/sozu/instance.cfg.in
software/sozu/instance.cfg.in
+6
-0
software/sozu/publish-sozu-slave-parameters.cfg.in
software/sozu/publish-sozu-slave-parameters.cfg.in
+12
-6
No files found.
software/sozu/buildout.hash.cfg
View file @
2d3959df
...
@@ -14,16 +14,16 @@
...
@@ -14,16 +14,16 @@
# not need these here).
# not need these here).
[instance.cfg]
[instance.cfg]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
5b6d18ff660516bf583cf4fe2c2b8059
md5sum =
8a714ed894c0eb99cd8de49e588d0af4
[template-sozu]
[template-sozu]
filename = instance-sozu.cfg.jinja2.in
filename = instance-sozu.cfg.jinja2.in
md5sum =
ea453374e67377ce5b9acda7976a0a0e
md5sum =
5ec499b5cab85d9aa2b55ea6ff3cf701
[config.toml]
[config.toml]
filename = config.toml.in
filename = config.toml.in
md5sum =
6d15b97ae88f6a6529cc7d993a58a163
md5sum =
3b407e5ee362e51de60ffb9f850f9cc0
[publish-sozu-slave-parameters.cfg]
[publish-sozu-slave-parameters.cfg]
filename = publish-sozu-slave-parameters.cfg.in
filename = publish-sozu-slave-parameters.cfg.in
md5sum =
92f4dc0e8c08d9a66a2833ed035a07f6
md5sum =
ee8dcb866fbe3b8916c6d2e5a28e19e3
software/sozu/config.toml.in
View file @
2d3959df
...
@@ -248,7 +248,7 @@ protocol = "{{ cluster_dict.get('protocol', 'http') }}"
...
@@ -248,7 +248,7 @@ protocol = "{{ cluster_dict.get('protocol', 'http') }}"
# "ROUND_ROBIN", "RANDOM", "LEAST_LOADED" and "POWER_OF_TWO". Defaults to "ROUND_ROBIN"
# "ROUND_ROBIN", "RANDOM", "LEAST_LOADED" and "POWER_OF_TWO". Defaults to "ROUND_ROBIN"
load_balancing = "{{ cluster_dict.get('load-balancing', 'ROUND_ROBIN') }}"
load_balancing = "{{ cluster_dict.get('load-balancing', 'ROUND_ROBIN') }}"
# metric evaluating the load on the backend. available options: connections, requests, connection_time
# metric evaluating the load on the backend. available options: connections, requests, connection_time
load_metric = "{{ cluster_dict.get('load-metric', '
connections
') }}"
load_metric = "{{ cluster_dict.get('load-metric', '
CONNECTIONS
') }}"
# frontends configuration
# frontends configuration
# this specifies which listeners; domains, certificates that will be configured for a cluster
# this specifies which listeners; domains, certificates that will be configured for a cluster
...
@@ -264,12 +264,13 @@ load_metric = "{{ cluster_dict.get('load-metric', 'connections') }}"
...
@@ -264,12 +264,13 @@ load_metric = "{{ cluster_dict.get('load-metric', 'connections') }}"
frontends = [
frontends = [
{% for _, frontend_dict in cluster_dict['frontend-dict'].items() -%}
{% for _, frontend_dict in cluster_dict['frontend-dict'].items() -%}
{% set enable_https = frontend_dict.get("certificate") and frontend_dict.get("key") and frontend_dict.get("chain") -%}
{% set enable_https = frontend_dict.get("certificate") and frontend_dict.get("key") and frontend_dict.get("chain") -%}
{% set tag_dict = {} -%}
{% set tag_list = [] -%}
{% for tag in frontend_dict['tag-list'] -%}
{% set user_tag_list = frontend_dict.get('tag-list', []) -%}
{% set k, v = tag.split('=') -%}
{% for tag in user_tag_list -%}
do tag_dict.__setitem__(k.strip(), v.strip()) -%}
{% set k, v = tag.split('=') -%}
{% do tag_list.append(k.strip() ~ '="' ~ v.strip() ~ '"') -%}
{% endfor -%}
{% endfor -%}
{ address = "{{ frontend_dict['address'] }}", hostname = "{{ frontend_dict.get('hostname') }}",
tags = tag_dict, path = "{{ frontend_dict.get('path', '') }}", path_type = {{ frontend_dict.get("path-type", "PREFIX") }}
, sticky_session = {{ frontend_dict.get("sticky-session", "false") }}, https_redirect = {{ frontend_dict.get("https-redirect", "false") }}{% if enable_https -%}, tls_versions = {{ frontend_dict.get("tls-versions", []) }}, certificate = "{{ frontend_dict['certificate'] }}", key = "{{ frontend_dict['key'] }}", certificate_chain = "{{ frontend_dict['chain'] }}" {% endif -%} },
{ address = "{{ frontend_dict['address'] }}", hostname = "{{ frontend_dict.get('hostname') }}",
{% if user_tag_list -%} tags = {{ tag_list | join(',') }}, {%- endif %} path = "{{ frontend_dict.get('path', '') }}", path_type = "{{ frontend_dict.get("path-type", "PREFIX") }}"
, sticky_session = {{ frontend_dict.get("sticky-session", "false") }}, https_redirect = {{ frontend_dict.get("https-redirect", "false") }}{% if enable_https -%}, tls_versions = {{ frontend_dict.get("tls-versions", []) }}, certificate = "{{ frontend_dict['certificate'] }}", key = "{{ frontend_dict['key'] }}", certificate_chain = "{{ frontend_dict['chain'] }}" {% endif -%} },
{% endfor -%}
{% endfor -%}
]
]
...
...
software/sozu/instance-sozu-slave-input-schema.json
View file @
2d3959df
...
@@ -29,11 +29,11 @@
...
@@ -29,11 +29,11 @@
"title"
:
"Load metric"
,
"title"
:
"Load metric"
,
"description"
:
"Metric evaluating the load on the backend. available options: connections, requests, connection_time."
,
"description"
:
"Metric evaluating the load on the backend. available options: connections, requests, connection_time."
,
"type"
:
"string"
,
"type"
:
"string"
,
"default"
:
"
connections
"
,
"default"
:
"
CONNECTIONS
"
,
"enum"
:
[
"enum"
:
[
"
connections
"
,
"
CONNECTIONS
"
,
"
requests
"
,
"
REQUESTS
"
,
"
connection_time
"
"
CONNECTION_TIME
"
]
]
},
},
"frontend-dict"
:
{
"frontend-dict"
:
{
...
...
software/sozu/instance-sozu.cfg.jinja2.in
View file @
2d3959df
...
@@ -41,8 +41,10 @@ cert-file = ${ca-directory:certs}/${:name}.key
...
@@ -41,8 +41,10 @@ cert-file = ${ca-directory:certs}/${:name}.key
executable = echo "request certificate"
executable = echo "request certificate"
wrapper = ${directory:tmp}/ca-${:name}
wrapper = ${directory:tmp}/ca-${:name}
{% for instance_dict in slave_instance_list -%}
{% for slave_dict in slave_instance_list %}
{% set name = instance_dict['slave_reference'] -%}
{% set instance_dict = json_module.loads(slave_dict['_']) -%}
{% set name = slave_dict['slave_reference'] -%}
{% set slave_title = slave_dict['slave_title'] -%}
{% set cert_section_name = '${' ~ name ~ '-ssl:cert-file}' -%}
{% set cert_section_name = '${' ~ name ~ '-ssl:cert-file}' -%}
{% set key_section_name = '${' ~ name ~ '-ssl:key-file}' -%}
{% set key_section_name = '${' ~ name ~ '-ssl:key-file}' -%}
...
@@ -66,7 +68,7 @@ name = {{ name }}
...
@@ -66,7 +68,7 @@ name = {{ name }}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('certificate-chain', '${' ~ name ~ cluster_name~ '-chain:output}') -%}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('certificate-chain', '${' ~ name ~ cluster_name~ '-chain:output}') -%}
{% endif -%}
{% endif -%}
{% endfor -%}
{% endfor -%}
{% do cluster_definition_dict.__setitem__(
instance_dict['name']
, instance_dict) -%}
{% do cluster_definition_dict.__setitem__(
name
, instance_dict) -%}
{% endfor -%}
{% endfor -%}
[sozu-parameters]
[sozu-parameters]
...
...
software/sozu/instance.cfg.in
View file @
2d3959df
...
@@ -43,6 +43,7 @@ extra-context =
...
@@ -43,6 +43,7 @@ extra-context =
<= jinja2-template-base
<= jinja2-template-base
url = {{ template_sozu_cfg }}
url = {{ template_sozu_cfg }}
extra-context =
extra-context =
import json_module json
key slave_instance_list slap-configuration:slave-instance-list
key slave_instance_list slap-configuration:slave-instance-list
raw sozu_bin {{ sozu_location }}/bin/sozu
raw sozu_bin {{ sozu_location }}/bin/sozu
...
@@ -50,3 +51,8 @@ extra-context =
...
@@ -50,3 +51,8 @@ extra-context =
raw config_toml_in {{ config_toml }}
raw config_toml_in {{ config_toml }}
raw template_publish_slave {{ template_publish_slave }}
raw template_publish_slave {{ template_publish_slave }}
[slave-output.cfg]
recipe = slapos.recipe.template:jinja2
output= ${buildout:directory}/${:_buildout_section_name_}
inline =
${slap-configuration:configuration}
software/sozu/publish-sozu-slave-parameters.cfg.in
View file @
2d3959df
...
@@ -10,13 +10,19 @@ key_file = ${slap-connection:key-file}
...
@@ -10,13 +10,19 @@ key_file = ${slap-connection:key-file}
cert_file = ${slap-connection:cert-file}
cert_file = ${slap-connection:cert-file}
{% for _, cluster in slave_dict.items() -%}
{% for reference, cluster_dict in slave_dict.items() -%}
{% set slave_reference = cluster['slave_reference'] -%}
{% do part_list.append('publish-slave-' ~ reference) -%}
{% do part_list.append('publish-slave-' ~ slave_reference) -%}
{% set protocol = cluster_dict['protocol'] -%}
[publish-slave-{{ reference }}]
[publish-slave-{{ slave_reference }}]
recipe = slapos.cookbook:publish
recipe = slapos.cookbook:publish
-slave-reference = {{ slave_reference }}
-slave-reference = {{ reference }}
{% for _, backend_dict in cluster_dict['backend-dict'].items() -%}
backend-url-{{ backend_dict['backend-id'] }} = https://{{ backend_dict['address'] }}
{% endfor %}
{% for _, frontend_dict in cluster_dict['frontend-dict'].items() -%}
frontend-url-{{ loop.index }} = {% if protocol == 'http' -%} https://{% endif %}{{ frontend_dict['address'] }}
{% endfor %}
{% endfor %}
{% endfor %}
[buildout]
[buildout]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment