Puppet Class: profile::pontoon::sd

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

Overview

SPDX-License-Identifier: Apache-2.0 Pontoon Service Discovery

The default implementation of sd: all routable services will be pointed to the first host running the pontoon::lb role. Other DNS queries will be sent to DNS resolvers listed in sd_nameservers.

Parameters:

  • sd_nameservers (Array[Stdlib::IP::Address]) (defaults to: lookup('profile::pontoon::sd_nameservers'))
  • local_nameservers (Array[Stdlib::IP::Address]) (defaults to: lookup('profile::resolving::nameservers'))
  • lbs (Array[Stdlib::Fqdn]) (defaults to: pontoon::hosts_for_role('pontoon::lb'))


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
# File 'modules/profile/manifests/pontoon/sd.pp', line 7

class profile::pontoon::sd (
    Array[Stdlib::IP::Address] $sd_nameservers = lookup('profile::pontoon::sd_nameservers'),
    Array[Stdlib::IP::Address] $local_nameservers = lookup('profile::resolving::nameservers'),
    Array[Stdlib::Fqdn] $lbs = pontoon::hosts_for_role('pontoon::lb'), # lint:ignore:wmf_styleguide
) {
    unless length($local_nameservers) == 1 and $local_nameservers[0] == '127.0.0.53' {
        fail("Local nameservers ${local_nameservers} misconfigured")
    }

    if empty($lbs) {
        fail('No LBs configured')
    }

    if empty($sd_nameservers) {
        fail('No upstream nameservers configured')
    }

    # Announce all services with 'role' keyword. The LB will take care of routing to backend hosts.
    $role_services = wmflib::service::fetch().filter |$name, $config| {
        ('role' in $config)
    }

    class { 'pontoon::sd':
        lb_address      => ipresolve($lbs[0], 4),
        nameservers     => $sd_nameservers,
        services_config => $role_services,
        # Make sure the local resolver used for SD
        # is installed before /etc/resolv.conf is changed
        before          => Class['resolvconf'],
    }
}