Skip to content

Commit

Permalink
Add desired nodes API (elastic#82975)
Browse files Browse the repository at this point in the history
This commit adds the Desired Nodes API, allowing orchestrators
that manage Elasticsearch clusters to let the system know about the
current/planned topology that the cluster will run on.
This allows the system to take better decisions based on the entire
cluster topology, including nodes that will be added/removed in the
near future.
  • Loading branch information
fcofdez authored Feb 1, 2022
1 parent 6efc28b commit 520b843
Show file tree
Hide file tree
Showing 47 changed files with 3,756 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/82975.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 82975
summary: Desired nodes API
area: Distributed
type: feature
issues: []
6 changes: 6 additions & 0 deletions docs/reference/cluster.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@ include::cluster/remote-info.asciidoc[]
include::cluster/tasks.asciidoc[]

include::cluster/voting-exclusions.asciidoc[]

include::cluster/update-desired-nodes.asciidoc[]

include::cluster/get-desired-nodes.asciidoc[]

include::cluster/delete-desired-nodes.asciidoc[]
59 changes: 59 additions & 0 deletions docs/reference/cluster/delete-desired-nodes.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[[delete-desired-nodes]]
=== Delete desired nodes API
++++
<titleabbrev>Delete desired nodes</titleabbrev>
++++

NOTE: {cloud-only}

Delete desired nodes.

[[delete-desired-nodes-request]]
==== {api-request-title}

//////////////////////////
[source,console]
--------------------------------------------------
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.1.0"
}
]
}
--------------------------------------------------
// TESTSETUP
//////////////////////////

[source,console]
--------------------------------------------------
DELETE /_internal/desired_nodes
--------------------------------------------------
// TEST

[[delete-desired-nodes-desc]]
==== {api-description-title}

This API deletes the desired nodes.

[[delete-desired-nodes-examples]]
==== {api-examples-title}

This example deletes the current desired nodes.

[source,console]
--------------------------------------------------
DELETE /_internal/desired_nodes
--------------------------------------------------
// TEST
94 changes: 94 additions & 0 deletions docs/reference/cluster/get-desired-nodes.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
[[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,
"memory" : "59gb",
"storage" : "1700gb",
"node_version" : "8.1.0"
}
]
}
--------------------------------------------------
// 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/]
107 changes: 107 additions & 0 deletions docs/reference/cluster/update-desired-nodes.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[[update-desired-nodes]]
=== Create or update desired nodes API
++++
<titleabbrev>Create or update desired nodes</titleabbrev>
++++

NOTE: {cloud-only}

Creates or updates the desired nodes.

[[update-desired-nodes-request]]
==== {api-request-title}

[source,console]
--------------------------------------------------
PUT /_internal/desired_nodes/<history_id>/<version>
{
"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.1.0"
}
]
}
--------------------------------------------------
// TEST[s/<history_id>/test/]
// TEST[s/<version>/1/]

//////////////////////////
[source,console]
--------------------------------------------------
DELETE /_internal/desired_nodes
--------------------------------------------------
// TEST[continued]
//////////////////////////

[[update-desired-nodes-query-params]]
==== {api-query-parms-title}

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=master-timeout]

[[update-desired-nodes-desc]]
==== {api-description-title}

This API creates or update the desired nodes. External orchestrators can use
this API to let Elasticsearch know about the cluster topology, including future
changes such as adding or removing nodes. Using this information, the system is
able to take better decisions.

[[update-desired-nodes-examples]]
==== {api-examples-title}

In this example, a new version for the desired nodes with history `Ywkh3INLQcuPT49f6kcppA` is created.
This API only accepts monotonically increasing versions.

[source,console]
--------------------------------------------------
PUT /_internal/desired_nodes/Ywkh3INLQcuPT49f6kcppA/100
{
"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.1.0"
}
]
}
--------------------------------------------------
// TEST

The API returns the following result:

[source,console-result]
--------------------------------------------------
{
"replaced_existing_history_id": false
}
--------------------------------------------------

//////////////////////////
[source,console]
--------------------------------------------------
DELETE /_internal/desired_nodes
--------------------------------------------------
// TEST[continued]
//////////////////////////
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"desired_nodes.delete_desired_nodes":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-desired-nodes.html",
"description": "Deletes the desired nodes. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."
},
"stability":"stable",
"visibility":"private",
"headers":{
"accept": [ "application/json"]
},
"url":{
"paths":[
{
"path":"/_internal/desired_nodes",
"methods":[
"DELETE"
]
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"desired_nodes.get_desired_nodes":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-desired-nodes.html",
"description": "Gets the latest desired nodes. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."
},
"stability":"stable",
"visibility":"private",
"headers":{
"accept": [ "application/json"]
},
"url":{
"paths":[
{
"path":"/_internal/desired_nodes/_latest",
"methods":[
"GET"
]
}
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"desired_nodes.update_desired_nodes":{
"documentation":{
"url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/update-desired-nodes.html",
"description": "Updates the desired nodes. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported."
},
"stability":"stable",
"visibility":"private",
"headers":{
"accept": [ "application/json"],
"content_type": ["application/json"]
},
"url":{
"paths":[
{
"path":"/_internal/desired_nodes/{history_id}/{version}",
"methods":[
"PUT"
],
"parts":{
"history_id": {
"type":"string",
"description":"the history id"
},
"version": {
"type": "integer",
"description": "the version number"
}
}
}
]
},
"body":{
"description":"the specification of the desired nodes",
"required":true
}
}
}
Loading

0 comments on commit 520b843

Please sign in to comment.