Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private DeprecationChecks() {
NodeDeprecationChecks::checkImplicitlyDisabledSecurityOnBasicAndTrial,
NodeDeprecationChecks::checkSearchRemoteSettings,
NodeDeprecationChecks::checkMonitoringExporterPassword,
NodeDeprecationChecks::checkTransportClientProfilesFilterSetting,
NodeDeprecationChecks::checkDelayClusterStateRecoverySettings,
NodeDeprecationChecks::checkFixedAutoQueueSizeThreadpool,
NodeDeprecationChecks::checkJoinTimeoutSetting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,38 @@ static DeprecationIssue checkClusterRoutingAllocationIncludeRelocationsSetting(f
);
}

static DeprecationIssue checkTransportClientProfilesFilterSetting(
final Settings settings,
final PluginsAndModules pluginsAndModules,
ClusterState cs,
XPackLicenseState licenseState
) {
final Setting.AffixSetting<String> transportTypeProfileSetting =
Setting.affixKeySetting("transport.profiles.","xpack.security.type", s -> Setting.simpleString(s));
List<Setting<?>> transportProfiles = transportTypeProfileSetting.getAllConcreteSettings(settings)
.sorted(Comparator.comparing(Setting::getKey)).collect(Collectors.toList());

if (transportProfiles.isEmpty()) {
return null;
}

final String transportProfilesSettings = transportProfiles.stream().map(Setting::getKey).collect(Collectors.joining(","));
final String message = String.format(
Locale.ROOT,
"settings [%s] are deprecated and will be removed in the next major version",
transportProfilesSettings
);
final String details = String.format(
Locale.ROOT,
"transport client will be removed in the next major version so transport client related settings [%s] must be removed",
transportProfilesSettings
);

final String url = "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0" +
".html#separating-node-and-client-traffic";
return new DeprecationIssue(DeprecationIssue.Level.CRITICAL, message, url, details, false, null);
}

static DeprecationIssue checkDelayClusterStateRecoverySettings(final Settings settings,
final PluginsAndModules pluginsAndModules,
final ClusterState clusterState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,44 @@ public void testImplicitlyConfiguredSecurityOnGoldPlus() {
assertThat(issues, empty());
}

public void testCheckTransportClientProfilesFilterSetting() {
final int numProfiles = randomIntBetween(1, 3);
final String[] profileNames = new String[numProfiles];
final Settings.Builder b = Settings.builder();
for (int k = 0; k < numProfiles; k++) {
profileNames[k] = randomAlphaOfLength(5);
b.put("transport.profiles." + profileNames[k] + ".xpack.security.type", randomAlphaOfLengthBetween(3, 10));
}
final Settings settings = b.build();
final XPackLicenseState licenseState = new XPackLicenseState(Settings.EMPTY, () -> 0);
DeprecationIssue issue = NodeDeprecationChecks.checkTransportClientProfilesFilterSetting(settings, null, null, licenseState);
final String expectedUrl =
"https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-8.0.html#separating-node-and-client-traffic";
final String joinedNames = Arrays
.stream(profileNames)
.map(s -> "transport.profiles." + s + ".xpack.security.type")
.sorted()
.collect(Collectors.joining(","));

assertThat(issue, equalTo(new DeprecationIssue(
DeprecationIssue.Level.CRITICAL,
String.format(
Locale.ROOT,
"settings [%s] are deprecated and will be removed in the next major version",
joinedNames
),
expectedUrl,
String.format(
Locale.ROOT,
"transport client will be removed in the next major version so transport client related settings [%s] must be removed",
joinedNames
), false, null)));

// test for absence of deprecated exporter passwords
issue = NodeDeprecationChecks.checkTransportClientProfilesFilterSetting(Settings.builder().build(), null, null, licenseState);
assertThat(issue, nullValue());
}

public void testCheckDelayClusterStateRecoverySettings() {
Settings settings = Settings.builder()
.put(GatewayService.EXPECTED_NODES_SETTING.getKey(), randomIntBetween(2, 10))
Expand Down