-
-
Notifications
You must be signed in to change notification settings - Fork 58
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 support for Proxysql cluster #58
Conversation
a6758a7
to
afab852
Compare
remove hardcode of mysql-client package (changed to variable in voxpupuli#58)
@MaxFedotov can you take a look at the used email address in your commits? It is not associated with your github account. |
9dba456
to
27edd45
Compare
I've updated email and made a few more linting fixes + changed style for facts |
The code looks good to me, thanks for the updates! @mcrauwel can you please review this as well? |
@bastelfreak I have the further testing on my schedule for this week... I will try to finish all pending reviews |
Maybe this would also be a good time to add acceptance tests? Something basic like https://github.com/voxpupuli/puppet-collectd/blob/master/spec/acceptance/class_spec.rb would already help a lot. |
remove hardcode of mysql-client package (changed to variable in voxpupuli#58)
@MaxFedotov can you rebase on the current master? |
remove hardcode of mysql-client package (changed to variable in voxpupuli#58)
1b7ffa3
to
31de90e
Compare
@MaxFedotov - Could you possibly share your work on the I'd be keen to see how you realize the Many thanks for all of your work on this. |
@tullis class db::proxysql (
Db::Common::Cluster_name $cluster_name = undef,
Optional[String] $version = '1.4.10-1',
Optional[Proxysql::Server] $mysql_servers = undef,
Optional[Proxysql::User] $mysql_users = undef,
Optional[Proxysql::Hostgroup] $mysql_hostgroups = undef,
Optional[Proxysql::Rule] $mysql_rules = undef,
Optional[Proxysql::Scheduler] $schedulers = undef,
Optional[Hash] $override_config_settings = undef,
){
#some custom code necessary for our environment like creating users and passwords in vault, adding repos and installing additional packages
class { 'proxysql':
listen_ip => '127.0.0.1',
mysql_client_package_name => 'Percona-Server-client-56',
listen_port => 3306,
admin_listen_ip => '0.0.0.0',
monitor_username => 'proxysql_monitor',
manage_proxy_config_file => false,
split_config => true,
package_ensure => $version,
package_provider => 'yum',
admin_password => $admin_password,
monitor_password => $monitor_password,
cluster_password => $cluster_password,
cluster_name => $cluster_name,
manage_hostgroup_for_servers => false,
mysql_servers => $mysql_servers,
mysql_users => $mysql_users,
mysql_hostgroups => $mysql_hostgroups,
mysql_rules => $mysql_rules,
schedulers => $schedulers,
sys_owner => 'proxysql',
sys_group => 'proxysql',
override_config_settings => $config,
}
resources { 'proxy_cluster':
purge => true,
}
$query = "resources[parameters] {type = 'Class' and title = 'Proxysql' and parameters.cluster_name = '${cluster_name}'}"
$nodes = puppetdb_query($query).map | $hash | { $hash['parameters']['node_name'] }
$cluster_nodes = length($nodes) ? {
0 => [$proxysql::node_name],
default => $nodes,
}
$cluster_nodes.each |String $node| {
proxy_cluster { $node:
hostname => "${split($node, ':')[0]}",
port => split($node, ':')[1],
require => Class['proxysql']
}
} |
Thanks @MaxFedotov, that's really useful. |
Add ability to automatically create ProxySQL cluster.
$cluster_name
determines the name of the cluster, ProxySQL instance will belong to. It will lookup host in PuppetDB and create proxysql_cluster resources with params,it will get from it. Also added$cluster_username
and$cluster_password
variables