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
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
7ba3ff9e
Commit
7ba3ff9e
authored
Nov 28, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NEO: new schema for node parameters
parent
0b049372
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
124 additions
and
67 deletions
+124
-67
software/neoppod/buildout.hash.cfg
software/neoppod/buildout.hash.cfg
+3
-3
software/neoppod/instance-common.cfg.in
software/neoppod/instance-common.cfg.in
+3
-1
software/neoppod/instance-neo-input-schema.json
software/neoppod/instance-neo-input-schema.json
+85
-61
software/neoppod/instance.cfg.in
software/neoppod/instance.cfg.in
+1
-0
software/neoppod/root-common.cfg.in
software/neoppod/root-common.cfg.in
+30
-1
stack/erp5/buildout.hash.cfg
stack/erp5/buildout.hash.cfg
+1
-1
stack/erp5/instance.cfg.in
stack/erp5/instance.cfg.in
+1
-0
No files found.
software/neoppod/buildout.hash.cfg
View file @
7ba3ff9e
...
@@ -14,11 +14,11 @@
...
@@ -14,11 +14,11 @@
# not need these here).
# not need these here).
[instance-common]
[instance-common]
filename = instance-common.cfg.in
filename = instance-common.cfg.in
md5sum =
0a3a54fcc7be0bbd63cbd64f006ceebc
md5sum =
80599fcc6e5d07270d7900aebfd62139
[root-common]
[root-common]
filename = root-common.cfg.in
filename = root-common.cfg.in
md5sum = c
cc6e33412259415ec6c3452d37b77cc
md5sum = c
03fbfc9df9edc1ef60be970e0627c5e
[instance-neo-admin]
[instance-neo-admin]
filename = instance-neo-admin.cfg.in
filename = instance-neo-admin.cfg.in
...
@@ -38,7 +38,7 @@ md5sum = 9f6f8f2b5f4cb0d97d50ffc1d3837e2f
...
@@ -38,7 +38,7 @@ md5sum = 9f6f8f2b5f4cb0d97d50ffc1d3837e2f
[template-neo]
[template-neo]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
83dc9faca482b2ddbd3d5fa968af7c33
md5sum =
9e63e16eda75e73ad4ffb50afde0505d
[cluster]
[cluster]
filename = cluster.cfg.in
filename = cluster.cfg.in
...
...
software/neoppod/instance-common.cfg.in
View file @
7ba3ff9e
...
@@ -15,7 +15,9 @@ cert = ${slap-connection:cert-file}
...
@@ -15,7 +15,9 @@ cert = ${slap-connection:cert-file}
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
filename = ${:_buildout_section_name_}.cfg
filename = ${:_buildout_section_name_}.cfg
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/${:filename}
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/${:filename}
extensions = jinja2.ext.do
extensions =
jinja2.ext.do
jinja2.ext.loopcontrols
extra-context =
extra-context =
context =
context =
key ipv4_set slap-configuration:ipv4
key ipv4_set slap-configuration:ipv4
...
...
software/neoppod/instance-neo-input-schema.json
View file @
7ba3ff9e
{
{
"$schema"
:
"http://json-schema.org/draft-0
4
/schema#"
,
"$schema"
:
"http://json-schema.org/draft-0
7
/schema#"
,
"description"
:
"Parameters to instantiate a NEO cluster. See https://lab.nexedi.com/nexedi/neoppod/blob/master/neo.conf for more information."
,
"description"
:
"Parameters to instantiate a NEO cluster. See https://lab.nexedi.com/nexedi/neoppod/blob/master/neo.conf for more information."
,
"additionalProperties"
:
false
,
"additionalProperties"
:
false
,
"required"
:
[
"required"
:
[
...
@@ -72,10 +72,13 @@
...
@@ -72,10 +72,13 @@
"_key"
:
{
"_key"
:
{
"type"
:
"string"
"type"
:
"string"
},
},
"node-list"
:
{
"node-count"
:
{
"description"
:
"List of dictionaries containing parameters for each node."
,
"description"
:
"Number of nodes to deploy."
,
"items"
:
{
"default"
:
1
,
"description"
:
"Dictionary containing parameters required to configure individual nodes."
,
"type"
:
"integer"
},
"node"
:
{
"description"
:
"Default node parameters."
,
"default"
:
{},
"default"
:
{},
"additionalProperties"
:
false
,
"additionalProperties"
:
false
,
"properties"
:
{
"properties"
:
{
...
@@ -135,6 +138,27 @@
...
@@ -135,6 +138,27 @@
},
},
"type"
:
"object"
"type"
:
"object"
},
},
"node!"
:
{
"description"
:
"Node parameters are overridden by the value of the first item whose partition reference matches against the pattern."
,
"items"
:
{
"items"
:
[
{
"description"
:
"Override pattern (Python regular expression)."
,
"type"
:
"string"
},
{
"allOf"
:
[
{
"$ref"
:
"#/properties/node"
},
{
"description"
:
"Override value (parameters for maching nodes)."
}
]
}
],
"type"
:
"array"
},
"type"
:
"array"
"type"
:
"array"
}
}
},
},
...
...
software/neoppod/instance.cfg.in
View file @
7ba3ff9e
...
@@ -8,6 +8,7 @@ rendered = ${buildout:parts-directory}/${:_buildout_section_name_}.cfg
...
@@ -8,6 +8,7 @@ rendered = ${buildout:parts-directory}/${:_buildout_section_name_}.cfg
<= jinja2-template-base
<= jinja2-template-base
template = {{ cluster }}
template = {{ cluster }}
extra-context =
extra-context =
import re re
import urlparse urlparse
import urlparse urlparse
import-list =
import-list =
rawfile root_common {{ root_common }}
rawfile root_common {{ root_common }}
...
...
software/neoppod/root-common.cfg.in
View file @
7ba3ff9e
...
@@ -16,6 +16,20 @@ sla-computer_guid = ${slap-connection:computer-id}
...
@@ -16,6 +16,20 @@ sla-computer_guid = ${slap-connection:computer-id}
{% endif -%}
{% endif -%}
{% endmacro -%}
{% endmacro -%}
{% macro apply_overrides(dict_, reference) -%}
{% for key in list(dict_) -%}
{% if key.endswith('!') -%}
{% for pattern, value in dict_.pop(key, ()) -%}
{% set m = re.match(pattern, reference) -%}
{% if m and m.group() == reference %}{# PY3: fullmatch -#}
{% do dict_.__setitem__(key[:-1], value) -%}
{% break -%}
{% endif -%}
{% endfor -%}
{% endif -%}
{% endfor -%}
{% endmacro -%}
{% macro common_section() -%}
{% macro common_section() -%}
[request-common-base]
[request-common-base]
recipe = slapos.cookbook:request.serialised
recipe = slapos.cookbook:request.serialised
...
@@ -52,7 +66,22 @@ config-ssl = {{ dumps((
...
@@ -52,7 +66,22 @@ config-ssl = {{ dumps((
config-upstream-cluster = {{ dumps(parameter_dict.get('upstream-cluster', '')) }}
config-upstream-cluster = {{ dumps(parameter_dict.get('upstream-cluster', '')) }}
config-upstream-masters = {{ dumps(parameter_dict.get('upstream-masters', '')) }}
config-upstream-masters = {{ dumps(parameter_dict.get('upstream-masters', '')) }}
software-type = {{ software_type }}
software-type = {{ software_type }}
{% set node_list = parameter_dict.get('node-list', ({},)) -%}
{% set node_list = parameter_dict.get('node-list') -%}
{% if node_list == None -%}
{% set node_list = [] -%}
{% for i in range(parameter_dict.get('node-count', 1)) -%}
{% set x = parameter_dict.copy() -%}
{% do apply_overrides(x, prefix ~ i) -%}
{% do node_list.append(x.get('node', {})) -%}
{% endfor -%}
{% else %}{# BBB -#}
{% do assert('node-count' not in parameter_dict) -%}
{% do assert('node' not in parameter_dict) -%}
{% do assert('node!' not in parameter_dict) -%}
{% endif -%}
{% do assert(node_list) -%}
{% set storage_count = [] -%}
{% set storage_count = [] -%}
{% for node in node_list -%}
{% for node in node_list -%}
{% do storage_count.append(node.get('storage-count', 1)) -%}
{% do storage_count.append(node.get('storage-count', 1)) -%}
...
...
stack/erp5/buildout.hash.cfg
View file @
7ba3ff9e
...
@@ -70,7 +70,7 @@ md5sum = cc19560b9400cecbd23064d55c501eec
...
@@ -70,7 +70,7 @@ md5sum = cc19560b9400cecbd23064d55c501eec
[template]
[template]
filename = instance.cfg.in
filename = instance.cfg.in
md5sum =
f6c6820f9b3653d0d5c29708606fc591
md5sum =
d53a7dbc374374b5c312e3f7e2c0a0ff
[monitor-template-dummy]
[monitor-template-dummy]
filename = dummy.cfg
filename = dummy.cfg
...
...
stack/erp5/instance.cfg.in
View file @
7ba3ff9e
...
@@ -46,6 +46,7 @@ extra-context =
...
@@ -46,6 +46,7 @@ extra-context =
key jupyter_enable_default dynamic-template-erp5-parameters:jupyter-enable-default
key jupyter_enable_default dynamic-template-erp5-parameters:jupyter-enable-default
key local_bt5_repository dynamic-template-erp5-parameters:local-bt5-repository
key local_bt5_repository dynamic-template-erp5-parameters:local-bt5-repository
key openssl_location :openssl-location
key openssl_location :openssl-location
import re re
import urlparse urlparse
import urlparse urlparse
import-list =
import-list =
file root_common context:root-common
file root_common context:root-common
...
...
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