Skip to content

Initial autoscaling commit #51161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ subprojects {
// switched to an exclude list, and eventualy removed completely.
def projectPathsToFormat = [
':build-tools',
':x-pack:plugin:autoscaling',
':x-pack:plugin:enrich'
]

Expand Down
19 changes: 19 additions & 0 deletions docs/reference/autoscaling/index.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[role="xpack"]
[testenv="platinum"]
[[xpack-autoscaling]]
[chapter]
= Autoscaling

experimental[]

The autoscaling feature enables an operator to configure tiers of nodes that
self-monitor whether or not they need to scale based on an operator-defined
policy. Then, via the autoscaling API, an Elasticsearch cluster can report
whether or not it needs additional resources to meet the policy. For example, an
operator could define a policy that a warm tier should scale on available disk
space. Elasticsearch would monitor and forecast the available disk space in the
warm tier, and if the forecast is such that the cluster will soon not be able to
allocate existing and future shard copies due to disk space, then the
autoscaling API would report that the cluster needs to scale due to disk space.
It remains the responsibility of the operator to add the additional resources
that the cluster signals it requires.
2 changes: 2 additions & 0 deletions docs/reference/index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ include::ingest.asciidoc[]

include::ilm/index.asciidoc[]

include::autoscaling/index.asciidoc[]

include::sql/index.asciidoc[]

include::monitoring/index.asciidoc[]
Expand Down
20 changes: 20 additions & 0 deletions x-pack/plugin/autoscaling/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
evaluationDependsOn(xpackModule('core'))

apply plugin: 'elasticsearch.esplugin'

esplugin {
name 'x-pack-autoscaling'
description 'Elasticsearch Expanded Pack Plugin - Autoscaling'
classname 'org.elasticsearch.xpack.autoscaling.Autoscaling'
extendedPlugins = ['x-pack-core']
hasNativeController false
requiresKeystore true
}
archivesBaseName = 'x-pack-autoscaling'

integTest.enabled = false

dependencies {
compileOnly project(path: xpackModule('core'), configuration: 'default')
testCompile project(path: xpackModule('core'), configuration: 'testArtifacts')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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.Build;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.plugins.Plugin;

import java.util.List;

/**
* Container class for autoscaling functionality.
*/
public class Autoscaling extends Plugin {

public static final Setting<Boolean> AUTOSCALING_ENABLED_SETTING = Setting.boolSetting(
"xpack.autoscaling.enabled",
false,
Setting.Property.NodeScope
);

/**
* The settings defined by autoscaling.
*
* @return the settings
*/
@Override
public List<Setting<?>> getSettings() {
if (isSnapshot()) {
return List.of(AUTOSCALING_ENABLED_SETTING);
} else {
return List.of();
}
}

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.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() {

@Override
protected boolean isSnapshot() {
return true;
}

};
assertThat(plugin.getSettings(), hasItem(Autoscaling.AUTOSCALING_ENABLED_SETTING));
}

public void testEnabledSettingNotRegisteredInNonSnapshotBuilds() {
final Autoscaling plugin = new Autoscaling() {

@Override
protected boolean isSnapshot() {
return false;
}

};
assertThat(plugin.getSettings(), not(hasItem(Autoscaling.AUTOSCALING_ENABLED_SETTING)));
}

}