Skip to content

Commit

Permalink
Revert "Conditionally render the prom scraper nginx server when the c…
Browse files Browse the repository at this point in the history
…erts are"

This reverts commit e2247a8.
  • Loading branch information
moleske authored and dalvarado committed Jul 12, 2022
1 parent e2247a8 commit 80d2622
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
25 changes: 23 additions & 2 deletions jobs/cloud_controller_ng/templates/nginx.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ http {
}
}

<% if_p("cc.prom_scraper_tls.public_cert", "cc.prom_scraper_tls.private_key", "cc.prom_scraper_tls.ca_cert") do %>
server {
listen <%= p("cc.prom_metrics_server_tls_port") %> ssl;
include prom_scraper_mtls.conf;
Expand Down Expand Up @@ -173,7 +172,29 @@ http {
proxy_pass http://cloud_controller;
}
}
<% end %>
<%# server { %>
<%# listen 9024 ssl; %>
<%# include prom_scraper_mtls.conf; %>
<%# server_name _; %>
<%# server_name_in_redirect off; %>
<%# <% if p("request_timeout_in_seconds").to_i > 0 %1> %>
<%# proxy_send_timeout <%= p("request_timeout_in_seconds") %1>; %>
<%# proxy_read_timeout <%= p("request_timeout_in_seconds") %1>; %>
<%# <% end %1> %>
<%# proxy_buffering off; %>
<%# proxy_set_header Host $host; %>
<%# proxy_set_header X-Real_IP $remote_addr; %>
<%# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; %>
<%# proxy_redirect off; %>
<%# proxy_connect_timeout 10; %>
<%# location /internal/v4/metrics { %>
<%# proxy_pass http://cloud_controller; %>
<%# } %>
<%# } %>


# This block handles public endpoints over TLS
server {
Expand Down
32 changes: 0 additions & 32 deletions spec/cloud_controller_ng/nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,6 @@ module Bosh::Template::Test
expect(@rendered_file).to include('log_format main escape=json')
end
end

context 'prom_scraper with all propeties set' do
let(:manifest_properties) { { 'cc' => { 'prom_scraper_tls' => { 'public_cert' => 'a public cert', 'private_key' => 'a private key', 'ca_cert' => 'an authority' } } } }

it 'renders prom scraper server' do
expect(@rendered_file).to include('include prom_scraper_mtls.conf')
end
end

context 'prom_scraper with public_cert not set' do
let(:manifest_properties) { { 'cc' => { 'prom_scraper_tls' => { 'private_key' => 'a private key', 'ca_cert' => 'an authority' } } } }

it 'does not render prom scraper server' do
expect(@rendered_file).not_to include('include prom_scraper_mtls.conf')
end
end

context 'prom_scraper with private_key not set' do
let(:manifest_properties) { { 'cc' => { 'prom_scraper_tls' => { 'public_cert' => 'a public cert', 'ca_cert' => 'an authority' } } } }

it 'does not render prom scraper server' do
expect(@rendered_file).not_to include('include prom_scraper_mtls.conf')
end
end

context 'prom_scraper with ca_cert not set' do
let(:manifest_properties) { { 'cc' => { 'prom_scraper_tls' => { 'public_cert' => 'a public cert', 'private_key' => 'a private key' } } } }

it 'does not render prom scraper server' do
expect(@rendered_file).not_to include('include prom_scraper_mtls.conf')
end
end
end
end
end

0 comments on commit 80d2622

Please sign in to comment.