From 8bd4fb738ea01f261ca754bc2865a1eeec16ed22 Mon Sep 17 00:00:00 2001 From: James Baiera Date: Tue, 28 Jan 2025 13:56:48 -0500 Subject: [PATCH] Update node deprecation checks to return critical deprecations for monitoring settings. --- .../deprecation/NodeDeprecationChecks.java | 20 ++++++++++--------- .../NodeDeprecationChecksTests.java | 16 +++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java index b6fff5a82f0cd..94ebbf7cb4221 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecks.java @@ -46,7 +46,8 @@ static DeprecationIssue checkDeprecatedSetting( final Settings nodeSettings, final Setting deprecatedSetting, final String url, - final String whenRemoved + final String whenRemoved, + final DeprecationIssue.Level level ) { if (deprecatedSetting.exists(clusterSettings) == false && deprecatedSetting.exists(nodeSettings) == false) { return null; @@ -66,7 +67,7 @@ static DeprecationIssue checkDeprecatedSetting( deprecatedSettingKey, value ); - return new DeprecationIssue(DeprecationIssue.Level.WARNING, message, url, details, false, null); + return new DeprecationIssue(level, message, url, details, false, null); } private static Map createMetaMapForRemovableSettings(boolean canAutoRemoveSetting, String removableSetting) { @@ -365,7 +366,8 @@ static DeprecationIssue genericMonitoringSetting( nodeSettings, deprecated, MONITORING_SETTING_DEPRECATION_LINK, - MONITORING_SETTING_REMOVAL_TIME + MONITORING_SETTING_REMOVAL_TIME, + DeprecationIssue.Level.CRITICAL ); } @@ -382,7 +384,7 @@ static DeprecationIssue genericMonitoringAffixSetting( ), "Remove the following settings: [%s]", MONITORING_SETTING_DEPRECATION_LINK, - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, clusterSettings, nodeSettings ); @@ -397,7 +399,7 @@ static DeprecationIssue genericMonitoringAffixSecureSetting( Setting.affixKeySetting("xpack.monitoring.exporters.", deprecatedSuffix, k -> SecureSetting.secureString(k, null)), "Remove the following settings from the keystore: [%s]", MONITORING_SETTING_DEPRECATION_LINK, - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, clusterSettings, nodeSettings ); @@ -412,7 +414,7 @@ static DeprecationIssue genericMonitoringAffixGroupedSetting( Setting.affixKeySetting("xpack.monitoring.exporters.", deprecatedSuffix, k -> Setting.groupSetting(k + ".")), "Remove the following settings: [%s]", MONITORING_SETTING_DEPRECATION_LINK, - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, clusterSettings, nodeSettings ); @@ -711,7 +713,7 @@ static DeprecationIssue checkExporterUseIngestPipelineSettings( MonitoringDeprecatedSettings.USE_INGEST_PIPELINE_SETTING, "Remove the following settings: [%s]", "https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting", - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, clusterState.metadata().settings(), settings ); @@ -727,7 +729,7 @@ static DeprecationIssue checkExporterPipelineMasterTimeoutSetting( MonitoringDeprecatedSettings.PIPELINE_CHECK_TIMEOUT_SETTING, "Remove the following settings: [%s]", "https://ela.st/es-deprecation-7-monitoring-exporter-pipeline-timeout-setting", - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, clusterState.metadata().settings(), settings ); @@ -743,7 +745,7 @@ static DeprecationIssue checkExporterCreateLegacyTemplateSetting( MonitoringDeprecatedSettings.TEMPLATE_CREATE_LEGACY_VERSIONS_SETTING, "Remove the following settings: [%s]", "https://ela.st/es-deprecation-7-monitoring-exporter-create-legacy-template-setting", - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, clusterState.metadata().settings(), settings ); diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java index 3aaee0e5cdb52..35a5fa4bc921f 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/NodeDeprecationChecksTests.java @@ -244,7 +244,7 @@ void monitoringSetting(String settingKey, String value) { issues, hasItem( new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "setting [" + settingKey + "] is deprecated and will be removed after 8.0", expectedUrl, "the setting [" + settingKey + "] is currently set to [" + value + "], remove this setting", @@ -268,7 +268,7 @@ void monitoringExporterSetting(String suffix, String value) { issues, hasItem( new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "The [" + settingKey + "] settings are deprecated and will be removed after 8.0", expectedUrl, "Remove the following settings: [" + settingKey + "]", @@ -293,7 +293,7 @@ void monitoringExporterGroupedSetting(String suffix, String value) { issues, hasItem( new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "The [" + settingKey + ".*] settings are deprecated and will be removed after 8.0", expectedUrl, "Remove the following settings: [" + subSettingKey + "]", @@ -319,7 +319,7 @@ void monitoringExporterSecureSetting(String suffix, String value) { issues, hasItem( new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "The [" + settingKey + "] settings are deprecated and will be removed after 8.0", expectedUrl, "Remove the following settings from the keystore: [" + settingKey + "]", @@ -467,7 +467,7 @@ public void testExporterUseIngestPipelineSettings() { issues, hasItem( new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "The [xpack.monitoring.exporters.test.use_ingest] settings are deprecated and will be removed after 8.0", expectedUrl, "Remove the following settings: [xpack.monitoring.exporters.test.use_ingest]", @@ -493,7 +493,7 @@ public void testExporterPipelineMasterTimeoutSetting() { issues, hasItem( new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "The [xpack.monitoring.exporters.test.index.pipeline.master_timeout] " + "settings are deprecated and will be removed after 8.0", expectedUrl, @@ -518,7 +518,7 @@ public void testExporterCreateLegacyTemplateSetting() { issues, hasItem( new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "The [xpack.monitoring.exporters.test.index.template.create_legacy_templates] settings are deprecated and will be " + "removed after 8.0", expectedUrl, @@ -806,7 +806,7 @@ public void testDynamicSettings() { Map meta = null; final DeprecationIssue expected = new DeprecationIssue( - DeprecationIssue.Level.WARNING, + DeprecationIssue.Level.CRITICAL, "The [" + concreteSettingKey + "] settings are deprecated and will be removed after 8.0", "https://ela.st/es-deprecation-7-monitoring-exporter-use-ingest-setting", "Remove the following settings: [" + concreteSettingKey + "]",