Skip to content
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

cloud-gce plugin should check discovery.type #13809

Closed
wants to merge 0 commits into from

Conversation

xuzha
Copy link
Contributor

@xuzha xuzha commented Sep 25, 2015

closes #13614
This commmit adds check discovery.type and other required parameters before
loading gce plugin.

This change make gce plugin behave like Azure:

if user doesn't set discovery type to gce, ES would not load gce modules.
if user does set discovery type to gce but without all parameters we need, es would fail to start.

@@ -56,7 +59,7 @@ public String description() {
@Override
public Collection<Module> nodeModules() {
List<Module> modules = new ArrayList<>();
if (settings.getAsBoolean("cloud.enabled", true)) {
if (settings.getAsBoolean("cloud.enabled", true) && GceModule.isDiscoveryReady(settings, logger)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really related to this change but we can remove now the check for cloud.enabled

@dadoonet
Copy link
Member

Thanks for doing this!
Left some comments. It looks very good to me.
Actually I should do the same test for discovery.type in azure and AWS now projects are split.

@rjernst
Copy link
Member

rjernst commented Sep 26, 2015

Is this really necessary? I don't like plugins checking a setting that is not theirs. The gce plugin registers itself as a discovery type. It is the discovery modules job to decide which discovery type to use.

@xuzha
Copy link
Contributor Author

xuzha commented Sep 26, 2015

Thanks @dadoonet and @rjernst. I don't have strong opinion.

But I think we could remove checking discovery.type here. If gce have all required paras, then we could go ahead and register. What do you think @dadoonet.

@dadoonet
Copy link
Member

Don't have a strong opinion as well.

Just thinking of what would be the consequences when we will remove the need for setting any cloud.gce property. Not a problem I guess.

Let's apply Ryan suggestion.

@dadoonet
Copy link
Member

Actually, I like the fact we don't bind unnecessary modules when discovery is not set to gce.

That's what we do today for azure: https://github.com/elastic/elasticsearch/blob/master/plugins/discovery-azure/src/main/java/org/elasticsearch/cloud/azure/AzureDiscoveryModule.java#L79-L83

I think it's cleaner.

If we don't do that, in Azure, we will automatically start AzureComputeServiceImpl which will complain that some settings are not set. But may be in that case AzureComputeServiceImpl should detect that discovery.type is not set to azure and just don't log any warning in that case.

@bleskes
Copy link
Contributor

bleskes commented Sep 26, 2015

@rjernst I agree with your sentiment. Do you see any way of allowing the plugin to bind extra services if the DiscoveryModule activated it ? there are things like network address resolution, adding unicast host providers etc.

@dadoonet long term it will be awesome if we can decouple things such that we won't need guice. The network part of the plugin can be registered all the time (people need to active it using gce in their setting) and maybe the unicast host provider can be create in GCEDiscovery on start (GCEDiscovery is now kinda empty)

@rjernst
Copy link
Member

rjernst commented Sep 26, 2015

@bleskes I'm not sure we need extra services? I have two thoughts:

  • Can the unicast hosts list be provided through subclassing zen discovery?
  • Does zen discovery cover to many "things"? Should we have separate pluggable apis for master election (election.type?), ping service (ping.type?), and host discovery? Could this split be done now or are there tight couplings right now blocking a split like that?

@bleskes
Copy link
Contributor

bleskes commented Sep 26, 2015

@rjernst re splitting discovery - yeah and I'm still thinking on what's the right split. these things are tied together. Breaking them up are not trivial at all. Note though that GCE only supplies configuration (i.e., list of hosts to ping), which makes it creating it from the discovery implementation an option (see note to david from earlier :))

@rjernst
Copy link
Member

rjernst commented Sep 28, 2015

I'm fine for now with moving the hosts list to a protected method that plugins override on their subclass of zen (I think that's what you are suggesting)?

@bleskes
Copy link
Contributor

bleskes commented Sep 28, 2015

I looked at the code and I think it will be a biggish change to move the unicast host providers from Guice into a method zen discovery. It will also imply that UnicastZenPing needs to move ZenDiscovery and ZenPingService need to be either moved away from Guice as well or have an extra method for late addition of ping types.

For the sake of moving forward, I suggest we proceed with the current approach where we check settings for now and try to work towards a better way of doing this in ZenDiscovery/DiscoveryModule.

On 28 Sep 2015, at 07:52, Ryan Ernst notifications@github.com wrote:

I'm fine for now with moving the hosts list to a protected method that plugins override on their subclass of zen (I think that's what you are suggesting)?


Reply to this email directly or view it on GitHub.

@xuzha
Copy link
Contributor Author

xuzha commented Sep 28, 2015

Thanks a lot guys.
Updated and addressed some concerns @dadoonet.

@xuzha xuzha force-pushed the gce_logging branch 2 times, most recently from 415ce48 to 74fdb60 Compare September 28, 2015 22:32
@dadoonet
Copy link
Member

It looks good to me

@dadoonet
Copy link
Member

@xuzha I think we need it as well in 2.x and 2.0 branches. See https://github.com/elastic/elasticsearch/blob/2.0/plugins/cloud-gce/src/main/java/org/elasticsearch/plugin/cloud/gce/CloudGcePlugin.java#L74

We hit a similar issue with ec2 today on 2.0 branch. Could you check it and cherry pick this commit if needed to 2.0, 2.x branches? And add 2.0.0 and 2.1.0 labels to this PR?

@dadoonet dadoonet removed the review label Sep 29, 2015
@xuzha
Copy link
Contributor Author

xuzha commented Sep 29, 2015

@dadoonet sure, I saw your message in hipchat, I think we should do it.

@dadoonet
Copy link
Member

thanks for confirming. I added labels to this PR then.

@xuzha
Copy link
Contributor Author

xuzha commented Sep 29, 2015

In 2.x and 2.0 now,

2.0 21092d9
2.x 9654e08

@xuzha xuzha deleted the gce_logging branch September 29, 2015 17:55
dadoonet added a commit to dadoonet/elasticsearch that referenced this pull request Sep 30, 2015
As done in elastic#13809 and in Azure, we should check that `discovery.type` is set to `ec2` before starting services.

Closes elastic#13581.
@xuzha xuzha added v2.2.0 and removed v2.2.0 labels Oct 1, 2015
dadoonet added a commit that referenced this pull request Oct 2, 2015
As done in #13809 and in Azure, we should check that `discovery.type` is set to `ec2` before starting services.

Closes #13581.

(cherry picked from commit 314f074)
(cherry picked from commit 466bac6)
dadoonet added a commit that referenced this pull request Oct 2, 2015
As done in #13809 and in Azure, we should check that `discovery.type` is set to `ec2` before starting services.

Closes #13581.

(cherry picked from commit 314f074)
dadoonet added a commit that referenced this pull request Oct 2, 2015
As done in #13809 and in Azure, we should check that `discovery.type` is set to `ec2` before starting services.

Closes #13581.

(cherry picked from commit 314f074)
(cherry picked from commit 466bac6)
@clintongormley clintongormley added :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs and removed :Plugin Cloud GCE labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement v2.1.0 v5.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[cloud-gce] warn message is displayed when not using gce discovery
5 participants