Skip to content

Commit

Permalink
Autoscaling remove feature flags (#65973) (#66282)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
henningandersen committed Dec 14, 2020
1 parent 9cf8949 commit 3dddf72
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 142 deletions.
4 changes: 0 additions & 4 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ testClusters.integTest {
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'
}
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/autoscaling/apis/autoscaling-apis.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
[[autoscaling-apis]]
== Autoscaling APIs

experimental[]

You can use the following APIs to perform autoscaling operations.

[discrete]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<titleabbrev>Delete autoscaling policy</titleabbrev>
++++

experimental[]

Delete autoscaling policy.

[[autoscaling-delete-autoscaling-policy-request]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<titleabbrev>Get autoscaling capacity</titleabbrev>
++++

experimental[]

Get autoscaling capacity.

[[autoscaling-get-autoscaling-capacity-request]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<titleabbrev>Get autoscaling policy</titleabbrev>
++++

experimental[]

Get autoscaling policy.

[[autoscaling-get-autoscaling-policy-request]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<titleabbrev>Put autoscaling policy</titleabbrev>
++++

experimental[]

Put autoscaling policy.

[[autoscaling-put-autoscaling-policy-request]]
Expand Down
4 changes: 0 additions & 4 deletions docs/reference/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down
4 changes: 0 additions & 4 deletions docs/reference/rest-api/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
Expand Down Expand Up @@ -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[]
Expand Down
8 changes: 1 addition & 7 deletions x-pack/plugin/autoscaling/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 0 additions & 4 deletions x-pack/plugin/autoscaling/qa/rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ protected Collection<Class<? extends Plugin>> 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);
builder.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
return builder.build();
}
Expand All @@ -37,7 +36,6 @@ protected Collection<Class<? extends Plugin>> transportClientPlugins() {
@Override
protected Settings transportClientSettings() {
final Settings.Builder builder = Settings.builder().put(super.transportClientSettings());
builder.put(Autoscaling.AUTOSCALING_ENABLED_SETTING.getKey(), true);
builder.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,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;
Expand Down Expand Up @@ -55,8 +54,7 @@ protected Collection<Class<? extends Plugin>> 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")
Expand All @@ -72,7 +70,6 @@ protected Collection<Class<? extends Plugin>> transportClientPlugins() {
@Override
protected Settings transportClientSettings() {
final Settings.Builder builder = Settings.builder().put(super.transportClientSettings());
builder.put(Autoscaling.AUTOSCALING_ENABLED_SETTING.getKey(), true);
builder.put(XPackSettings.SECURITY_ENABLED.getKey(), false);
return builder.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +20,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;
Expand Down Expand Up @@ -68,61 +66,21 @@
*/
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<>(org.elasticsearch.common.collect.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 org.elasticsearch.common.collect.List.of(AUTOSCALING_ENABLED_SETTING);
} else {
return org.elasticsearch.common.collect.List.of();
}
}

boolean isSnapshot() {
return Build.CURRENT.isSnapshot();
}

@Override
public Collection<Object> createComponents(
Client client,
Expand All @@ -143,16 +101,12 @@ public Collection<Object> createComponents(

@Override
public List<ActionHandler<? extends ActionRequest, ? extends ActionResponse>> getActions() {
if (enabled) {
return org.elasticsearch.common.collect.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 org.elasticsearch.common.collect.List.of();
}
return org.elasticsearch.common.collect.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
Expand All @@ -165,16 +119,12 @@ public List<RestHandler> getRestHandlers(
final IndexNameExpressionResolver indexNameExpressionResolver,
final Supplier<DiscoveryNodes> nodesInCluster
) {
if (enabled) {
return org.elasticsearch.common.collect.List.of(
new RestGetAutoscalingCapacityHandler(),
new RestDeleteAutoscalingPolicyHandler(),
new RestGetAutoscalingPolicyHandler(),
new RestPutAutoscalingPolicyHandler()
);
} else {
return org.elasticsearch.common.collect.List.of();
}
return org.elasticsearch.common.collect.List.of(
new RestGetAutoscalingCapacityHandler(),
new RestDeleteAutoscalingPolicyHandler(),
new RestGetAutoscalingPolicyHandler(),
new RestPutAutoscalingPolicyHandler()
);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ public static SortedSet<String> 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());
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 0 additions & 3 deletions x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected XPackLicenseState getLicenseState() {
}
};
plugin.setCircuitBreaker(new NoopCircuitBreaker(TRAINED_MODEL_CIRCUIT_BREAKER_NAME));
plugins.add(new Autoscaling(settings) {
plugins.add(new Autoscaling() {
@Override
protected XPackLicenseState getLicenseState() {
return thisVar.getLicenseState();
Expand Down

0 comments on commit 3dddf72

Please sign in to comment.