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
Carlos Ramos Carreño
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
Show 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 @@
# not need these here).
[instance.cfg]
filename = instance.cfg.in
md5sum =
5b6d18ff660516bf583cf4fe2c2b8059
md5sum =
8a714ed894c0eb99cd8de49e588d0af4
[template-sozu]
filename = instance-sozu.cfg.jinja2.in
md5sum =
ea453374e67377ce5b9acda7976a0a0e
md5sum =
5ec499b5cab85d9aa2b55ea6ff3cf701
[config.toml]
filename = config.toml.in
md5sum =
6d15b97ae88f6a6529cc7d993a58a163
md5sum =
3b407e5ee362e51de60ffb9f850f9cc0
[publish-sozu-slave-parameters.cfg]
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') }}"
# "ROUND_ROBIN", "RANDOM", "LEAST_LOADED" and "POWER_OF_TWO". Defaults to "ROUND_ROBIN"
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.get('load-metric', '
connections
') }}"
load_metric = "{{ cluster_dict.get('load-metric', '
CONNECTIONS
') }}"
# frontends configuration
# 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') }}"
frontends = [
{% 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 tag_dict = {} -%}
{% for tag in frontend_dict['tag-list'] -%}
{% set tag_list = [] -%}
{% set user_tag_list = frontend_dict.get('tag-list', []) -%}
{% for tag in user_tag_list -%}
{% set k, v = tag.split('=') -%}
do tag_dict.__setitem__(k.strip(), v.strip()
) -%}
{% do tag_list.append(k.strip() ~ '="' ~ v.strip() ~ '"'
) -%}
{% 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 -%}
]
...
...
software/sozu/instance-sozu-slave-input-schema.json
View file @
2d3959df
...
...
@@ -29,11 +29,11 @@
"title"
:
"Load metric"
,
"description"
:
"Metric evaluating the load on the backend. available options: connections, requests, connection_time."
,
"type"
:
"string"
,
"default"
:
"
connections
"
,
"default"
:
"
CONNECTIONS
"
,
"enum"
:
[
"
connections
"
,
"
requests
"
,
"
connection_time
"
"
CONNECTIONS
"
,
"
REQUESTS
"
,
"
CONNECTION_TIME
"
]
},
"frontend-dict"
:
{
...
...
software/sozu/instance-sozu.cfg.jinja2.in
View file @
2d3959df
...
...
@@ -41,8 +41,10 @@ cert-file = ${ca-directory:certs}/${:name}.key
executable = echo "request certificate"
wrapper = ${directory:tmp}/ca-${:name}
{% for instance_dict in slave_instance_list -%}
{% set name = instance_dict['slave_reference'] -%}
{% for slave_dict in slave_instance_list %}
{% 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 key_section_name = '${' ~ name ~ '-ssl:key-file}' -%}
...
...
@@ -66,7 +68,7 @@ name = {{ name }}
{% do instance_dict['frontend-dict'][cluster_name].__setitem__('certificate-chain', '${' ~ name ~ cluster_name~ '-chain:output}') -%}
{% endif -%}
{% endfor -%}
{% do cluster_definition_dict.__setitem__(
instance_dict['name']
, instance_dict) -%}
{% do cluster_definition_dict.__setitem__(
name
, instance_dict) -%}
{% endfor -%}
[sozu-parameters]
...
...
software/sozu/instance.cfg.in
View file @
2d3959df
...
...
@@ -43,6 +43,7 @@ extra-context =
<= jinja2-template-base
url = {{ template_sozu_cfg }}
extra-context =
import json_module json
key slave_instance_list slap-configuration:slave-instance-list
raw sozu_bin {{ sozu_location }}/bin/sozu
...
...
@@ -50,3 +51,8 @@ extra-context =
raw config_toml_in {{ config_toml }}
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}
cert_file = ${slap-connection:cert-file}
{% for _, cluster in slave_dict.items() -%}
{% set slave_reference = cluster['slave_reference'] -%}
{% do part_list.append('publish-slave-' ~ slave_reference) -%}
[publish-slave-{{ slave_reference }}]
{% for reference, cluster_dict in slave_dict.items() -%}
{% do part_list.append('publish-slave-' ~ reference) -%}
{% set protocol = cluster_dict['protocol'] -%}
[publish-slave-{{ reference }}]
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 %}
[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