diff --git a/docs/build.gradle b/docs/build.gradle index 726ec34e648ca..670a4c33fcfed 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -45,8 +45,11 @@ 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' if (BuildParams.isSnapshotBuild()) { - setting 'xpack.autoscaling.enabled', 'true' setting 'xpack.eql.enabled', 'true' } } 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 cdfd099eb02c7..92d5ef0afcea5 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 @@ -32,6 +32,24 @@ */ public class Autoscaling extends Plugin implements ActionPlugin { + 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) || property == null) { + AUTOSCALING_FEATURE_FLAG_REGISTERED = false; + } else { + throw new IllegalArgumentException( + "expected es.autoscaling_feature_flag_registered to be unset or [true|false] but was [" + property + "]" + ); + } + } + public static final Setting AUTOSCALING_ENABLED_SETTING = Setting.boolSetting( "xpack.autoscaling.enabled", false, @@ -51,7 +69,7 @@ public Autoscaling(final Settings settings) { */ @Override public List> getSettings() { - if (isSnapshot()) { + if (isSnapshot() || AUTOSCALING_FEATURE_FLAG_REGISTERED) { return List.of(AUTOSCALING_ENABLED_SETTING); } else { return List.of();