From fac9280b8bad8cee7117c1d87d6c1fdd2b93be54 Mon Sep 17 00:00:00 2001 From: Henning Andersen Date: Mon, 7 Dec 2020 19:29:29 +0100 Subject: [PATCH 1/3] Autoscaling remove feature flags Removed the autoscaling feature flags, autoscaling is now on by default (though it requires an external system to handle the autoscaling events). Added experimental notice to all autoscaling related documentation pages. Relates #51191 --- docs/build.gradle | 4 - .../apis/autoscaling-apis.asciidoc | 2 + .../apis/delete-autoscaling-policy.asciidoc | 2 + .../apis/get-autoscaling-capacity.asciidoc | 2 + .../apis/get-autoscaling-policy.asciidoc | 2 + .../apis/put-autoscaling-policy.asciidoc | 2 + docs/reference/index.asciidoc | 4 - docs/reference/rest-api/index.asciidoc | 4 - x-pack/plugin/autoscaling/build.gradle | 8 +- .../plugin/autoscaling/qa/rest/build.gradle | 4 - .../autoscaling/AutoscalingIntegTestCase.java | 8 -- .../xpack/autoscaling/Autoscaling.java | 78 ++++--------------- .../autoscaling/AutoscalingTestCase.java | 4 +- .../xpack/autoscaling/AutoscalingTests.java | 41 ---------- .../autoscaling/LocalStateAutoscaling.java | 2 +- .../qa/native-multi-node-tests/build.gradle | 3 - 16 files changed, 29 insertions(+), 141 deletions(-) delete mode 100644 x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTests.java diff --git a/docs/build.gradle b/docs/build.gradle index 34c3e67fcfb3a..116a4f192c88c 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -52,10 +52,6 @@ testClusters.matching { it.name == "integTest"}.configureEach { if (singleNode().testDistribution == DEFAULT) { setting 'xpack.license.self_generated.type', 'trial' setting 'indices.lifecycle.history_index_enabled', 'false' - if (BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.autoscaling_feature_flag_registered', 'true' - } - setting 'xpack.autoscaling.enabled', 'true' systemProperty 'es.rollup_v2_feature_flag_enabled', 'true' keystorePassword 's3cr3t' } diff --git a/docs/reference/autoscaling/apis/autoscaling-apis.asciidoc b/docs/reference/autoscaling/apis/autoscaling-apis.asciidoc index f153d93decfa7..2dd765e746682 100644 --- a/docs/reference/autoscaling/apis/autoscaling-apis.asciidoc +++ b/docs/reference/autoscaling/apis/autoscaling-apis.asciidoc @@ -3,6 +3,8 @@ [[autoscaling-apis]] == Autoscaling APIs +experimental[] + You can use the following APIs to perform autoscaling operations. [discrete] diff --git a/docs/reference/autoscaling/apis/delete-autoscaling-policy.asciidoc b/docs/reference/autoscaling/apis/delete-autoscaling-policy.asciidoc index 5f06c85587c78..1bcf2a0d935a8 100644 --- a/docs/reference/autoscaling/apis/delete-autoscaling-policy.asciidoc +++ b/docs/reference/autoscaling/apis/delete-autoscaling-policy.asciidoc @@ -6,6 +6,8 @@ Delete autoscaling policy ++++ +experimental[] + Delete autoscaling policy. [[autoscaling-delete-autoscaling-policy-request]] diff --git a/docs/reference/autoscaling/apis/get-autoscaling-capacity.asciidoc b/docs/reference/autoscaling/apis/get-autoscaling-capacity.asciidoc index 24331bbe8b83e..ae359fd81d220 100644 --- a/docs/reference/autoscaling/apis/get-autoscaling-capacity.asciidoc +++ b/docs/reference/autoscaling/apis/get-autoscaling-capacity.asciidoc @@ -6,6 +6,8 @@ Get autoscaling capacity ++++ +experimental[] + Get autoscaling capacity. [[autoscaling-get-autoscaling-capacity-request]] diff --git a/docs/reference/autoscaling/apis/get-autoscaling-policy.asciidoc b/docs/reference/autoscaling/apis/get-autoscaling-policy.asciidoc index d78528ad37860..6ca04f3ab6f3b 100644 --- a/docs/reference/autoscaling/apis/get-autoscaling-policy.asciidoc +++ b/docs/reference/autoscaling/apis/get-autoscaling-policy.asciidoc @@ -6,6 +6,8 @@ Get autoscaling policy ++++ +experimental[] + Get autoscaling policy. [[autoscaling-get-autoscaling-policy-request]] diff --git a/docs/reference/autoscaling/apis/put-autoscaling-policy.asciidoc b/docs/reference/autoscaling/apis/put-autoscaling-policy.asciidoc index 30418489570e6..9131983715e6c 100644 --- a/docs/reference/autoscaling/apis/put-autoscaling-policy.asciidoc +++ b/docs/reference/autoscaling/apis/put-autoscaling-policy.asciidoc @@ -6,6 +6,8 @@ Put autoscaling policy ++++ +experimental[] + Put autoscaling policy. [[autoscaling-put-autoscaling-policy-request]] diff --git a/docs/reference/index.asciidoc b/docs/reference/index.asciidoc index 1e39636c3192b..1c1c19cedc57c 100644 --- a/docs/reference/index.asciidoc +++ b/docs/reference/index.asciidoc @@ -48,12 +48,8 @@ include::data-management.asciidoc[] include::ilm/index.asciidoc[] -ifdef::permanently-unreleased-branch[] - include::autoscaling/index.asciidoc[] -endif::[] - include::monitoring/index.asciidoc[] include::frozen-indices.asciidoc[] diff --git a/docs/reference/rest-api/index.asciidoc b/docs/reference/rest-api/index.asciidoc index 0b2e839888d76..24771051bd741 100644 --- a/docs/reference/rest-api/index.asciidoc +++ b/docs/reference/rest-api/index.asciidoc @@ -11,9 +11,7 @@ We are working on including more {es} APIs in this section. Some content might not be included yet. * <> -ifdef::permanently-unreleased-branch[] * <> -endif::[] * <> * <> * <> @@ -43,9 +41,7 @@ endif::[] -- include::{es-repo-dir}/api-conventions.asciidoc[] -ifdef::permanently-unreleased-branch[] include::{es-repo-dir}/autoscaling/apis/autoscaling-apis.asciidoc[] -endif::[] include::{es-repo-dir}/cat.asciidoc[] include::{es-repo-dir}/cluster.asciidoc[] include::{es-repo-dir}/ccr/apis/ccr-apis.asciidoc[] diff --git a/x-pack/plugin/autoscaling/build.gradle b/x-pack/plugin/autoscaling/build.gradle index 12b91ded97eba..b8cadf5b2c9ab 100644 --- a/x-pack/plugin/autoscaling/build.gradle +++ b/x-pack/plugin/autoscaling/build.gradle @@ -12,15 +12,9 @@ esplugin { } archivesBaseName = 'x-pack-autoscaling' -tasks.named('internalClusterTest').configure { - if (BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.autoscaling_feature_flag_registered', 'true' - } -} - dependencies { compileOnly project(path: xpackModule('core'), configuration: 'default') testImplementation project(path: xpackModule('core'), configuration: 'testArtifacts') } -addQaCheckDependencies() \ No newline at end of file +addQaCheckDependencies() diff --git a/x-pack/plugin/autoscaling/qa/rest/build.gradle b/x-pack/plugin/autoscaling/qa/rest/build.gradle index bdfa4886ab961..ccd276b45a7e7 100644 --- a/x-pack/plugin/autoscaling/qa/rest/build.gradle +++ b/x-pack/plugin/autoscaling/qa/rest/build.gradle @@ -15,10 +15,6 @@ restResources { testClusters.all { testDistribution = 'DEFAULT' - if (BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.autoscaling_feature_flag_registered', 'true' - } - setting 'xpack.autoscaling.enabled', 'true' setting 'xpack.security.enabled', 'true' extraConfigFile 'roles.yml', file('autoscaling-roles.yml') user username: 'autoscaling-admin', password: 'autoscaling-admin-password', role: 'superuser' diff --git a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java index 359f806900329..11b3ad3b2c965 100644 --- a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java +++ b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java @@ -19,12 +19,4 @@ public abstract class AutoscalingIntegTestCase extends ESIntegTestCase { protected Collection> nodePlugins() { return List.of(LocalStateAutoscaling.class); } - - @Override - protected Settings nodeSettings(final int nodeOrdinal) { - final Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal)); - builder.put(Autoscaling.AUTOSCALING_ENABLED_SETTING.getKey(), true); - return builder.build(); - } - } diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java index 6ea305fe18c2a..d0cb9fcbc70e9 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java @@ -65,59 +65,19 @@ */ public class Autoscaling extends Plugin implements ActionPlugin, ExtensiblePlugin, AutoscalingExtension { - private static final Boolean AUTOSCALING_FEATURE_FLAG_REGISTERED; - static { final String property = System.getProperty("es.autoscaling_feature_flag_registered"); - if (Build.CURRENT.isSnapshot() && property != null) { - throw new IllegalArgumentException("es.autoscaling_feature_flag_registered is only supported in non-snapshot builds"); - } - if ("true".equals(property)) { - AUTOSCALING_FEATURE_FLAG_REGISTERED = true; - } else if ("false".equals(property)) { - AUTOSCALING_FEATURE_FLAG_REGISTERED = false; - } else if (property == null) { - AUTOSCALING_FEATURE_FLAG_REGISTERED = null; - } else { - throw new IllegalArgumentException( - "expected es.autoscaling_feature_flag_registered to be unset or [true|false] but was [" + property + "]" - ); + if (property != null) { + throw new IllegalArgumentException("es.autoscaling_feature_flag_registered is no longer supported"); } } - public static final Setting AUTOSCALING_ENABLED_SETTING = Setting.boolSetting( - "xpack.autoscaling.enabled", - true, - Setting.Property.NodeScope - ); - - private final boolean enabled; - private final List autoscalingExtensions; - public Autoscaling(final Settings settings) { - this.enabled = AUTOSCALING_ENABLED_SETTING.get(settings); + public Autoscaling() { this.autoscalingExtensions = new ArrayList<>(List.of(this)); } - /** - * The settings defined by autoscaling. - * - * @return the settings - */ - @Override - public List> getSettings() { - if (isSnapshot() || (AUTOSCALING_FEATURE_FLAG_REGISTERED != null && AUTOSCALING_FEATURE_FLAG_REGISTERED)) { - return List.of(AUTOSCALING_ENABLED_SETTING); - } else { - return List.of(); - } - } - - boolean isSnapshot() { - return Build.CURRENT.isSnapshot(); - } - @Override public Collection createComponents( Client client, @@ -137,16 +97,12 @@ public Collection createComponents( @Override public List> getActions() { - if (enabled) { - return List.of( - new ActionHandler<>(GetAutoscalingCapacityAction.INSTANCE, TransportGetAutoscalingCapacityAction.class), - new ActionHandler<>(DeleteAutoscalingPolicyAction.INSTANCE, TransportDeleteAutoscalingPolicyAction.class), - new ActionHandler<>(GetAutoscalingPolicyAction.INSTANCE, TransportGetAutoscalingPolicyAction.class), - new ActionHandler<>(PutAutoscalingPolicyAction.INSTANCE, TransportPutAutoscalingPolicyAction.class) - ); - } else { - return List.of(); - } + return List.of( + new ActionHandler<>(GetAutoscalingCapacityAction.INSTANCE, TransportGetAutoscalingCapacityAction.class), + new ActionHandler<>(DeleteAutoscalingPolicyAction.INSTANCE, TransportDeleteAutoscalingPolicyAction.class), + new ActionHandler<>(GetAutoscalingPolicyAction.INSTANCE, TransportGetAutoscalingPolicyAction.class), + new ActionHandler<>(PutAutoscalingPolicyAction.INSTANCE, TransportPutAutoscalingPolicyAction.class) + ); } @Override @@ -159,16 +115,12 @@ public List getRestHandlers( final IndexNameExpressionResolver indexNameExpressionResolver, final Supplier nodesInCluster ) { - if (enabled) { - return List.of( - new RestGetAutoscalingCapacityHandler(), - new RestDeleteAutoscalingPolicyHandler(), - new RestGetAutoscalingPolicyHandler(), - new RestPutAutoscalingPolicyHandler() - ); - } else { - return List.of(); - } + return List.of( + new RestGetAutoscalingCapacityHandler(), + new RestDeleteAutoscalingPolicyHandler(), + new RestGetAutoscalingPolicyHandler(), + new RestPutAutoscalingPolicyHandler() + ); } @Override diff --git a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTestCase.java b/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTestCase.java index 51f23efa6812c..5b3d83e57536e 100644 --- a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTestCase.java +++ b/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTestCase.java @@ -190,10 +190,10 @@ public static SortedSet randomRoles() { } public static NamedWriteableRegistry getAutoscalingNamedWriteableRegistry() { - return new NamedWriteableRegistry(new Autoscaling(Settings.EMPTY).getNamedWriteables()); + return new NamedWriteableRegistry(new Autoscaling().getNamedWriteables()); } public static NamedXContentRegistry getAutoscalingXContentRegistry() { - return new NamedXContentRegistry(new Autoscaling(Settings.EMPTY).getNamedXContent()); + return new NamedXContentRegistry(new Autoscaling().getNamedXContent()); } } diff --git a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTests.java b/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTests.java deleted file mode 100644 index 09aeb6a7e1850..0000000000000 --- a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -package org.elasticsearch.xpack.autoscaling; - -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.test.ESTestCase; - -import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.not; - -public class AutoscalingTests extends ESTestCase { - - public void testEnabledSettingRegisteredInSnapshotBuilds() { - final Autoscaling plugin = new Autoscaling(Settings.EMPTY) { - - @Override - protected boolean isSnapshot() { - return true; - } - - }; - assertThat(plugin.getSettings(), hasItem(Autoscaling.AUTOSCALING_ENABLED_SETTING)); - } - - public void testEnabledSettingNotRegisteredInNonSnapshotBuilds() { - final Autoscaling plugin = new Autoscaling(Settings.EMPTY) { - - @Override - protected boolean isSnapshot() { - return false; - } - - }; - assertThat(plugin.getSettings(), not(hasItem(Autoscaling.AUTOSCALING_ENABLED_SETTING))); - } - -} diff --git a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/LocalStateAutoscaling.java b/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/LocalStateAutoscaling.java index dbd23669aa9c8..6d2efb50a9f16 100644 --- a/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/LocalStateAutoscaling.java +++ b/x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/LocalStateAutoscaling.java @@ -14,7 +14,7 @@ public class LocalStateAutoscaling extends LocalStateCompositeXPackPlugin { public LocalStateAutoscaling(final Settings settings) { super(settings, null); - plugins.add(new Autoscaling(settings) { + plugins.add(new Autoscaling() { @Override protected XPackLicenseState getLicenseState() { diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle index f8c92b852799f..2956e97abb107 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle @@ -38,9 +38,6 @@ testClusters.all { numberOfNodes = 3 testDistribution = 'DEFAULT' - if (BuildParams.isSnapshotBuild() == false) { - systemProperty 'es.autoscaling_feature_flag_registered', 'true' - } setting 'xpack.security.enabled', 'true' setting 'xpack.monitoring.elasticsearch.collection.enabled', 'false' setting 'xpack.ml.enabled', 'true' From 8ebdf4362ba361747770c5dda18914bd6f02e815 Mon Sep 17 00:00:00 2001 From: Henning Andersen Date: Mon, 7 Dec 2020 19:50:29 +0100 Subject: [PATCH 2/3] cs --- .../xpack/autoscaling/AutoscalingIntegTestCase.java | 1 - .../java/org/elasticsearch/xpack/autoscaling/Autoscaling.java | 2 -- 2 files changed, 3 deletions(-) diff --git a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java index 11b3ad3b2c965..84dbb0f3b6937 100644 --- a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java +++ b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/AutoscalingIntegTestCase.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.autoscaling; -import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; diff --git a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java index d0cb9fcbc70e9..c99badc7876dc 100644 --- a/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java +++ b/x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.autoscaling; -import org.elasticsearch.Build; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.client.Client; @@ -19,7 +18,6 @@ import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.IndexScopedSettings; -import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.common.xcontent.NamedXContentRegistry; From bc61d3842c2daefe853e000924fc5c4b4faa642e Mon Sep 17 00:00:00 2001 From: Henning Andersen Date: Mon, 14 Dec 2020 17:30:31 +0100 Subject: [PATCH 3/3] Fix build. --- .../xpack/autoscaling/storage/ReactiveStorageIT.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageIT.java b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageIT.java index af27aa2b2f68b..a441bb50d4c96 100644 --- a/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageIT.java +++ b/x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageIT.java @@ -20,7 +20,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.xpack.autoscaling.Autoscaling; import org.elasticsearch.xpack.autoscaling.LocalStateAutoscaling; import org.elasticsearch.xpack.autoscaling.action.GetAutoscalingCapacityAction; import org.elasticsearch.xpack.autoscaling.action.PutAutoscalingPolicyAction; @@ -55,8 +54,7 @@ protected Collection> nodePlugins() { @Override protected Settings nodeSettings(final int nodeOrdinal) { final Settings.Builder builder = Settings.builder().put(super.nodeSettings(nodeOrdinal)); - builder.put(Autoscaling.AUTOSCALING_ENABLED_SETTING.getKey(), true) - .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), (WATERMARK_BYTES * 2) + "b") + builder.put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK_SETTING.getKey(), (WATERMARK_BYTES * 2) + "b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK_SETTING.getKey(), WATERMARK_BYTES + "b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_FLOOD_STAGE_WATERMARK_SETTING.getKey(), "0b") .put(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL_SETTING.getKey(), "0ms")