Commit 0f199b76 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

software/kvm: Implement additional frontend in kvm-cluster

frontend-instance-guid and frontend-additional-instance-guid are used to
control where the websocket frontend shall end up.
parent 04938bff
...@@ -23,7 +23,7 @@ md5sum = dc4dc40f9d950b5f963c22c62ca488a7 ...@@ -23,7 +23,7 @@ md5sum = dc4dc40f9d950b5f963c22c62ca488a7
[template-kvm-cluster] [template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in filename = instance-kvm-cluster.cfg.jinja2.in
md5sum = 69ed177fc30f9b5ca8ae497d840a888d md5sum = c7ce0510c05753d428c18b756f827573
[template-kvm-resilient] [template-kvm-resilient]
filename = instance-kvm-resilient.cfg.jinja2 filename = instance-kvm-resilient.cfg.jinja2
......
...@@ -10,21 +10,38 @@ ...@@ -10,21 +10,38 @@
"frontend-instance-guid": { "frontend-instance-guid": {
"title": "Frontend Instance ID", "title": "Frontend Instance ID",
"description": "Unique identifier of the frontend instance, like \"SOFTINST-11031\".", "description": "Unique identifier of the frontend instance, like \"SOFTINST-11031\".",
"type": "string", "type": "string"
"default": ""
}, },
"frontend-software-type": { "frontend-software-type": {
"title": "Frontend Software Type", "title": "Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".", "description": "Type of the frontend instance, like \"RootSoftwareInstance\".",
"type": "string", "type": "string",
"default": "frontend" "default": "RootSoftwareInstance"
}, },
"frontend-software-url": { "frontend-software-url": {
"title": "Frontend Software URL", "title": "Frontend Software URL",
"description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".", "description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
"type": "string", "type": "string",
"format": "uri", "format": "uri",
"default": "https://lab.nexedi.com/nexedi/slapos/raw/slapos-0.92/software/kvm/software.cfg" "default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
},
"frontend-additional-instance-guid": {
"title": "Additional Frontend Instance ID",
"description": "Unique identifier of the additional frontend instance, like \"SOFTINST-11031\", if empty won't be requested.",
"type": "string"
},
"frontend-additional-software-type": {
"title": "Additional Frontend Software Type",
"description": "Type of the frontend instance, like \"RootSoftwareInstance\".",
"type": "string",
"default": "RootSoftwareInstance"
},
"frontend-additional-software-url": {
"title": "Additional Frontend Software URL",
"description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
"type": "string",
"format": "uri",
"default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
} }
}, },
"type": "object" "type": "object"
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
{% set slave_frontend_sr = slave_frontend_dict.get('software-url', 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg') -%} {% set slave_frontend_sr = slave_frontend_dict.get('software-url', 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg') -%}
{% set slave_frontend_stype = slave_frontend_dict.get('software-type', 'custom-personal') -%} {% set slave_frontend_stype = slave_frontend_dict.get('software-type', 'custom-personal') -%}
{% set slave_frontend_iguid = slave_frontend_dict.get('instance-guid', '') -%} {% set slave_frontend_iguid = slave_frontend_dict.get('instance-guid', '') -%}
{% set WEBSOCKET_FRONTEND_DEFAULT_SR = 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg' %}
{% set WEBSOCKET_FRONTEND_DEFAULT_ST = 'RootSoftwareInstance' %}
{% set kvm_instance_dict = {} -%} {% set kvm_instance_dict = {} -%}
{% set kvm_hostname_list = [] -%} {% set kvm_hostname_list = [] -%}
{% set monitor_base_url_dict = {} -%} {% set monitor_base_url_dict = {} -%}
...@@ -47,10 +49,16 @@ sla-project_guid = {{ dumps(kvm_parameter_dict.get('project-guid', '')) }} ...@@ -47,10 +49,16 @@ sla-project_guid = {{ dumps(kvm_parameter_dict.get('project-guid', '')) }}
state = stopped state = stopped
{% endif -%} {% endif -%}
config-frontend-instance-name = {{ instance_name ~ ' VNC Frontend' }} config-frontend-instance-name = {{ instance_name ~ ' VNC Real Frontend' }}
config-frontend-software-type = {{ dumps(frontend_dict.get('software-type', 'frontend')) }} {{ setconfig('frontend-software-url', frontend_dict.get('frontend-software-url', WEBSOCKET_FRONTEND_DEFAULT_SR)) }}
config-frontend-software-url = {{ dumps(frontend_dict.get('software-url', 'http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg')) }} {{ setconfig('frontend-software-type', frontend_dict.get('frontend-software-type', WEBSOCKET_FRONTEND_DEFAULT_ST)) }}
{{ setconfig('frontend-instance-guid', kvm_parameter_dict.get('instance-guid', '')) }} {{ setconfig('frontend-instance-guid', frontend_dict.get('frontend-instance-guid', '')) }}
config-frontend-additional-instance-name = {{ instance_name ~ ' VNC Real Frontend Additional' }}
{{ setconfig('frontend-additional-software-url', frontend_dict.get('frontend-additional-software-url', WEBSOCKET_FRONTEND_DEFAULT_SR)) }}
{{ setconfig('frontend-additional-software-type', frontend_dict.get('frontend-additional-software-type', WEBSOCKET_FRONTEND_DEFAULT_ST)) }}
{{ setconfig('frontend-additional-instance-guid', frontend_dict.get('frontend-additional-instance-guid', '')) }}
config-name = {{ instance_name }} config-name = {{ instance_name }}
{% if slapparameter_dict.get('authorized-keys', []) -%} {% if slapparameter_dict.get('authorized-keys', []) -%}
config-authorized-key = {{ dumps(slapparameter_dict.get('authorized-keys') | join('\n')) }} config-authorized-key = {{ dumps(slapparameter_dict.get('authorized-keys') | join('\n')) }}
...@@ -126,6 +134,9 @@ sla-fw_restricted_access = {{ dumps(slapparameter_dict.get('fw-restricted-access ...@@ -126,6 +134,9 @@ sla-fw_restricted_access = {{ dumps(slapparameter_dict.get('fw-restricted-access
return = return =
url url
{% if frontend_dict.get('frontend-additional-instance-guid', '') %}
url-additional
{% endif %}
backend-url backend-url
{% if str(use_nat).lower() == 'true' -%} {% if str(use_nat).lower() == 'true' -%}
{% for port in nat_rules_list -%} {% for port in nat_rules_list -%}
...@@ -151,6 +162,9 @@ return = ...@@ -151,6 +162,9 @@ return =
{% do monitor_base_url_dict.__setitem__(instance_name, '${' ~ section ~ ':connection-monitor-base-url}') -%} {% do monitor_base_url_dict.__setitem__(instance_name, '${' ~ section ~ ':connection-monitor-base-url}') -%}
{% do publish_dict.__setitem__(instance_name ~ '-backend-url', '${' ~ section ~ ':connection-backend-url}') -%} {% do publish_dict.__setitem__(instance_name ~ '-backend-url', '${' ~ section ~ ':connection-backend-url}') -%}
{% do publish_dict.__setitem__(instance_name ~ '-url', '${' ~ section ~ ':connection-url}') -%} {% do publish_dict.__setitem__(instance_name ~ '-url', '${' ~ section ~ ':connection-url}') -%}
{% if frontend_dict.get('frontend-additional-instance-guid', '') %}
{% do publish_dict.__setitem__(instance_name ~ '-url-additional', '${' ~ section ~ ':connection-url-additional}') -%}
{% endif %}
{% do kvm_instance_dict.__setitem__(instance_name, (use_nat, nat_rules_list)) -%} {% do kvm_instance_dict.__setitem__(instance_name, (use_nat, nat_rules_list)) -%}
{% endfor %} {% endfor %}
......
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