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
55
56
57
58
59
60
61
62
63
64
65
|
# File 'modules/profile/manifests/thanos/rule/pilot.pp', line 14
class profile::thanos::rule::pilot (
Hash[Stdlib::Fqdn, Hash] $thanos_rule_hosts = lookup('profile::thanos::rule_hosts'),
Array $query_hosts = lookup('profile::thanos::frontends'),
Hash[String, String] $objstore_account = lookup('profile::thanos::objstore_account'),
String $objstore_password = lookup('profile::thanos::objstore_password'),
Array[Stdlib::Host] $alertmanagers = lookup('alertmanagers'),
String $public_domain = lookup('public_domain'),
Optional[Integer] $object_store_cutoff_days = lookup('profile::thanos::object_store_cutoff_days', { 'default_value' => undef}),
) {
$http_port = 17912
$grpc_port = 17911
thanos::rule { 'pilot':
alertmanagers => $alertmanagers,
# rule_files will be automatically merged with the default /etc/thanos-rule@ paths for puppet-deployed
# files, whereas /srv paths will receive rules/alerts deployed by other means.
rule_files => ['/srv/thanos-rule@pilot/*.yaml'],
rule_hosts => $thanos_rule_hosts,
use_objstore => true,
objstore_account => $objstore_account,
objstore_password => $objstore_password,
http_port => $http_port,
grpc_port => $grpc_port,
query_url => "https://thanos.${public_domain}",
# Thanos Rule accepts input in the form of an interval (e.g., '15d' represents 15 days).
# The cutoff parameter is expressed in days as an Integer, and here we adjust the format to the correct string.
retention_time => sprintf('%dd', $object_store_cutoff_days + 1),
tracing_enabled => true,
}
profile::thanos::query::store_config { 'pilot':
hosts => $thanos_rule_hosts,
grpc_port => $grpc_port,
}
unless $query_hosts.empty() {
# Allow grpc access from query hosts
firewall::service { "thanos_rule_query_${title}":
proto => 'tcp',
port => $grpc_port,
srange => $query_hosts,
}
# Allow http access to reverse-proxy /rule
firewall::service { "thanos_rule_web_${title}":
proto => 'tcp',
port => $http_port,
srange => $query_hosts,
}
}
}
|