Skip to content

Commit 5a0dca2

Browse files
Deprecate xpack.eql.enabled setting and make it a no-op (#61375) (#62491)
* Deprecate xpack.eql.enabled and make it a no-op * Remove uses of xpack.eql.enabled
1 parent 5f64343 commit 5a0dca2

File tree

10 files changed

+25
-45
lines changed

10 files changed

+25
-45
lines changed

client/rest-high-level/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ testClusters.all {
9393
setting 'xpack.security.authc.api_key.enabled', 'true'
9494
setting 'xpack.security.http.ssl.enabled', 'false'
9595
setting 'xpack.security.transport.ssl.enabled', 'false'
96-
setting 'xpack.eql.enabled', 'true'
9796
// Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API
9897
setting 'xpack.security.http.ssl.certificate_authorities', 'testnode.crt'
9998
setting 'xpack.security.transport.ssl.truststore.path', 'testnode.jks'

docs/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ testClusters.integTest {
5656
systemProperty 'es.autoscaling_feature_flag_registered', 'true'
5757
}
5858
setting 'xpack.autoscaling.enabled', 'true'
59-
setting 'xpack.eql.enabled', 'true'
6059
keystorePassword 's3cr3t'
6160
}
6261

x-pack/plugin/eql/qa/rest/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies {
1414

1515
testClusters.all {
1616
testDistribution = 'DEFAULT'
17-
setting 'xpack.eql.enabled', 'true'
1817
setting 'xpack.license.self_generated.type', 'basic'
1918
setting 'xpack.monitoring.collection.enabled', 'true'
2019
}

x-pack/plugin/eql/qa/security/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ dependencies {
66

77
testClusters.all {
88
testDistribution = 'DEFAULT'
9-
setting 'xpack.eql.enabled', 'true'
109
setting 'xpack.license.self_generated.type', 'basic'
1110
setting 'xpack.monitoring.collection.enabled', 'true'
1211
setting 'xpack.security.enabled', 'true'

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.elasticsearch.plugins.Plugin;
1212
import org.elasticsearch.test.ESIntegTestCase;
1313
import org.elasticsearch.xpack.core.XPackSettings;
14-
import org.elasticsearch.xpack.eql.plugin.EqlPlugin;
1514

1615
import java.util.Collection;
1716
import java.util.Collections;
@@ -28,7 +27,6 @@ protected Settings nodeSettings(int nodeOrdinal) {
2827
settings.put(XPackSettings.WATCHER_ENABLED.getKey(), false);
2928
settings.put(XPackSettings.GRAPH_ENABLED.getKey(), false);
3029
settings.put(XPackSettings.MACHINE_LEARNING_ENABLED.getKey(), false);
31-
settings.put(EqlPlugin.EQL_ENABLED_SETTING.getKey(), true);
3230
settings.put(LicenseService.SELF_GENERATED_LICENSE_TYPE.getKey(), "trial");
3331
return settings.build();
3432
}

x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/EqlFeatureSet.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.elasticsearch.client.Client;
1111
import org.elasticsearch.common.Nullable;
1212
import org.elasticsearch.common.inject.Inject;
13-
import org.elasticsearch.common.settings.Settings;
1413
import org.elasticsearch.license.XPackLicenseState;
1514
import org.elasticsearch.xpack.core.XPackFeatureSet;
1615
import org.elasticsearch.xpack.core.XPackField;
@@ -34,8 +33,8 @@ public class EqlFeatureSet implements XPackFeatureSet {
3433
private final Client client;
3534

3635
@Inject
37-
public EqlFeatureSet(Settings settings, @Nullable XPackLicenseState licenseState, Client client) {
38-
this.enabled = EqlPlugin.isEnabled(settings);
36+
public EqlFeatureSet(@Nullable XPackLicenseState licenseState, Client client) {
37+
this.enabled = EqlPlugin.isEnabled();
3938
this.licenseState = licenseState;
4039
this.client = client;
4140
}

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

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,14 @@
4747

4848
public class EqlPlugin extends Plugin implements ActionPlugin {
4949

50-
private final boolean enabled;
51-
5250
public static final Setting<Boolean> EQL_ENABLED_SETTING = Setting.boolSetting(
5351
"xpack.eql.enabled",
5452
true,
55-
Setting.Property.NodeScope
53+
Setting.Property.NodeScope,
54+
Setting.Property.Deprecated
5655
);
5756

58-
public EqlPlugin(final Settings settings) {
59-
this.enabled = EQL_ENABLED_SETTING.get(settings);
57+
public EqlPlugin() {
6058
}
6159

6260
@Override
@@ -93,23 +91,20 @@ public List<Setting<?>> getSettings() {
9391

9492
@Override
9593
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
96-
if (enabled) {
97-
return Arrays.asList(
98-
new ActionHandler<>(EqlSearchAction.INSTANCE, TransportEqlSearchAction.class),
99-
new ActionHandler<>(EqlStatsAction.INSTANCE, TransportEqlStatsAction.class),
100-
new ActionHandler<>(EqlAsyncGetResultAction.INSTANCE, TransportEqlAsyncGetResultAction.class)
101-
);
102-
}
103-
return Collections.emptyList();
94+
return org.elasticsearch.common.collect.List.of(
95+
new ActionHandler<>(EqlSearchAction.INSTANCE, TransportEqlSearchAction.class),
96+
new ActionHandler<>(EqlStatsAction.INSTANCE, TransportEqlStatsAction.class),
97+
new ActionHandler<>(EqlAsyncGetResultAction.INSTANCE, TransportEqlAsyncGetResultAction.class)
98+
);
10499
}
105100

106101
boolean isSnapshot() {
107102
return Build.CURRENT.isSnapshot();
108103
}
109104

110105
// TODO: this needs to be used by all plugin methods - including getActions and createComponents
111-
public static boolean isEnabled(Settings settings) {
112-
return EQL_ENABLED_SETTING.get(settings);
106+
public static boolean isEnabled() {
107+
return true; // basic license level features are always enabled
113108
}
114109

115110
@Override
@@ -121,15 +116,12 @@ public List<RestHandler> getRestHandlers(Settings settings,
121116
IndexNameExpressionResolver indexNameExpressionResolver,
122117
Supplier<DiscoveryNodes> nodesInCluster) {
123118

124-
if (enabled) {
125-
return Arrays.asList(
126-
new RestEqlSearchAction(),
127-
new RestEqlStatsAction(),
128-
new RestEqlGetAsyncResultAction(),
129-
new RestEqlDeleteAsyncResultAction()
130-
);
131-
}
132-
return Collections.emptyList();
119+
return Arrays.asList(
120+
new RestEqlSearchAction(),
121+
new RestEqlStatsAction(),
122+
new RestEqlGetAsyncResultAction(),
123+
new RestEqlDeleteAsyncResultAction()
124+
);
133125
}
134126

135127
// overridable by tests

x-pack/plugin/eql/src/test/java/org/elasticsearch/xpack/eql/EqlFeatureSetTests.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,15 @@ public void init() throws Exception {
5151
}
5252

5353
public void testAvailable() {
54-
EqlFeatureSet featureSet = new EqlFeatureSet(Settings.EMPTY, licenseState, client);
54+
EqlFeatureSet featureSet = new EqlFeatureSet(licenseState, client);
5555
boolean available = randomBoolean();
5656
when(licenseState.isAllowed(XPackLicenseState.Feature.EQL)).thenReturn(available);
5757
assertThat(featureSet.available(), is(available));
5858
}
5959

6060
public void testEnabled() {
61-
boolean enabled = randomBoolean();
62-
Settings.Builder settings = Settings.builder();
63-
settings.put("xpack.eql.enabled", enabled);
64-
65-
EqlFeatureSet featureSet = new EqlFeatureSet(settings.build(), licenseState, client);
66-
assertThat(featureSet.enabled(), is(enabled));
61+
EqlFeatureSet featureSet = new EqlFeatureSet(licenseState, client);
62+
assertThat(featureSet.enabled(), is(true));
6763
}
6864

6965
@SuppressWarnings("unchecked")
@@ -94,7 +90,7 @@ public void testUsageStats() throws Exception {
9490
}).when(client).execute(eq(EqlStatsAction.INSTANCE), any(), any());
9591

9692
PlainActionFuture<EqlFeatureSet.Usage> future = new PlainActionFuture<>();
97-
new EqlFeatureSet(Settings.builder().put("xpack.eql.enabled", true).build(), licenseState, client).usage(future);
93+
new EqlFeatureSet(licenseState, client).usage(future);
9894
EqlFeatureSetUsage eqlUsage = (EqlFeatureSetUsage) future.get();
9995

10096
long fooBarBaz = ObjectPath.eval("foo.bar.baz", eqlUsage.stats());

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class LocalStateEQLXPackPlugin extends LocalStateCompositeXPackPlugin {
1919
public LocalStateEQLXPackPlugin(final Settings settings, final Path configPath) {
2020
super(settings, configPath);
2121
LocalStateEQLXPackPlugin thisVar = this;
22-
plugins.add(new EqlPlugin(settings) {
22+
plugins.add(new EqlPlugin() {
2323
@Override
2424
protected XPackLicenseState getLicenseState() {
2525
return thisVar.getLicenseState();

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66

77
package org.elasticsearch.xpack.eql.plugin;
88

9-
import org.elasticsearch.common.settings.Settings;
109
import org.elasticsearch.test.ESTestCase;
1110

1211
import static org.hamcrest.Matchers.hasItem;
1312

1413
public class EqlPluginTests extends ESTestCase {
1514
public void testEnabledSettingRegisteredInSnapshotBuilds() {
16-
final EqlPlugin plugin = new EqlPlugin(Settings.EMPTY) {
15+
final EqlPlugin plugin = new EqlPlugin() {
1716

1817
@Override
1918
protected boolean isSnapshot() {
@@ -25,7 +24,7 @@ protected boolean isSnapshot() {
2524
}
2625

2726
public void testEnabledSettingNotRegisteredInNonSnapshotBuilds() {
28-
final EqlPlugin plugin = new EqlPlugin(Settings.EMPTY) {
27+
final EqlPlugin plugin = new EqlPlugin() {
2928

3029
@Override
3130
protected boolean isSnapshot() {

0 commit comments

Comments
 (0)