Rush has uploaded a new change for review. https://gerrit.wikimedia.org/r/219481
Change subject: WIP: Setup a node pool from etcd for lvs cluster ...................................................................... WIP: Setup a node pool from etcd for lvs cluster With a conftool cluster and service definition included in the lvs::configuration cluster hash we setup a confd toml and template to allow external definition of nodes in the pool. The config line change is commented out as this will rollout slowly. Example of confd files created for 'text': /etc/confd/ ├── conf.d │ └── _etc_pybal_pools_text.toml └── templates └── _etc_pybal_pools_text.tmpl Example toml file: [template] src = "_etc_pybal_pools_text.tmpl" dest = "/etc/pybal/pools/text" mode = "0444" keys = [ "/conftool/v1/pools/eqiad/cache_text/varnish-fe/", ] check_cmd = "/usr/local/bin/pybal-eval-check {{.src}}" Change-Id: I6c0179738bc3dab0170a5ccba20f53cd42a06b79 --- M modules/confd/manifests/file.pp M modules/lvs/manifests/balancer.pp M modules/pybal/manifests/confd.pp M modules/pybal/manifests/configuration.pp A modules/pybal/manifests/pool.pp M modules/pybal/templates/pybal.conf.erb 6 files changed, 40 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/81/219481/1 diff --git a/modules/confd/manifests/file.pp b/modules/confd/manifests/file.pp index 4a4331d..74cfbde 100644 --- a/modules/confd/manifests/file.pp +++ b/modules/confd/manifests/file.pp @@ -20,12 +20,14 @@ file { "/etc/confd/conf.d/${safe_name}.toml": ensure => $ensure, content => template('confd/service_template.toml.erb'), + require => Package['confd'] } file { "/etc/confd/templates/${safe_name}.tmpl": ensure => $ensure, mode => '0400', content => $content, + before => File["/etc/confd/conf.d/${safe_name}.toml"], notify => Service['confd'], } } diff --git a/modules/lvs/manifests/balancer.pp b/modules/lvs/manifests/balancer.pp index 62b39d5..b9a9652 100644 --- a/modules/lvs/manifests/balancer.pp +++ b/modules/lvs/manifests/balancer.pp @@ -27,6 +27,12 @@ site => $site } + # XXX: Where to pull these node names from? + class { 'confd': + running => true, + node => 'http://localhost:2379', + } + file { '/etc/modprobe.d/lvs.conf': ensure => present, owner => 'root', diff --git a/modules/pybal/manifests/confd.pp b/modules/pybal/manifests/confd.pp index e229eec..811f73b 100644 --- a/modules/pybal/manifests/confd.pp +++ b/modules/pybal/manifests/confd.pp @@ -1,5 +1,10 @@ class pybal::confd { + file { '/etc/pybal/pools': + ensure => directory, + require => Package[pybal], + } + file { '/usr/local/bin/pybal-eval-check': ensure => file, mode => '0555', diff --git a/modules/pybal/manifests/configuration.pp b/modules/pybal/manifests/configuration.pp index b3b9cb3..8ca2202 100644 --- a/modules/pybal/manifests/configuration.pp +++ b/modules/pybal/manifests/configuration.pp @@ -9,4 +9,8 @@ require => Package['pybal'], content => template("${module_name}/pybal.conf.erb"); } + + # for every service cluster we need a matching pool + $service_keys = keys($lvs_services) + pybal::pool {$service_keys: lvs_services => $lvs_services} } diff --git a/modules/pybal/manifests/pool.pp b/modules/pybal/manifests/pool.pp new file mode 100644 index 0000000..50b47ed --- /dev/null +++ b/modules/pybal/manifests/pool.pp @@ -0,0 +1,21 @@ +define pybal::pool($lvs_services={}) { + $service_config = $lvs_services[$name] + + # this check should only exist for as long as + # we have clusters not using etcd. + if has_key($service_config, 'conftool') { + + $cluster = $service_config['conftool']['cluster'] + $service = $service_config['conftool']['service'] + + $watch_keys = ["/conftool/v1/pools/$::site/$cluster/$service/"] + $tmpl = template('pybal/host-pool.tmpl.erb') + + confd::file{ "/etc/pybal/pools/$name": + watch_keys => $watch_keys, + content => $tmpl, + check => '/usr/local/bin/pybal-eval-check', + require => File['/etc/pybal/pools'], + } + } +} diff --git a/modules/pybal/templates/pybal.conf.erb b/modules/pybal/templates/pybal.conf.erb index d0ee898..3e5215c 100644 --- a/modules/pybal/templates/pybal.conf.erb +++ b/modules/pybal/templates/pybal.conf.erb @@ -29,6 +29,8 @@ port = <%= service.fetch('port', 80) %> scheduler = <%= service.fetch('scheduler', "wrr") %> config = http://config-master.<%= @site %>.wmnet/pybal/<%= @site %>/<%= servicename %> +# This is to be enabled per host for etcd introduction +# config = file:///etc/pybal/pools/<%= servicename %> bgp = <%= service.fetch('bgp', "no") %> depool-threshold = <%= service.fetch('depool-threshold', ".5") %> monitors = <%= service['monitors'].keys.sort.inspect %> -- To view, visit https://gerrit.wikimedia.org/r/219481 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6c0179738bc3dab0170a5ccba20f53cd42a06b79 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Rush <r...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits