File: cluster.rst

package info (click to toggle)
python-openstacksdk 0.50.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,632 kB
  • sloc: python: 83,132; sh: 194; makefile: 21
file content (193 lines) | stat: -rw-r--r-- 4,691 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
..
  Licensed under the Apache License, Version 2.0 (the "License"); you may
  not use this file except in compliance with the License. You may obtain
  a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  License for the specific language governing permissions and limitations
  under the License.

=================
Managing Clusters
=================

Clusters are first-class citizens in Senlin service design. A cluster is
defined as a collection of homogeneous objects. The "homogeneous" here means
that the objects managed (aka. Nodes) have to be instantiated from the same
"profile type".


List Clusters
~~~~~~~~~~~~~

To examine the list of receivers:

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: list_cluster

When listing clusters, you can specify the sorting option using the ``sort``
parameter and you can do pagination using the ``limit`` and ``marker``
parameters.

Full example: `manage cluster`_


Create Cluster
~~~~~~~~~~~~~~

When creating a cluster, you will provide a dictionary with keys and values
according to the cluster type referenced.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: create_cluster

Optionally, you can specify a ``metadata`` keyword argument that contains some
key-value pairs to be associated with the cluster.

Full example: `manage cluster`_


Get Cluster
~~~~~~~~~~~

To get a cluster based on its name or ID:

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: get_cluster

Full example: `manage cluster`_


Find Cluster
~~~~~~~~~~~~

To find a cluster based on its name or ID:

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: find_cluster

Full example: `manage cluster`_


Update Cluster
~~~~~~~~~~~~~~

After a cluster is created, most of its properties are immutable. Still, you
can update a cluster's ``name`` and/or ``params``.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: update_cluster

Full example: `manage cluster`_


Delete Cluster
~~~~~~~~~~~~~~

A cluster can be deleted after creation, When there are nodes in the cluster,
the Senlin engine will launch a process to delete all nodes from the cluster
and destroy them before deleting the cluster object itself.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: delete_cluster


Add Nodes to Cluster
~~~~~~~~~~~~~~~~~~~~

Add some existing nodes into the specified cluster.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: add_nodes_to_cluster


Remove Nodes from Cluster
~~~~~~~~~~~~~~~~~~~~~~~~~

Remove nodes from specified cluster.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: remove_nodes_from_cluster


Replace Nodes in Cluster
~~~~~~~~~~~~~~~~~~~~~~~~

Replace some existing nodes in the specified cluster.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: replace_nodes_in_cluster


Cluster Scale Out
~~~~~~~~~~~~~~~~~

Inflate the size of a cluster.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: scale_out_cluster


Cluster Scale In
~~~~~~~~~~~~~~~~

Shrink the size of a cluster.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: scale_out_cluster


Cluster Resize
~~~~~~~~~~~~~~

Resize of cluster.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: resize_cluster


Attach Policy to Cluster
~~~~~~~~~~~~~~~~~~~~~~~~

Once a policy is attached (bound) to a cluster, it will be
enforced when related actions are performed on that cluster,
unless the policy is (temporarily) disabled on the cluster

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: attach_policy_to_cluster


Detach Policy from Cluster
~~~~~~~~~~~~~~~~~~~~~~~~~~

Once a policy is attached to a cluster, it can be detached
from the cluster at user's request.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: detach_policy_from_cluster


Cluster Check
~~~~~~~~~~~~~

Check cluster health status, Cluster members can be check.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: check_cluster


Cluster Recover
~~~~~~~~~~~~~~~

To restore a specified cluster, members in the cluster will be checked.

.. literalinclude:: ../../examples/clustering/cluster.py
   :pyobject: recover_cluster


.. _manage cluster: https://opendev.org/openstack/openstacksdk/src/branch/master/examples/clustering/cluster.py