Skip to content

Instantly share code, notes, and snippets.

@CGenie
Last active August 29, 2015 14:07
Show Gist options
  • Save CGenie/76af4519a504f47fdebe to your computer and use it in GitHub Desktop.
Save CGenie/76af4519a504f47fdebe to your computer and use it in GitHub Desktop.
openstack.yaml proposal
roles_metadata:
controller:
conflicts:
- compute
conditions:
- condition: "cluster:mode == 'multinode'"
then:
all:
- condition: "selectedNodes._length <= 1"
warning: "Multi-node environment cannot have more than one controller node."
- not:
exists:
where: "cluster:nodes"
variable: node
condition:
all:
- not: "<node>.id in selectedNodes._pluck('id')"
- condition: "<node>._hasRole('controller')"
- not: "<node>._pending_deletion"
else: true
- condition: "cluster:mode == 'ha_compact'"
then:
recommended:
expression: "cluster:nodes._length >= <value>"
value: 3
warning: "At least <value> controller nodes are recommended for HA deployment."
EXPRESSIONS
---
<x> in <list>: _.contains(<list>, <x>)
eval(<expression>) should return object of type:
{
value: bool,
warning: <condition>.warning if evaluated to false
}
CONDITIONS
---
condition: <expression>
return: eval(<expression>)
---
condition: <expression>
then: <condition>
return: if(eval(expression)) { return eval(<condition>) } else { eval(false) }
---
condition: <expression>
then: <condition>
else: <else_condition>
return: if(eval(expression)) { return eval(<condition>) } else { eval(<else_condition>) }
---
all:
- <condition1>
- <condition2>
- ...
return: eval(<condition1>) && eval(<condition2>) && ...
---
not: <condition>
return: !eval(<condition>)
---
exists:
where: <list>
variable: <variable_name>
condition: <condition>
return: _.filter(eval(<list>), function(variable) { return eval(<condition> with variable as <variable_name>); }).length > 0
---
recommended:
expression: <expression>
value: <value>
warning: <warning>
return: eval(<expression> with value as <value>)
The return expression of 'recommended' is not taken into account when evaluating
compound expressions (we are only interested in the 'warning' field returned
when evaluated to false).
SPECIAL VARIABLES:
---
<list>._length: list.length
---
<list>._pluck(<what>): _.pluck(<list>, <what>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment