Puppet Class: profile::toolforge::k8s::haproxy

Defined in:
modules/profile/manifests/toolforge/k8s/haproxy.pp

Overview

Parameters:

  • ingress_nodes (Array[ Variant[ Stdlib::Fqdn, Struct[{ host => Stdlib::Fqdn, port => Optional[Stdlib::Port], jobs_port => Optional[Stdlib::Port], }] ] ]) (defaults to: lookup('profile::toolforge::k8s::ingress_nodes', {default_value => ['localhost']}))
  • ingress_port (Stdlib::Port) (defaults to: lookup('profile::toolforge::k8s::ingress_port', {default_value => 30000}))
  • control_nodes (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::toolforge::k8s::control_nodes', {default_value => ['localhost']}))
  • api_port (Stdlib::Port) (defaults to: lookup('profile::toolforge::k8s::apiserver_port', {default_value => 6443}))
  • jobs_port (Stdlib::Port) (defaults to: lookup('profile::toolforge::jobs_api_port', {default_value => 30001}))
  • keepalived_vips (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::toolforge::k8s::haproxy::keepalived_vips', {default_value => []}))
  • keepalived_peers (Array[Stdlib::Fqdn]) (defaults to: lookup('profile::toolforge::k8s::haproxy::keepalived_peers', {default_value => ['localhost']}))
  • keepalived_password (String) (defaults to: lookup('profile::toolforge::k8s::haproxy::keepalived_password', {default_value => 'notarealpassword'}))


1
2
3
4
5
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
50
51
52
53
54
# File 'modules/profile/manifests/toolforge/k8s/haproxy.pp', line 1

class profile::toolforge::k8s::haproxy (
    Array[
        Variant[
            Stdlib::Fqdn,
            Struct[{
                host      => Stdlib::Fqdn,
                port      => Optional[Stdlib::Port],
                jobs_port => Optional[Stdlib::Port],
            }]
        ]
    ]                   $ingress_nodes       = lookup('profile::toolforge::k8s::ingress_nodes',                {default_value => ['localhost']}),
    Stdlib::Port        $ingress_port        = lookup('profile::toolforge::k8s::ingress_port',                 {default_value => 30000}),
    Array[Stdlib::Fqdn] $control_nodes       = lookup('profile::toolforge::k8s::control_nodes',                {default_value => ['localhost']}),
    Stdlib::Port        $api_port            = lookup('profile::toolforge::k8s::apiserver_port',               {default_value => 6443}),
    Stdlib::Port        $jobs_port           = lookup('profile::toolforge::jobs_api_port',                     {default_value => 30001}),
    Array[Stdlib::Fqdn] $keepalived_vips     = lookup('profile::toolforge::k8s::haproxy::keepalived_vips',     {default_value => []}),
    Array[Stdlib::Fqdn] $keepalived_peers    = lookup('profile::toolforge::k8s::haproxy::keepalived_peers',    {default_value => ['localhost']}),
    String              $keepalived_password = lookup('profile::toolforge::k8s::haproxy::keepalived_password', {default_value => 'notarealpassword'}),
) {
    class { 'haproxy::cloud::base': }

    file { '/etc/haproxy/conf.d/k8s-api-servers.cfg':
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('profile/toolforge/k8s/haproxy/k8s-api-servers.cfg.erb'),
        notify  => Service['haproxy'],
    }
    file { '/etc/haproxy/conf.d/k8s-ingress.cfg':
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('profile/toolforge/k8s/haproxy/k8s-ingress.cfg.erb'),
        notify  => Service['haproxy'],
    }

    file { '/etc/haproxy/conf.d/k8s-ingress-jobs.cfg':
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('profile/toolforge/k8s/haproxy/k8s-ingress-jobs.cfg.erb'),
        notify  => Service['haproxy'],
    }

    class { 'prometheus::haproxy_exporter': }

    unless $keepalived_vips.empty {
        class { 'keepalived':
            auth_pass => $keepalived_password,
            peers     => delete($keepalived_peers, $::fqdn),
            vips      => $keepalived_vips.map |$host| { ipresolve($host, 4) },
        }
    }
}