-
-
Notifications
You must be signed in to change notification settings - Fork 476
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
Remove multi instance support #1085
Conversation
For some reason, using the shared `:with_cleanup` hook doesn't always stop the service cleanly, causing subsequent tests to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! I added a few comments here and there, overall it looks right though. I understand that my comment about jvm.options may just be premature since this is still a WIP, but I wanted to ensure I mentioned it since removing those module-defined files in favor of what the package ships is one motivating factor for taking out instances (jvm.options is one, the init/systemd scripts are another, etc.).
There are some other parts of the module that are very old and crufty that probably don't need the baggage with a modern release (like any sort of support for Shield), but whether that's easier to cut out as part of this or as a separate PR is totally whichever is easiest from your perspective.
manifests/init.pp
Outdated
@@ -85,6 +92,13 @@ | |||
# @param defaults_location | |||
# Absolute path to directory containing init defaults file. | |||
# | |||
# @param deprecation_logging | |||
# Wheter to enable deprecation logging. If enabled, deprecation logs will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Wheter to enable deprecation logging. If enabled, deprecation logs will be | |
# Whether to enable deprecation logging. If enabled, deprecation logs will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a massive effort and I'm so pleased it's in such good hands. As you can see, my comments are largely about trivial things.
My only serious concern is that I can't currently run the acceptance tests, but that looks like it's probably just a result of bit rot and not caused by this patch.
$ bundle exec rake beaker
[...]
Failure/Error: run_puppet_install_helper('agent') unless ENV['BEAKER_provision'] == 'no'
Beaker::Host::CommandFailure:
Host 'ubuntu-16-04' exited with 8 running:
wget -O /tmp/puppet.deb http://apt.puppet.com/pc1-release-xenial.deb
Last 10 lines of output were:
--2020-04-22 06:09:22-- http://apt.puppet.com/pc1-release-xenial.deb
Resolving apt.puppet.com (apt.puppet.com)... 99.86.212.17, 99.86.212.23, 99.86.212.32, ...
Connecting to apt.puppet.com (apt.puppet.com)|99.86.212.17|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-04-22 06:09:22 ERROR 404: Not Found.
$elasticsearch::homedir: | ||
ensure => 'directory', | ||
group => $elasticsearch::elasticsearch_group, | ||
owner => $elasticsearch::elasticsearch_user; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not today, but I'd love to see this multi-resource declaration become an iterator one day.
Alternatively, a default:
section could DRY this up a lot.
https://puppet.com/docs/puppet/latest/style_guide.html#multiple-resources
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed
manifests/config.pp
Outdated
} | ||
} | ||
} else { # absent | ||
file { "${elasticsearch::defaults_location}/elasticsearch": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bunch of variable references that have explicit paths from the top-level scope with $::
, but some don't.
It's been a while, but I had a feeling that modern Puppet versions don't need leading colons. Is that right? Either way, it's probably worth being consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question... I'll find out what the current best practise is :)
|
||
# Manage users/roles before instances (req'd to keep dir in sync) | ||
Elasticsearch::Role <| |> | ||
-> Elasticsearch::Instance <| |> | ||
Elasticsearch::User <| |> | ||
-> Elasticsearch::Instance <| |> | ||
|
||
# Ensure instances are started before managing REST resources | ||
Elasticsearch::Instance <| ensure == 'present' |> | ||
-> Elasticsearch::Template <| |> | ||
Elasticsearch::Instance <| ensure == 'present' |> | ||
-> Elasticsearch::Pipeline <| |> | ||
Elasticsearch::Instance <| ensure == 'present' |> | ||
-> Elasticsearch::Index <| |> | ||
Elasticsearch::Instance <| ensure == 'present' |> | ||
-> Elasticsearch::Snapshot_repository <| |> | ||
# Ensure instances are stopped after managing REST resources | ||
Elasticsearch::Template <| |> | ||
-> Elasticsearch::Instance <| ensure == 'absent' |> | ||
Elasticsearch::Pipeline <| |> | ||
-> Elasticsearch::Instance <| ensure == 'absent' |> | ||
Elasticsearch::Index <| |> | ||
-> Elasticsearch::Instance <| ensure == 'absent' |> | ||
Elasticsearch::Snapshot_repository <| |> | ||
-> Elasticsearch::Instance <| ensure == 'absent' |> | ||
|
||
# Ensure scripts are installed before copying them to configuration directory | ||
Elasticsearch::Script <| |> | ||
-> File["${configdir}/scripts"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3
spec/classes/001_hiera_spec.rb
Outdated
%w[elasticsearch.yml jvm.options log4j2.properties].each do |file| | ||
it { should contain_file("/etc/elasticsearch/#{file}") } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
Remove the `elasticsearch_service_file` type/provider and associated tests.
eca2cf3
to
05f557f
Compare
This removes the templated 'jvm.options' file, instead we append to the shipped 'jvm.options' file by using the `file_line` resource. Removed associated tests and template file. Add additional tests to cover specifying 'jvm_options'.
05f557f
to
bec95ae
Compare
a5487bb
to
6dca520
Compare
6dca520
to
d2d83e5
Compare
Also update unit tests to reflect changes.
This can be used to override the default sleep interval, for example on a slower system. Also updated default value from `2` seconds to `10` seconds. Finally, added a unit test for the type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to keep you waiting. Please ship this magnificent monster!
I'm trying out your branch on CentOS 7 and get an error when running puppet apply:
If I manually run In the unit file |
@marvi Thank you for taking the time to test this PR and report your findings However I'll run some more in-depth tests using Vagrant images once I've merged this PR. |
I solved it for CentOS 7 by setting |
As indicated in #1068, as precursor to adding support for Elasticsearch
7.x
is removing the multi-instance support from this module.Unfortunately there was no clean way of splitting the changes into smaller PR's, and the history could probably do with some cleanup...
TODO: