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 @@ -132,6 +132,11 @@ private DeprecationChecks() {
NodeDeprecationChecks::checkMaxLocalStorageNodesSetting,
NodeDeprecationChecks::checkSamlNameIdFormatSetting,
NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting,
NodeDeprecationChecks::checkSingleDataNodeWatermarkSetting,
NodeDeprecationChecks::checkExporterUseIngestPipelineSettings,
NodeDeprecationChecks::checkExporterPipelineMasterTimeoutSetting,
NodeDeprecationChecks::checkExporterCreateLegacyTemplateSetting,
NodeDeprecationChecks::checkClusterRoutingAllocationIncludeRelocationsSetting,
NodeDeprecationChecks::checkScriptContextCache,
NodeDeprecationChecks::checkScriptContextCompilationsRateLimitSetting,
NodeDeprecationChecks::checkScriptContextCacheSizeSetting,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,4 +1072,62 @@ static DeprecationIssue checkScriptContextCacheExpirationSetting(final Settings
}
return null;
}

private static DeprecationIssue deprecatedAffixSetting(Setting.AffixSetting<?> deprecatedAffixSetting, String detailPattern,
String url, DeprecationIssue.Level warningLevel, Settings settings) {
List<Setting<?>> deprecatedConcreteSettings = deprecatedAffixSetting.getAllConcreteSettings(settings)
.sorted(Comparator.comparing(Setting::getKey)).collect(Collectors.toList());

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

final String concatSettingNames = deprecatedConcreteSettings.stream().map(Setting::getKey).collect(Collectors.joining(","));
final String message = String.format(
Locale.ROOT,
"The [%s] settings are deprecated and will be removed after 8.0",
concatSettingNames
);
final String details = String.format(Locale.ROOT, detailPattern, concatSettingNames);

return new DeprecationIssue(warningLevel, message, url, details, false, null);
}

static DeprecationIssue checkExporterUseIngestPipelineSettings(final Settings settings,
final PluginsAndModules pluginsAndModules,
final ClusterState clusterState,
final XPackLicenseState licenseState) {
return deprecatedAffixSetting(
Setting.affixKeySetting("xpack.monitoring.exporters.","use_ingest", key -> Setting.boolSetting(key, true)),
"Remove the following settings from elasticsearch.yml: [%s]",
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting",
DeprecationIssue.Level.WARNING,
settings);
}

static DeprecationIssue checkExporterPipelineMasterTimeoutSetting(final Settings settings,
final PluginsAndModules pluginsAndModules,
final ClusterState clusterState,
final XPackLicenseState licenseState) {
return deprecatedAffixSetting(
Setting.affixKeySetting("xpack.monitoring.exporters.","index.pipeline.master_timeout",
(key) -> Setting.timeSetting(key, TimeValue.MINUS_ONE)),
"Remove the following settings from elasticsearch.yml: [%s]",
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting",
DeprecationIssue.Level.WARNING,
settings);
}

static DeprecationIssue checkExporterCreateLegacyTemplateSetting(final Settings settings,
final PluginsAndModules pluginsAndModules,
final ClusterState clusterState,
final XPackLicenseState licenseState) {
return deprecatedAffixSetting(
Setting.affixKeySetting("xpack.monitoring.exporters.","index.template.create_legacy_templates",
(key) -> Setting.boolSetting(key, true)),
"Remove the following settings from elasticsearch.yml: [%s]",
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting",
DeprecationIssue.Level.WARNING,
settings);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.elasticsearch.common.util.concurrent.EsExecutors;
import org.elasticsearch.core.Set;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.NodeEnvironment;
import org.elasticsearch.gateway.GatewayService;
Expand Down Expand Up @@ -1554,4 +1555,63 @@ public void testScriptContextCacheExpirationSetting() {
"[script.context.moving-function.cache_expire] setting was deprecated in Elasticsearch and will be removed in a future" +
" release! See the breaking changes documentation for the next major version.");
}

public void testExporterUseIngestPipelineSettings() {
Settings settings = Settings.builder()
.put("xpack.monitoring.exporters.test.use_ingest", true)
.build();

List<DeprecationIssue> issues = Collections.singletonList(
NodeDeprecationChecks.checkExporterUseIngestPipelineSettings(settings, null, null, null)
);

final String expectedUrl =
"https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting";
assertThat(issues, hasItem(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"The [xpack.monitoring.exporters.test.use_ingest] settings are deprecated and will be removed after 8.0",
expectedUrl,
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.use_ingest]",
false, null)));
}

public void testExporterPipelineMasterTimeoutSetting() {
Settings settings = Settings.builder()
.put("xpack.monitoring.exporters.test.index.pipeline.master_timeout", TimeValue.timeValueSeconds(10))
.build();

List<DeprecationIssue> issues = Collections.singletonList(
NodeDeprecationChecks.checkExporterPipelineMasterTimeoutSetting(settings, null, null, null)
);

final String expectedUrl =
"https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting";
assertThat(issues, hasItem(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"The [xpack.monitoring.exporters.test.index.pipeline.master_timeout] settings are deprecated and will be removed after 8.0",
expectedUrl,
"Remove the following settings from elasticsearch.yml: [xpack.monitoring.exporters.test.index.pipeline.master_timeout]",
false, null)));
}

public void testExporterCreateLegacyTemplateSetting() {
Settings settings = Settings.builder()
.put("xpack.monitoring.exporters.test.index.template.create_legacy_templates", true)
.build();

List<DeprecationIssue> issues = Collections.singletonList(
NodeDeprecationChecks.checkExporterCreateLegacyTemplateSetting(settings, null, null, null)
);

final String expectedUrl =
"https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting";
assertThat(issues, hasItem(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"The [xpack.monitoring.exporters.test.index.template.create_legacy_templates] settings are deprecated and will be " +
"removed after 8.0",
expectedUrl,
"Remove the following settings from elasticsearch.yml: " +
"[xpack.monitoring.exporters.test.index.template.create_legacy_templates]",
false, null)));
}
}