Puppet Function: prometheus::proxy_pass
- Defined in:
- modules/prometheus/functions/proxy_pass.pp
- Function type:
- Puppet Language
Overview
Given a single Prometheus instance configuration, return either a URL or a list of URLs where the instance can be found.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'modules/prometheus/functions/proxy_pass.pp', line 5
function prometheus::proxy_pass (
Hash $config,
Stdlib::Fqdn $localhost = $facts['networking']['fqdn'],
) {
if $localhost in $config['hosts'] {
"http://localhost:${config['port']}/${config['instance']}"
} else {
$remote_hosts = $config['hosts'].filter |$h| { $h =~ "\\.${::site}" }.map |$h| { "https://${h}/${config['instance']}" }
if empty($remote_hosts) {
fail('No remote hosts found, aborting')
}
$remote_hosts
}
}
|