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

Having haproxy/members attribute hashed based on backend names #58

Closed
nitinmohan87 opened this issue Feb 11, 2014 · 2 comments
Closed

Comments

@nitinmohan87
Copy link
Contributor

As of now the haproxy/members attribute adds the following 2 entries by default to the servers-http backend.
https://github.com/hw-cookbooks/haproxy/blob/master/attributes/default.rb#L26-L36
https://github.com/hw-cookbooks/haproxy/blob/master/recipes/default.rb#L57-L64

This haproxy/members can be made more helpful if we can hash the members based on backend names

node.set['haproxy']['members']['servers-http'] = [{
...
}]

This would make this attribute more helpful when we want to create additional backend sections with their own list of servers attached.

node.set['haproxy']['members']['new_backend'] = [{
...
}]

It would also be helpful to have a helper method that does this - https://github.com/hw-cookbooks/haproxy/blob/master/recipes/default.rb#L57-L59
We can probably have a options hash to set these values to the server entry - weight #{member['weight'] || member_weight} maxconn #{member['max_connections'] || member_max_conn} check"

options = {
  weight: member['weight'] || member_weight
  maxconn: member['max_connections'] || member_max_conn
  check: true
}

Wasn't this the purpose of having a haproxy/members attribute? Or I am going in the wrong direction?

@nitinmohan87
Copy link
Contributor Author

My bad.. Thats why we have the listeners for the exact same reason - https://github.com/hw-cookbooks/haproxy/blob/master/providers/lb.rb#L18. I guess I answered my own question.

But still I feel like a helper method like I mentioned above would be super helpful to get the servers line for the backend.

@lock
Copy link

lock bot commented Jun 14, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants