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

Parameters:

  • origin (Hash) (defaults to: lookup('profile::etcd::replication::origin'))
  • destination_path (Stdlib::Unixpath) (defaults to: lookup('profile::etcd::replication::destination_path'))
  • active (Boolean) (defaults to: lookup('profile::etcd::replication::active'))
  • dst_url (Stdlib::Httpurl) (defaults to: lookup('profile::etcd::replication::dst_url', {'default_value' => 'http://localhost:2378'}))
  • src_port (Stdlib::Port) (defaults to: lookup('profile::etcd::replication::src_port', {'default_value' => 2379}))


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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']}"

    $hosts = fqdn_rotate($origin['servers'])
    etcdmirror::instance { $resource_title:
        src                   => "https://${hosts[0]}:${src_port}",
        src_path              => $origin['path'],
        src_ignore_keys_regex => $origin['ignore_keys_regex'],
        dst                   => $dst_url,
        dst_path              => $destination_path,
        enable                => $active,
    }
}