Browse Source

Autoscaling remove feature flags (#65973)

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
Henning Andersen 4 years ago
parent
commit
c91a4d8d2b

+ 0 - 4
docs/build.gradle

@@ -54,10 +54,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'
   }

+ 2 - 0
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]

+ 2 - 0
docs/reference/autoscaling/apis/delete-autoscaling-policy.asciidoc

@@ -6,6 +6,8 @@
 <titleabbrev>Delete autoscaling policy</titleabbrev>
 ++++
 
+experimental[]
+
 Delete autoscaling policy.
 
 [[autoscaling-delete-autoscaling-policy-request]]

+ 2 - 0
docs/reference/autoscaling/apis/get-autoscaling-capacity.asciidoc

@@ -6,6 +6,8 @@
 <titleabbrev>Get autoscaling capacity</titleabbrev>
 ++++
 
+experimental[]
+
 Get autoscaling capacity.
 
 [[autoscaling-get-autoscaling-capacity-request]]

+ 2 - 0
docs/reference/autoscaling/apis/get-autoscaling-policy.asciidoc

@@ -6,6 +6,8 @@
 <titleabbrev>Get autoscaling policy</titleabbrev>
 ++++
 
+experimental[]
+
 Get autoscaling policy.
 
 [[autoscaling-get-autoscaling-policy-request]]

+ 2 - 0
docs/reference/autoscaling/apis/put-autoscaling-policy.asciidoc

@@ -6,6 +6,8 @@
 <titleabbrev>Put autoscaling policy</titleabbrev>
 ++++
 
+experimental[]
+
 Put autoscaling policy.
 
 [[autoscaling-put-autoscaling-policy-request]]

+ 0 - 4
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[]

+ 0 - 4
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.
 
 * <<api-conventions, API conventions>>
-ifdef::permanently-unreleased-branch[]
 * <<autoscaling-apis, Autoscaling APIs>>
-endif::[]
 * <<cat, cat APIs>>
 * <<cluster, Cluster APIs>>
 * <<ccr-apis,{ccr-cap} APIs>>
@@ -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[]

+ 1 - 7
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()
+addQaCheckDependencies()

+ 0 - 4
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'

+ 0 - 9
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;
 
@@ -19,12 +18,4 @@ public abstract class AutoscalingIntegTestCase extends ESIntegTestCase {
     protected Collection<Class<? extends Plugin>> 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();
-    }
-
 }

+ 1 - 3
x-pack/plugin/autoscaling/src/internalClusterTest/java/org/elasticsearch/xpack/autoscaling/storage/ReactiveStorageIT.java

@@ -20,7 +20,6 @@ import org.elasticsearch.common.settings.ClusterSettings;
 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 @@ public class ReactiveStorageIT extends DiskUsageIntegTestCase {
     @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")

+ 15 - 65
x-pack/plugin/autoscaling/src/main/java/org/elasticsearch/xpack/autoscaling/Autoscaling.java

@@ -7,7 +7,6 @@
 package org.elasticsearch.xpack.autoscaling;
 
 import org.apache.lucene.util.SetOnce;
-import org.elasticsearch.Build;
 import org.elasticsearch.action.ActionRequest;
 import org.elasticsearch.action.ActionResponse;
 import org.elasticsearch.client.Client;
@@ -21,7 +20,6 @@ import org.elasticsearch.common.ParseField;
 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;
@@ -68,61 +66,21 @@ import java.util.stream.Collectors;
  */
 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<Boolean> AUTOSCALING_ENABLED_SETTING = Setting.boolSetting(
-        "xpack.autoscaling.enabled",
-        true,
-        Setting.Property.NodeScope
-    );
-
-    private final boolean enabled;
-
     private final List<AutoscalingExtension> autoscalingExtensions;
     private final SetOnce<ClusterService> clusterService = new SetOnce<>();
     private final SetOnce<AllocationDeciders> allocationDeciders = new SetOnce<>();
 
-    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<Setting<?>> 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<Object> createComponents(
         Client client,
@@ -143,16 +101,12 @@ public class Autoscaling extends Plugin implements ActionPlugin, ExtensiblePlugi
 
     @Override
     public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> 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
@@ -165,16 +119,12 @@ public class Autoscaling extends Plugin implements ActionPlugin, ExtensiblePlugi
         final IndexNameExpressionResolver indexNameExpressionResolver,
         final Supplier<DiscoveryNodes> 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

+ 2 - 2
x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTestCase.java

@@ -190,10 +190,10 @@ public abstract class AutoscalingTestCase extends ESTestCase {
     }
 
     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());
     }
 }

+ 0 - 41
x-pack/plugin/autoscaling/src/test/java/org/elasticsearch/xpack/autoscaling/AutoscalingTests.java

@@ -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)));
-    }
-
-}

+ 1 - 1
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() {

+ 0 - 3
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'