elasticsearch/docs/reference/cluster/get-desired-nodes.asciidoc
Francisco Fernández Castaño e91e7e653b
Add support for CPU ranges in desired nodes (#86434)
This commit adds support for CPU ranges in the desired nodes API. 

This aligns better with environments where administrators/orchestrators
can define lower and upper bounds for the amount of CPUs that the
desired node would get once deployed. 

This allows to provide information about the expected CPU and possible
allowed overcommit that the desired node will run on.

This was the previous expected body for the desired nodes API (we still support it):
```
PUT /_internal/desired_nodes/history/1
{
    "nodes" : [
        {
            "settings" : {
                 "node.name" : "instance-000187",
                 "node.external_id": "instance-000187",
                 "node.roles" : ["data_hot", "master"],
                 "node.attr.data" : "hot",
                 "node.attr.logical_availability_zone" : "zone-0"
            },
            "processors" : 8, 
            "memory" : "58gb",
            "storage" : "1700gb",
            "node_version" : "8.3.0"
        }
    ]
}
```

Now it's possible to define `processors` or `processors_range` as in:
```
PUT /_internal/desired_nodes/history/1
{
    "nodes" : [
        {
            "settings" : {
                 "node.name" : "instance-000187",
                 "node.external_id": "instance-000187",
                 "node.roles" : ["data_hot", "master"],
                 "node.attr.data" : "hot",
                 "node.attr.logical_availability_zone" : "zone-0"
            },
            "processors_range" : {"min": 8.0, "max": 16.0},
            "memory" : "58gb",
            "storage" : "1700gb",
            "node_version" : "8.3.0"
        }
    ]
}
```
Note that `max` in `processors_range` is optional.

This commit also moves from representing CPUs as integers to
accept floating point numbers.

Note: I disabled the bwc yamlRestTests for versions < 8.3 since we introduced
a few "breaking changes" but since this is an internal API it should be fine.
2022-05-20 11:47:32 +02:00

94 lines
2.4 KiB
Text

[[get-desired-nodes]]
=== Get desired nodes API
++++
<titleabbrev>Get desired nodes</titleabbrev>
++++
NOTE: {cloud-only}
Get desired nodes.
[[get-desired-nodes-request]]
==== {api-request-title}
//////////////////////////
[source,console]
--------------------------------------------------
PUT /_internal/desired_nodes/my_history/1
{
"nodes" : [
{
"settings" : {
"node.name" : "instance-000187",
"node.external_id": "instance-000187",
"node.roles" : ["data_hot", "master"],
"node.attr.data" : "hot",
"node.attr.logical_availability_zone" : "zone-0"
},
"processors" : 8.0,
"memory" : "59gb",
"storage" : "2tb",
"node_version" : "{version}"
}
]
}
--------------------------------------------------
// TESTSETUP
[source,console]
--------------------------------------------------
DELETE /_internal/desired_nodes
--------------------------------------------------
// TEST
// TEARDOWN
//////////////////////////
[source,console]
--------------------------------------------------
GET /_internal/desired_nodes/_latest
--------------------------------------------------
// TEST
[[get-desired-nodes-desc]]
==== {api-description-title}
This API gets the latest desired nodes.
[[get-desired-nodes-examples]]
==== {api-examples-title}
This example gets the latest desired nodes.
[source,console]
--------------------------------------------------
GET /_internal/desired_nodes/_latest
--------------------------------------------------
// TEST
The API returns the following result:
[source,console-result]
--------------------------------------------------
{
"history_id": <history_id>,
"version": <version>,
"nodes": [
{
"settings": <node_settings>,
"processors": <node_processors>,
"memory": "<node_memory>",
"storage": "<node_storage>",
"node_version": "<node_version>"
}
]
}
--------------------------------------------------
// TEST[s/<history_id>/$body.history_id/]
// TEST[s/<version>/$body.version/]
// TEST[s/<node_settings>/$body.nodes.0.settings/]
// TEST[s/<node_processors>/$body.nodes.0.processors/]
// TEST[s/<node_memory>/$body.nodes.0.memory/]
// TEST[s/<node_storage>/$body.nodes.0.storage/]
// TEST[s/<node_version>/$body.nodes.0.node_version/]