Puppet Class: profile::etcd::replication
- Defined in:
- modules/profile/manifests/etcd/replication.pp
Overview
Class profile::etcd::replication
Run replication from remote clusters to the local one.
Parameters
- origin
-
Hash with information on the source in the form:
{
'cluster_name' => 'test-cluster', 'path' => '/conftool',
'servers' => ['server1', 'server2'...],
}
- destination_path
-
Destination path on the local machine
- active
-
If replication is active. For now, only one server per cluster
- dst_url
-
scheme:hostname:port combination of the target etcd instance (namely the one receiving the replicated data from etcd mirror). Default: localhost:2378
- src_port
-
Client port of the origin etcd instance (namely the one replicating data via etcd mirror). Default: 2379
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'modules/profile/manifests/etcd/replication.pp', line 25
class profile::etcd::replication(
Hash $origin = lookup('profile::etcd::replication::origin'),
Stdlib::Unixpath $destination_path = lookup('profile::etcd::replication::destination_path'),
Boolean $active = lookup('profile::etcd::replication::active'),
Stdlib::Httpurl $dst_url = lookup('profile::etcd::replication::dst_url', {'default_value' => 'http://localhost:2378'}),
Stdlib::Port $src_port = lookup('profile::etcd::replication::src_port', {'default_value' => 2379})
) {
require ::passwords::etcd
$accounts = $::passwords::etcd::accounts
# Replica is always from remote to local. This means only the local account
# is needed.
$resource_title = "${origin['path']}@${origin['cluster_name']}"
$etcdmirror_web_port = 8000
$hosts = fqdn_rotate($origin['servers'])
etcdmirror::instance { $resource_title:
src => "https://${hosts[0]}:${src_port}",
src_path => $origin['path'],
dst => $dst_url,
dst_path => $destination_path,
enable => $active,
}
if $active {
# Monitoring lag is less than 5 operations. TODO: take this from prometheus.
monitoring::service{ 'etcd_replication_lag':
description => 'Etcd replication lag',
check_command => "check_http_url_for_regexp_on_port!${::fqdn}!${etcdmirror_web_port}!/lag!^(-[1-9]|[0-5][^0-9]+)",
critical => true,
notes_url => 'https://wikitech.wikimedia.org/wiki/Etcd',
}
}
}
|