Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add nginx and open firewall port #731

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
24 changes: 24 additions & 0 deletions manifests/profile/prometheus.pp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,30 @@
port => 443,
block => 'umich::networks::all_trusted_machines',
}
} else {
class { 'nginx':
server_tokens => 'off',
}
nginx::resource::server { 'https-forwarder':
server_name => [$::fqdn],
listen_options => "proxy_protocol default_server",
listen_port => 443,
proxy => "http://localhost:9090",
ssl => true,
ssl_cert => "/etc/prometheus/tls/client.crt",
ssl_key => "/etc/prometheus/tls/client.key",
server_cfg_append => {
'ssl_client_certificate' => '/etc/prometheus/tls/ca.crt',
'ssl_verify_client' => 'on',
'ssl_verify_depth' => 1,
},
}
firewall { "200 HTTPS: Client Cert":
proto => 'tcp',
dport => [443],
state => 'NEW',
action => 'accept',
}
}

# Delete this once nothing is importing it. It's only here for the
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