-
Notifications
You must be signed in to change notification settings - Fork 289
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
Add sensu_cluster_member type #947
Conversation
6454ddf
to
6578dd0
Compare
Vagrantfile
Outdated
config.vm.define "sensu-backend-peer", primary: true, autostart: true do |backend| | ||
backend.vm.box = "centos/7" | ||
backend.vm.hostname = 'sensu-backend-peer.example.com' | ||
backend.vm.network :private_network, ip: ENV['ALTERNATE_IP'] || '192.168.52.11' |
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.
these IP's conflict with other vagrant instances
Vagrantfile
Outdated
backend.vm.network :forwarded_port, guest: 2380, host: 2380, auto_correct: true | ||
backend.vm.network :forwarded_port, guest: 3000, host: 3000, auto_correct: true | ||
backend.vm.network :forwarded_port, guest: 8080, host: 8080, auto_correct: true | ||
backend.vm.network :forwarded_port, guest: 8081, host: 8081, auto_correct: true |
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.
These ports conflict. I know auto_correct is true, though that makes documentation hard since a random port will be grabbed.
@@ -0,0 +1,98 @@ | |||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'sensuctl')) |
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.
The README should have an example for how this works.
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 is an example in the type description that will get picked up with puppet-strings, do we also want additional examples in README? If yes, should we also document how to setup a cluster? It's currently not documented by Sensu but managed to figure it out based on their docker compose configs. This new type is tightly coupled to configs in backend.yml
as they won't work without both being implemented.
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.
Let's document how to setup a cluster since that's how people will run Sensu.
c45ae4f
to
9b990e8
Compare
@ghoneycutt Squashed and rebased. Updated README with instructions on how to setup a cluster and also how to add a member to an existing cluster. |
Vagrantfile
Outdated
@@ -46,6 +46,32 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |||
backend.vm.provision :shell, :inline => "facter --custom-dir=/vagrant/lib/facter sensu_version" | |||
end | |||
|
|||
config.vm.define "sensu-backend-peer", primary: true, autostart: true do |backend| |
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.
call this one sensu-backend-peer1
to be inline with sensu-backend-peer2
README.md
Outdated
|
||
Adding new members to a cluster requires two steps. First add the member using `sensu_cluster_member` type then second configure and start `sensu-backend` on the new node. | ||
|
||
First, add the member: |
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.
Does this mean it takes multiple puppet runs in a certain sequence? If so, could you elaborate?
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.
I think so, I'll try to come up with some better wording on order. It's a really specific order of operations to avoid errors. Basically add member on existing backend node with sensuctl then start new member with config that differs slightly from existing backend nodes.
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.
Updated README, hopefully a bit clearer. Let me know if needs improvements.
This strangely had an error with amazon linux 2018.3. Perhaps the service just took too long to start? |
e5aeb8e
to
d9e93f0
Compare
The docs assume that two backends are running, which I thought is not good since you need one or three for quorum. If you have only two does is put the cluster is a not-good state? Could you give me a step by step in the README of why you have to setup one node, then can add more. |
So the adding member bits are only necessary if your going from an existing cluster of say 2 nodes and want to add a third node later on. The easiest way I found to setup a cluster is to have all nodes from the very beginning, which doesn't require the |
Added a few bits of text to hopefully make it clear that adding members to an existing cluster differs from setting up a cluster from scratch. |
c3867b3
to
621f442
Compare
@treydock Could you please rebase. Is this ready to merge? |
Update README with backend cluster examples
621f442
to
7879b1c
Compare
@ghoneycutt rebased and squashed. |
I'd say ready for merge. Open issue upstream but not sure would impact this PR since issue I opened was going from one to two node cluster and sensuctl hanging. That's why acceptance tests go from two to three node cluster, seems keeps quorum. |
Pull Request Checklist
Description
Add a custom type that can add cluster members.
Related Issue
Part of #901
Motivation and Context
sensuctl supports adding members. The members won't actually be fully added until the new member is started with the proper configuration. The necessary configuration is printed by this custom type in the info output which comes from output of the
sensuctl
command to add the member.How Has This Been Tested?
Added new way to run acceptance tests that spawn 3 backend servers. Using only 2 caused issues (see sensu/sensu-go#1890). When
BEAKER_sensu_cluster
isyes
ortrue
the cluster acceptance tests are run.General
Update
README.md
with any necessary configuration snippetsTests pass -
bundle exec rake validate lint spec