Puppet Class: profile::pontoon::lb

Defined in:
modules/profile/manifests/pontoon/lb.pp

Overview

Parameters:

  • public_domain (Any) (defaults to: lookup('public_domain'))


6
7
8
9
10
11
12
13
14
15
16
17
18
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
# File 'modules/profile/manifests/pontoon/lb.pp', line 6

class profile::pontoon::lb (
  $public_domain = lookup('public_domain'),
) {
    $role_services = wmflib::service::fetch().filter |$name, $config| {
        ('role' in $config and pontoon::hosts_for_role($config['role']))
    }

    class { 'pontoon::lb':
        services_config => $role_services,
        public_domain   => $public_domain,
    }

    $ports = unique($role_services.map |$name, $svc| { $svc['port'] })

    $ports.sort.each |$p| {
        firewall::service { "pontoon-lb-${p}":
            proto   => 'tcp',
            notrack => true,
            port    => $p,
        }
    }

    # LB can act as a Cloud VPS backend to proxy public services
    firewall::service { 'pontoon-webproxy-backend':
        proto => 'tcp',
        port  => 80,
    }

    # Additional DNS listener for SD to work within containers.
    # '127.0.0.1' is normally used in /etc/resolv.conf by Pontoon SD, which
    # doesn't work inside containers because of a different network namespace.
    file { '/etc/dnsmasq.d/pontoon-lb.conf':
        content => "listen-address=${facts['ipaddress']}",
        notify  => Exec['dnsmasq-restart'],
    }

    ['udp', 'tcp'].each |$proto| {
        firewall::service { "pontoon-lb-dns-${proto}":
            proto   => $proto,
            notrack => true,
            port    => 53,
        }
    }
}