Skip to content

Commit

Permalink
configure haproxy for prometheus
Browse files Browse the repository at this point in the history
  • Loading branch information
umjnega committed Oct 24, 2024
1 parent c4e51d8 commit 8a68592
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
14 changes: 14 additions & 0 deletions manifests/profile/kubernetes/destination_port/prometheus.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (c) 2024 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.

class nebula::profile::kubernetes::destination_port::prometheus {
$cluster_name = lookup('nebula::profile::kubernetes::cluster')

@@concat_fragment { "haproxy kubernetes prometheus ${::hostname}":
target => '/etc/haproxy/services.d/prometheus.cfg',
order => '02',
content => " server ${::hostname} ${::ipaddress}:443 check send-proxy\n",
tag => "${cluster_name}_haproxy_kubernetes_prometheus",
}
}
6 changes: 5 additions & 1 deletion manifests/profile/kubernetes/haproxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
notify => Service['haproxy'],
}

['api', 'etcd', 'gelf_tcp', 'http', 'https', 'https_alt'].each |$service| {
['api', 'etcd', 'gelf_tcp', 'http', 'https', 'https_alt', 'prometheus'].each |$service| {
concat { "/etc/haproxy/services.d/${service}.cfg":
notify => Service['haproxy'],
}
Expand Down Expand Up @@ -72,6 +72,10 @@
'200 public https':
dport => 443,
;

'200 client cert prometheus https':
dport => 9090,
;
}

nebula::exposed_port { '200 private https_alt':
Expand Down
1 change: 1 addition & 0 deletions manifests/role/kubernetes/prometheus.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
include nebula::role::prometheus
include nebula::profile::unattended_upgrades
include nebula::profile::kubernetes::dns_client
include nebula::profile::kubernetes::destination_port::prometheus
class { 'nebula::profile::kubernetes::kubelet':
install_kubelet => false,
}
Expand Down
11 changes: 11 additions & 0 deletions templates/profile/kubernetes/haproxy/services.d/prometheus.cfg.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Managed by puppet (nebula/profile/kubernetes/haproxy/services.d/prometheus.cfg.erb)
frontend kubernetes-prometheus-front
bind <%= @public_address %>:9090
mode tcp
option tcplog
default_backend kubernetes-prometheus-back

backend kubernetes-prometheus-back
mode tcp
option tcp-check
balance roundrobin

0 comments on commit 8a68592

Please sign in to comment.