Browse Source

Merge "Ironic node auto-discovery"

changes/67/286567/1
Jenkins 3 years ago
parent
commit
daf85dcc62
1 changed files with 172 additions and 0 deletions
  1. 172
    0
      specs/ironic-node-auto-discovery.rst

+ 172
- 0
specs/ironic-node-auto-discovery.rst View File

@@ -0,0 +1,172 @@
1
+..
2
+ This work is licensed under a Creative Commons Attribution 3.0 Unported
3
+ License.
4
+
5
+ http://creativecommons.org/licenses/by/3.0/legalcode
6
+
7
+=====================
8
+Discover ironic nodes
9
+=====================
10
+
11
+https://bugs.launchpad.net/ironic-inspector/+bug/1524753
12
+
13
+This spec proposes auto-discovery Ironic nodes feature.
14
+
15
+Problem description
16
+===================
17
+
18
+A large network might consist of hundreds of servers. Keeping track of these
19
+servers can be a time-consuming process. To simplify the addition of new
20
+servers could be done with auto-discovery. Auto-discovery is a process through
21
+which Ironic identifies a resource automatically so it's possible to manage it.
22
+For now, Ironic is unable to automatically detect nodes. Operators have to
23
+create nodes manually and provide driver info for them.
24
+
25
+Proposed change
26
+===============
27
+
28
+Nodes that don't exist in the inspector node cache may still be booted and
29
+return inspection information to process, ``node-not-found-hook`` allows to
30
+handle that information. For discovery new implementation called
31
+``enroll_node_not_found_hook`` should be specified. It will create a node
32
+with ``fake`` driver.
33
+
34
+To customize discovery, introspection rules will be used, it  allows operators
35
+to control the discovery process. A simple rule to match all new nodes and
36
+enroll them in Ironic with the ``agent_ipmitool`` driver will looks like::
37
+
38
+    "description": "Set IPMI driver_info if no address or credentials",
39
+    "actions": [
40
+        {'action': 'set-attribute', 'path': 'driver', 'value': 'agent_ipmitool'},
41
+        {'action': 'set-attribute', 'path': 'driver_info/ipmi_address',
42
+         'value': '{data[ipmi_address]}'},
43
+        {'action': 'set-attribute', 'path': 'driver_info/ipmi_username',
44
+         'value': 'username'},
45
+        {'action': 'set-attribute', 'path': 'driver_info/ipmi_password',
46
+         'value': 'password'}
47
+    ]
48
+    "conditions": [
49
+        {'op': 'eq', 'field': 'node://driver_info/ipmi_password',
50
+         'multiple': 'all', 'value': None},
51
+        {'op': 'eq', 'field': 'node://driver_info/ipmi_username',
52
+         'multiple': 'all', 'value': None}
53
+    ]
54
+
55
+
56
+    "description": "Set deploy info if not already set on node",
57
+    "actions": [
58
+        {'action': 'set-attribute', 'path': 'driver_info/deploy_kernel',
59
+         'value': '<glance uuid>'},
60
+        {'action': 'set-attribute', 'path': 'driver_info/deploy_ramdisk',
61
+         'value': '<glance uuid>'},
62
+    ]
63
+
64
+    "conditions": [
65
+        {'op': 'eq', 'field': 'node://driver_info/deploy_ramdisk',
66
+         'multiple': 'all', 'value': None},
67
+        {'op': 'eq', 'field': 'node://driver_info/deploy_kernel',
68
+         'multiple': 'all', 'value': None}
69
+    ]
70
+
71
+Rule changes:
72
+
73
+ - condition changes: extend field ``field``, for now it's represent
74
+   a `JSON path`_ to the field in the introspection data to use in comparison.
75
+   But sometimes it's needed to compare data from node(``deploy_ramdisk``
76
+   compared with None in example), so to get data from node, ``node://``
77
+   and ``data://`` scheme proposed to add. It will allow to fetch data using
78
+   path from the nodes info and introspection(``data://`` is default scheme
79
+   to keep backward compatibility)::
80
+
81
+       node://driver_info.deploy_ramdisk - ``deploy_ramdisk`` attribute from
82
+                                             node's driver_info.
83
+       data://memory_mb                  - ``memory_mb`` attribute from
84
+                                             introspection data.
85
+
86
+ - actions changes: for now it's impossible to assign values from inspection
87
+   data to node, to address this disadvantage it's proposed to add standard
88
+   python formatting `Python format`_ to ``value`` field.
89
+   For example, ``set-attribute`` sets an attribute on an Ironic node. It's
90
+   required the ``path`` field, which is the path to the attribute in Ironic,
91
+   e.g.``driver_info/ipmi_username``, and a ``value`` to set. Where ``value``
92
+   is simple value, which assigned to path::
93
+
94
+        {data[ipmi_address]} - ``ipmi_address`` attribute from introspection
95
+                               data will be fetched.
96
+
97
+Creating new actions will allow the node info to be consumed in different
98
+ways. Proposed approach is pretty flexible, so more sophisticated conditions
99
+and actions could be added here based on operators specifications.
100
+
101
+Operator steps for achieve auto-discovery would be following:
102
+    * Operator creates a new rule or uses the predefined ``discovery rule``;
103
+    * Operator import rule to Inspector;
104
+    * All nodes after rule is imported will be discovered with it.
105
+
106
+Alternatives
107
+------------
108
+
109
+Continue enroll nodes manually and run inspection. But it's not appropriate
110
+approach for big significant environments.
111
+
112
+API impact
113
+----------
114
+
115
+None
116
+
117
+Performance and scalability impact
118
+----------------------------------
119
+
120
+None
121
+
122
+Security impact
123
+---------------
124
+
125
+None
126
+
127
+Deployer impact
128
+---------------
129
+
130
+Note: before discovery, the config option ``node_not_found_hook`` should be
131
+assigned to the ``enroll_node_not_found_hook`` value;
132
+deployers will be required to create rules, so they should be familiar
133
+with rules, rules conditions and actions; for simple cases example rules
134
+could be used.
135
+
136
+Developer impact
137
+----------------
138
+
139
+Developers can create additional conditions and actions regarding their
140
+needs to extend the discovery process.
141
+
142
+Implementation
143
+==============
144
+
145
+Assignee(s)
146
+-----------
147
+
148
+* Anton Arefiev(aarefiev)
149
+
150
+Work Items
151
+----------
152
+
153
+ * Extend conditions and actions to support proposed format;
154
+ * Cover new functionality with unit and integration tests;
155
+ * Add example rules;
156
+ * Update docs.
157
+
158
+Dependencies
159
+============
160
+
161
+None
162
+
163
+Testing
164
+=======
165
+
166
+Unit, functional and integration tests will be added.
167
+
168
+References
169
+==========
170
+
171
+.. _`JSON path`: http://goessner.net/articles/JsonPath/
172
+.. _`Python format`: https://docs.python.org/3/library/stdtypes.html#str.format

Loading…
Cancel
Save