|
@@ -29,24 +29,15 @@ import org.elasticsearch.cloud.gce.GceInstancesServiceImpl;
|
|
|
import org.elasticsearch.cloud.gce.GceMetadataService;
|
|
|
import org.elasticsearch.cloud.gce.network.GceNameResolver;
|
|
|
import org.elasticsearch.cloud.gce.util.Access;
|
|
|
-import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
|
|
-import org.elasticsearch.cluster.service.ClusterApplier;
|
|
|
-import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
|
|
import org.elasticsearch.common.logging.DeprecationLogger;
|
|
|
import org.elasticsearch.common.logging.Loggers;
|
|
|
import org.elasticsearch.common.network.NetworkService;
|
|
|
-import org.elasticsearch.common.settings.ClusterSettings;
|
|
|
import org.elasticsearch.common.settings.Setting;
|
|
|
import org.elasticsearch.common.settings.Settings;
|
|
|
-import org.elasticsearch.discovery.Discovery;
|
|
|
-import org.elasticsearch.discovery.DiscoveryModule;
|
|
|
-import org.elasticsearch.cluster.service.MasterService;
|
|
|
import org.elasticsearch.discovery.gce.GceUnicastHostsProvider;
|
|
|
import org.elasticsearch.discovery.zen.UnicastHostsProvider;
|
|
|
-import org.elasticsearch.discovery.zen.ZenDiscovery;
|
|
|
import org.elasticsearch.plugins.DiscoveryPlugin;
|
|
|
import org.elasticsearch.plugins.Plugin;
|
|
|
-import org.elasticsearch.threadpool.ThreadPool;
|
|
|
import org.elasticsearch.transport.TransportService;
|
|
|
|
|
|
import java.io.Closeable;
|
|
@@ -83,17 +74,7 @@ public class GceDiscoveryPlugin extends Plugin implements DiscoveryPlugin, Close
|
|
|
logger.trace("starting gce discovery plugin...");
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public Map<String, Supplier<Discovery>> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService,
|
|
|
- NamedWriteableRegistry namedWriteableRegistry,
|
|
|
- MasterService masterService, ClusterApplier clusterApplier,
|
|
|
- ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider,
|
|
|
- AllocationService allocationService) {
|
|
|
- // this is for backcompat with pre 5.1, where users would set discovery.type to use ec2 hosts provider
|
|
|
- return Collections.singletonMap(GCE, () ->
|
|
|
- new ZenDiscovery(settings, threadPool, transportService, namedWriteableRegistry, masterService, clusterApplier,
|
|
|
- clusterSettings, hostsProvider, allocationService));
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Supplier<UnicastHostsProvider>> getZenHostsProviders(TransportService transportService,
|
|
@@ -122,21 +103,7 @@ public class GceDiscoveryPlugin extends Plugin implements DiscoveryPlugin, Close
|
|
|
GceInstancesService.MAX_WAIT_SETTING);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public Settings additionalSettings() {
|
|
|
- // For 5.0, the hosts provider was "zen", but this was before the discovery.zen.hosts_provider
|
|
|
- // setting existed. This check looks for the legacy setting, and sets hosts provider if set
|
|
|
- String discoveryType = DiscoveryModule.DISCOVERY_TYPE_SETTING.get(settings);
|
|
|
- if (discoveryType.equals(GCE)) {
|
|
|
- deprecationLogger.deprecated("Using " + DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey() +
|
|
|
- " setting to set hosts provider is deprecated. " +
|
|
|
- "Set \"" + DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey() + ": " + GCE + "\" instead");
|
|
|
- if (DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.exists(settings) == false) {
|
|
|
- return Settings.builder().put(DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING.getKey(), GCE).build();
|
|
|
- }
|
|
|
- }
|
|
|
- return Settings.EMPTY;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public void close() throws IOException {
|