Skip to content

Commit 76f6dd3

Browse files
authored
Deprecation check for http.enabled setting (#36394)
Adds a deprecation check for nodes with the deprecated setting `http.enabled` set.
1 parent a6f677c commit 76f6dd3

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private DeprecationChecks() {
3838

3939
static List<BiFunction<List<NodeInfo>, List<NodeStats>, DeprecationIssue>> NODE_SETTINGS_CHECKS =
4040
Collections.unmodifiableList(Arrays.asList(
41+
NodeDeprecationChecks::httpEnabledSettingRemoved,
4142
NodeDeprecationChecks::tribeNodeCheck,
4243
NodeDeprecationChecks::azureRepositoryChanges,
4344
NodeDeprecationChecks::gcsRepositoryChanges,

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;
1010
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
11+
import org.elasticsearch.common.network.NetworkModule;
1112
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;
1213

1314
import java.util.List;
@@ -18,6 +19,21 @@
1819
*/
1920
public class NodeDeprecationChecks {
2021

22+
static DeprecationIssue httpEnabledSettingRemoved(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
23+
List<String> nodesFound = nodeInfos.stream()
24+
.filter(nodeInfo -> nodeInfo.getSettings().hasValue(NetworkModule.HTTP_ENABLED.getKey()))
25+
.map(nodeInfo -> nodeInfo.getNode().getName())
26+
.collect(Collectors.toList());
27+
if (nodesFound.size() > 0) {
28+
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
29+
"HTTP Enabled setting removed",
30+
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
31+
"#remove-http-enabled",
32+
"nodes with http.enabled set: " + nodesFound);
33+
}
34+
return null;
35+
}
36+
2137
static DeprecationIssue tribeNodeCheck(List<NodeInfo> nodeInfos, List<NodeStats> nodeStats) {
2238
List<String> nodesFound = nodeInfos.stream()
2339
.filter(nodeInfo -> nodeInfo.getSettings().getByPrefix("tribe.").isEmpty() == false)

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ null, null, null, null, new FsInfo(0L, null, paths), null, null, null,
5959
assertEquals(singletonList(expected), issues);
6060
}
6161

62+
public void testHttpEnabledCheck() {
63+
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,
64+
"HTTP Enabled setting removed",
65+
"https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking_70_cluster_changes.html" +
66+
"#remove-http-enabled",
67+
"nodes with http.enabled set: [node_check]");
68+
assertSettingsAndIssue("http.enabled", Boolean.toString(randomBoolean()), expected);
69+
}
70+
6271
public void testTribeNodeCheck() {
6372
String tribeSetting = "tribe." + randomAlphaOfLengthBetween(1, 20) + ".cluster.name";
6473
DeprecationIssue expected = new DeprecationIssue(DeprecationIssue.Level.CRITICAL,

0 commit comments

Comments
 (0)