Plural
Search…
Runbook XML

XML Tag Definitions

Plural runbooks are written in XML. XML doesn’t have a predefined markup language, like HTML does. Instead, XML allows users to create their own markup symbols to describe content, making an unlimited and self-defining symbol set.
We have defined the following xml attributes in an elixir file that may be used in the creation of your own runbooks and help standardize their layout.
1
defmodule Console.Runbooks.Display do
2
use Console.Runbooks.Display.Base
3
alias Console.Runbooks.Display.{Xml}
4
5
schema do
6
component "box" do
7
attributes ~w(direction width height pad margin align justify gap fill color border borderSide borderSize)
8
parents ~w(root box)
9
end
10
11
component "text" do
12
attributes ~w(size weight value color)
13
parents ~w(box text root link)
14
end
15
16
component "markdown" do
17
attributes ~w(size weight value)
18
parents ~w(box text root)
19
end
20
21
component "button" do
22
attributes ~w(primary label href target action headline)
23
parents ~w(box)
24
end
25
26
component "input" do
27
attributes ~w(placeholder name label datatype)
28
parents ~w(box)
29
end
30
31
component "timeseries" do
32
attributes ~w(label datasource)
33
parents ~w(box)
34
end
35
36
component "valueFrom" do
37
attributes ~w(datasource path doc)
38
parents ~w(input text)
39
end
40
41
component "image" do
42
attributes ~w(width height url)
43
parents ~w(box link)
44
end
45
46
component "video" do
47
attributes ~w(width height url autoPlay loop)
48
parents ~w(box link)
49
end
50
51
component "link" do
52
attributes ~w(href target value color weight)
53
parents ~w(text box)
54
end
55
56
component "table" do
57
attributes ~w(name width height datasource path)
58
parents ~w(box)
59
end
60
61
component "tableColumn" do
62
attributes ~w(path header width)
63
parents ~w(table)
64
end
65
end
66
67
def parse_doc(xml) do
68
with {:ok, parsed} <- Xml.from_xml(xml) do
69
case validate(parsed) do
70
:pass -> {:ok, parsed}
71
{:fail, error} -> {:error, error}
72
end
73
end
74
end
75
end
Copied!
Most of these attributes, like box and input are basically grommet react components. However, we would like to call out a few custom attributes that interact with other data from the runbook. They each refer to a datasource and then maybe also a way to access a value at that datasource.
  • timeseries
    • datasource
  • valueFrom
    • datasource
    • doc
    • path
Here is an example Runbook xml template composed of these attributes.
1
<root gap='medium'>
2
<box pad='small' gap='medium' direction='row' align='center'>
3
<button label='Scale' action='scale' primary='true' headline='true' />
4
<box direction='row' align='center' gap='small'>
5
<box gap='small' align='center'>
6
<timeseries datasource="cpu" label="CPU Usage" />
7
<text size='small'>You should set a reservation to
8
roughly correspond to 30% utilization</text>
9
</box>
10
<box gap='small' align='center'>
11
<timeseries datasource="memory" label="Memory Usage" />
12
<text size='small'>You should set a reservation to
13
roughly correspond to 60% utilization</text>
14
</box>
15
</box>
16
<box gap='small'>
17
<box gap='xsmall'>
18
<input placeholder="250m" label='CPU Request' name='cpu'>
19
<valueFrom
20
datasource="statefulset"
21
doc="kubernetes.raw"
22
path="spec.template.spec.containers[0].resources.requests.cpu" />
23
</input>
24
<input placeholder="1Gi" label='Memory Request' name='memory'>
25
<valueFrom
26
datasource="statefulset"
27
doc="kubernetes.raw"
28
path="spec.template.spec.containers[0].resources.requests.memory" />
29
</input>
30
</box>
31
</box>
32
</box>
33
<box pad='small' gap='medium' direction='row' align='center'>
34
<box direction='row' width='70%' align='center'>
35
<text size='small'>You can also add more replicas to provide failover in case of outages, or optionally remove them to save cost</text>
36
</box>
37
<box direction='row' gap='small' width='30%' align='center'>
38
<input datatype='int' placeholder="1" label='Replicas' name='replicas'>
39
<valueFrom
40
datasource="statefulset"
41
doc="kubernetes.raw"
42
path="spec.replicas" />
43
</input>
44
</box>
45
</box>
46
<box width='100%' gap='small'>
47
<text size='small'>Be sure to scale your rabbitmq nodes within your nodes capacities, listed here:</text>
48
<table width='100%' datasource='nodes' path='nodes'>
49
<tableColumn path='metadata.name' header='name' width='33%' />
50
<tableColumn path='status.capacity.cpu' header='cpu' width='33%' />
51
<tableColumn path='status.capacity.memory' header='memory' width='33%' />
52
</table>
53
</box>
54
</root>
Copied!
This xml file is referred to in the runbooks.yaml file, where you will also pass along the datasources that will hydrate this template.
Last modified 2mo ago
Copy link