Puppet Class: profile::thanos::query

Defined in:
modules/profile/manifests/thanos/query.pp

Overview

Parameters:

  • sites (Any) (defaults to: lookup('datacenters'))


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/thanos/query.pp', line 12

class profile::thanos::query (
    $sites = lookup('datacenters'),
) {
    $sd_files = '/etc/thanos-query/stores/*.yml'
    $sd_files_path = dirname($sd_files)
    $http_port = 10902

    class { 'thanos::query':
        http_port => $http_port,
        sd_files  => $sd_files,
    }

    # Reach out to all sites' sidecars for recent data
    $sites.each |String $s| {
        prometheus::resource_config{ "thanos_store_sidecar_${s}":
            dest           => "${sd_files_path}/sidecar_${s}.yml",
            site           => $s,
            define_name    => 'thanos::sidecar',
            port_parameter => 'grpc_port',
        }
    }

    # Talk to local store for historical data
    $local_store = [ { 'targets' =>  ['localhost:11901'] } ]
    file { "${sd_files_path}/local.yml":
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => 'root',
        content => ordered_yaml($local_store),
    }

    ferm::service { 'thanos_query':
        proto  => 'tcp',
        port   => $http_port,
        srange => '$DOMAIN_NETWORKS',
    }
}