Browse Source

Deprecate xpack.eql.enabled setting and make it a no-op (#61375)

* Deprecate xpack.eql.enabled and make it a no-op
* Remove uses of xpack.eql.enabled
William Brafford 5 years ago
parent
commit
035dfce16e

+ 0 - 1
client/rest-high-level/build.gradle

@@ -96,7 +96,6 @@ testClusters.all {
   setting 'xpack.security.authc.api_key.enabled', 'true'
   setting 'xpack.security.http.ssl.enabled', 'false'
   setting 'xpack.security.transport.ssl.enabled', 'false'
-  setting 'xpack.eql.enabled', 'true'
   // Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API
   setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
   setting 'xpack.security.transport.ssl.truststore.path', 'testnode.jks'

+ 0 - 1
docs/build.gradle

@@ -56,7 +56,6 @@ testClusters.integTest {
       systemProperty 'es.autoscaling_feature_flag_registered', 'true'
     }
     setting 'xpack.autoscaling.enabled', 'true'
-    setting 'xpack.eql.enabled', 'true'
     keystorePassword 's3cr3t'
   }
 

+ 0 - 1
x-pack/plugin/eql/qa/rest/build.gradle

@@ -14,7 +14,6 @@ dependencies {
 
 testClusters.all {
   testDistribution = 'DEFAULT'
-  setting 'xpack.eql.enabled', 'true'
   setting 'xpack.license.self_generated.type', 'basic'
   setting 'xpack.monitoring.collection.enabled', 'true'
 }

+ 0 - 1
x-pack/plugin/eql/qa/security/build.gradle

@@ -6,7 +6,6 @@ dependencies {
 
 testClusters.all {
   testDistribution = 'DEFAULT'
-  setting 'xpack.eql.enabled', 'true'
   setting 'xpack.license.self_generated.type', 'basic'
   setting 'xpack.monitoring.collection.enabled', 'true'
   setting 'xpack.security.enabled', 'true'

+ 0 - 2
x-pack/plugin/eql/src/internalClusterTest/java/org/elasticsearch/xpack/eql/action/AbstractEqlIntegTestCase.java

@@ -11,7 +11,6 @@ import org.elasticsearch.license.LicenseService;
 import org.elasticsearch.plugins.Plugin;
 import org.elasticsearch.test.ESIntegTestCase;
 import org.elasticsearch.xpack.core.XPackSettings;
-import org.elasticsearch.xpack.eql.plugin.EqlPlugin;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -28,7 +27,6 @@ public abstract class AbstractEqlIntegTestCase extends ESIntegTestCase {
         settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false);
         settings.put(XPackSettings.GRAPH_ENABLED.getKey(), false);
         settings.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false);
-        settings.put(EqlPlugin.EQL_ENABLED_SETTING.getKey(), true);
         settings.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
         return settings.build();
     }

+ 2 - 3
x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/EqlInfoTransportAction.java

@@ -7,7 +7,6 @@ package org.elasticsearch.xpack.eql;
 
 import org.elasticsearch.action.support.ActionFilters;
 import org.elasticsearch.common.inject.Inject;
-import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.license.XPackLicenseState;
 import org.elasticsearch.transport.TransportService;
 import org.elasticsearch.xpack.core.XPackField;
@@ -22,9 +21,9 @@ public class EqlInfoTransportAction extends XPackInfoFeatureTransportAction {
 
     @Inject
     public EqlInfoTransportAction(TransportService transportService, ActionFilters actionFilters,
-                                  Settings settings, XPackLicenseState licenseState) {
+                                  XPackLicenseState licenseState) {
         super(XPackInfoFeatureAction.EQL.name(), transportService, actionFilters);
-        this.enabled = EqlPlugin.isEnabled(settings);
+        this.enabled = EqlPlugin.isEnabled();
         this.licenseState = licenseState;
     }
 

+ 2 - 3
x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/EqlUsageTransportAction.java

@@ -12,7 +12,6 @@ import org.elasticsearch.cluster.ClusterState;
 import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
 import org.elasticsearch.cluster.service.ClusterService;
 import org.elasticsearch.common.inject.Inject;
-import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.license.XPackLicenseState;
 import org.elasticsearch.protocol.xpack.XPackUsageRequest;
 import org.elasticsearch.tasks.Task;
@@ -41,10 +40,10 @@ public class EqlUsageTransportAction extends XPackUsageFeatureTransportAction {
     @Inject
     public EqlUsageTransportAction(TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
                                    ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver,
-                                   Settings settings, XPackLicenseState licenseState, Client client) {
+                                   XPackLicenseState licenseState, Client client) {
         super(XPackUsageFeatureAction.EQL.name(), transportService, clusterService, threadPool, actionFilters,
             indexNameExpressionResolver);
-        this.enabled = EqlPlugin.isEnabled(settings);
+        this.enabled = EqlPlugin.isEnabled();
         this.licenseState = licenseState;
         this.client = client;
     }

+ 14 - 25
x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/EqlPlugin.java

@@ -47,16 +47,14 @@ import java.util.function.Supplier;
 
 public class EqlPlugin extends Plugin implements ActionPlugin {
 
-    private final boolean enabled;
-
     public static final Setting<Boolean> EQL_ENABLED_SETTING = Setting.boolSetting(
         "xpack.eql.enabled",
         true,
-        Setting.Property.NodeScope
+        Setting.Property.NodeScope,
+        Setting.Property.Deprecated
     );
 
-    public EqlPlugin(final Settings settings) {
-        this.enabled = EQL_ENABLED_SETTING.get(settings);
+    public EqlPlugin() {
     }
 
     @Override
@@ -86,16 +84,10 @@ public class EqlPlugin extends Plugin implements ActionPlugin {
 
     @Override
     public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
-        if (enabled) {
-            return List.of(
-                new ActionHandler<>(EqlSearchAction.INSTANCE, TransportEqlSearchAction.class),
-                new ActionHandler<>(EqlStatsAction.INSTANCE, TransportEqlStatsAction.class),
-                new ActionHandler<>(EqlAsyncGetResultAction.INSTANCE, TransportEqlAsyncGetResultAction.class),
-                new ActionHandler<>(XPackUsageFeatureAction.EQL, EqlUsageTransportAction.class),
-                new ActionHandler<>(XPackInfoFeatureAction.EQL, EqlInfoTransportAction.class)
-            );
-        }
         return List.of(
+            new ActionHandler<>(EqlSearchAction.INSTANCE, TransportEqlSearchAction.class),
+            new ActionHandler<>(EqlStatsAction.INSTANCE, TransportEqlStatsAction.class),
+            new ActionHandler<>(EqlAsyncGetResultAction.INSTANCE, TransportEqlAsyncGetResultAction.class),
             new ActionHandler<>(XPackUsageFeatureAction.EQL, EqlUsageTransportAction.class),
             new ActionHandler<>(XPackInfoFeatureAction.EQL, EqlInfoTransportAction.class)
         );
@@ -106,8 +98,8 @@ public class EqlPlugin extends Plugin implements ActionPlugin {
     }
 
     // TODO: this needs to be used by all plugin methods - including getActions and createComponents
-    public static boolean isEnabled(Settings settings) {
-        return EQL_ENABLED_SETTING.get(settings);
+    public static boolean isEnabled() {
+        return true; // basic license level features are always enabled
     }
 
     @Override
@@ -119,15 +111,12 @@ public class EqlPlugin extends Plugin implements ActionPlugin {
                                              IndexNameExpressionResolver indexNameExpressionResolver,
                                              Supplier<DiscoveryNodes> nodesInCluster) {
 
-        if (enabled) {
-            return List.of(
-                new RestEqlSearchAction(),
-                new RestEqlStatsAction(),
-                new RestEqlGetAsyncResultAction(),
-                new RestEqlDeleteAsyncResultAction()
-            );
-        }
-        return List.of();
+        return List.of(
+            new RestEqlSearchAction(),
+            new RestEqlStatsAction(),
+            new RestEqlGetAsyncResultAction(),
+            new RestEqlDeleteAsyncResultAction()
+        );
     }
 
     // overridable by tests

+ 4 - 8
x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/EqlInfoTransportActionTests.java

@@ -57,20 +57,16 @@ public class EqlInfoTransportActionTests extends ESTestCase {
 
     public void testAvailable() {
         EqlInfoTransportAction featureSet = new EqlInfoTransportAction(
-            mock(TransportService.class), mock(ActionFilters.class), Settings.EMPTY, licenseState);
+            mock(TransportService.class), mock(ActionFilters.class), licenseState);
         boolean available = randomBoolean();
         when(licenseState.isAllowed(XPackLicenseState.Feature.EQL)).thenReturn(available);
         assertThat(featureSet.available(), is(available));
     }
 
     public void testEnabled() {
-        boolean enabled = randomBoolean();
-        Settings.Builder settings = Settings.builder();
-        settings.put("xpack.eql.enabled", enabled);
-
         EqlInfoTransportAction featureSet = new EqlInfoTransportAction(
-            mock(TransportService.class), mock(ActionFilters.class), settings.build(), licenseState);
-        assertThat(featureSet.enabled(), is(enabled));
+            mock(TransportService.class), mock(ActionFilters.class), licenseState);
+        assertThat(featureSet.enabled(), is(true));
     }
 
     @SuppressWarnings("unchecked")
@@ -105,7 +101,7 @@ public class EqlInfoTransportActionTests extends ESTestCase {
         when(clusterService.localNode()).thenReturn(mockNode);
 
         var usageAction = new EqlUsageTransportAction(mock(TransportService.class), clusterService, null,
-            mock(ActionFilters.class), null, Settings.builder().put("xpack.eql.enabled", true).build(), licenseState, client);
+            mock(ActionFilters.class), null, licenseState, client);
         PlainActionFuture<XPackUsageFeatureResponse> future = new PlainActionFuture<>();
         usageAction.masterOperation(mock(Task.class), null, null, future);
         EqlFeatureSetUsage eqlUsage = (EqlFeatureSetUsage) future.get().getUsage();

+ 1 - 1
x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/action/LocalStateEQLXPackPlugin.java

@@ -19,7 +19,7 @@ public class LocalStateEQLXPackPlugin extends LocalStateCompositeXPackPlugin {
     public LocalStateEQLXPackPlugin(final Settings settings, final Path configPath) {
         super(settings, configPath);
         LocalStateEQLXPackPlugin thisVar = this;
-        plugins.add(new EqlPlugin(settings) {
+        plugins.add(new EqlPlugin() {
             @Override
             protected XPackLicenseState getLicenseState() {
                 return thisVar.getLicenseState();

+ 2 - 3
x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/plugin/EqlPluginTests.java

@@ -6,14 +6,13 @@
 
 package org.elasticsearch.xpack.eql.plugin;
 
-import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.test.ESTestCase;
 
 import static org.hamcrest.Matchers.hasItem;
 
 public class EqlPluginTests extends ESTestCase {
     public void testEnabledSettingRegisteredInSnapshotBuilds() {
-        final EqlPlugin plugin = new EqlPlugin(Settings.EMPTY) {
+        final EqlPlugin plugin = new EqlPlugin() {
 
             @Override
             protected boolean isSnapshot() {
@@ -25,7 +24,7 @@ public class EqlPluginTests extends ESTestCase {
     }
 
     public void testEnabledSettingNotRegisteredInNonSnapshotBuilds() {
-        final EqlPlugin plugin = new EqlPlugin(Settings.EMPTY) {
+        final EqlPlugin plugin = new EqlPlugin() {
 
             @Override
             protected boolean isSnapshot() {