Puppet Class: pontoon::public_lb

Defined in:
modules/pontoon/manifests/public_lb.pp

Overview

Parameters:

  • services_config (Hash[String, Wmflib::Service])
  • public_domain (String)


19
20
21
22
23
24
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
# File 'modules/pontoon/manifests/public_lb.pp', line 19

class pontoon::public_lb (
    Hash[String, Wmflib::Service] $services_config,
    String $public_domain,
) {
    $t = $services_config.map |$service_name, $config| {
        $server_name = "${config['public_endpoint']}.${public_domain}"

        if 'public_aliases' in $config {
            $aliases = $config['public_aliases'].map |$a| { "${a}.${public_domain}" }
        } else {
            $aliases = []
        }

        [
            $service_name,
            {
                'public_name'     => $server_name,
                'public_aliases'  => $aliases,
                'port'            => $config['port'],
                'hosts'           => pontoon::hosts_for_role($config['role']),
                'backend_use_tls' => $config['encryption'],
                # Which SNI to send when talking to backends in TLS.
                'backend_sni'     => ('lvs' in $config) ? {
                                        true  => "${service_name}.discovery.wmnet",
                                        false => $server_name,
                                      },
            }
        ]
    }
    $services = Hash($t)

    haproxy::site { 'pontoon_public_lb':
        content => template('pontoon/haproxy.public.erb'),
    }
}