forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add desired nodes API (elastic#82975)
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
Showing
47 changed files
with
3,756 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
////////////////////////// |
23 changes: 23 additions & 0 deletions
23
rest-api-spec/src/main/resources/rest-api-spec/api/desired_nodes.delete_desired_nodes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
rest-api-spec/src/main/resources/rest-api-spec/api/desired_nodes.get_desired_nodes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
rest-api-spec/src/main/resources/rest-api-spec/api/desired_nodes.update_desired_nodes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
Oops, something went wrong.