Puppet Class: thanos::compact

Defined in:
modules/thanos/manifests/compact.pp

Overview

Parameters:

  • run_on_host (Stdlib::Fqdn)
  • objstore_account (Hash[String, String])
  • objstore_password (String)
  • ensure (Wmflib::Ensure) (defaults to: present)
  • retention (String) (defaults to: '60w')
  • http_port (Stdlib::Port::Unprivileged) (defaults to: 12902)
  • concurrency (Integer) (defaults to: max($::processorcount / 2, 1))


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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'modules/thanos/manifests/compact.pp', line 15

class thanos::compact (
    Stdlib::Fqdn $run_on_host,
    Hash[String, String] $objstore_account,
    String $objstore_password,
    Wmflib::Ensure $ensure = present,
    String $retention = '60w',
    Stdlib::Port::Unprivileged $http_port = 12902,
    Integer $concurrency = max($::processorcount / 2, 1),
) {
    require_package('thanos')

    $http_address = "0.0.0.0:${http_port}"
    $service_name = 'thanos-compact'
    $data_dir = '/srv/thanos-compact'
    $objstore_config_file = '/etc/thanos-compact/objstore.yaml'

    file { $data_dir:
        ensure => directory,
        mode   => '0750',
        owner  => 'thanos',
        group  => 'thanos',
    }

    file { '/etc/thanos-compact':
        ensure => directory,
        mode   => '0555',
        owner  => 'root',
        group  => 'root',
    }

    file { $objstore_config_file:
        ensure    => $ensure,
        mode      => '0440',
        owner     => 'thanos',
        group     => 'root',
        show_diff => false,
        content   => template('thanos/objstore.yaml.erb'),
    }

    if $ensure != present {
        $service_ensure = $ensure
    } else { # handle fqdn-based singleton service
        if $run_on_host == $::fqdn {
            $service_ensure = 'present'
            $service_enable = true
        } else {
            $service_ensure = 'absent'
            $service_enable = false
        }
    }

    systemd::service { $service_name:
        ensure         => $service_ensure,
        restart        => true,
        content        => systemd_template('thanos-compact'),
        service_params => {
            enable     => $service_enable,
            hasrestart => true,
        },
    }
}