-
Notifications
You must be signed in to change notification settings - Fork 44
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
BZ1211080 horizon ssl termination #514
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if FileTest.file?("/etc/ssl/horizon.pem") | ||
Facter.add(:haproxy_cert_exist) do | ||
setcode { true } | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,69 @@ | ||
class quickstack::load_balancer::horizon ( | ||
$frontend_pub_host, | ||
$frontend_priv_host, | ||
$frontend_admin_host, | ||
$backend_server_names, | ||
$backend_server_addrs, | ||
$port = '80', | ||
$mode = 'http', | ||
$log = 'httplog', | ||
$frontend_pub_host, | ||
$frontend_priv_host, | ||
$frontend_admin_host, | ||
$backend_server_names, | ||
$backend_server_addrs, | ||
$backend_port = '80', | ||
$mode = 'http', | ||
$option = 'httplog' | ||
) { | ||
|
||
include quickstack::load_balancer::common | ||
include quickstack::load_balancer::common | ||
|
||
quickstack::load_balancer::proxy { 'horizon': | ||
if str2bool("$::haproxy_cert_exist") { | ||
quickstack::load_balancer::proxy { 'horizon': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not refactor this and the repeated declaration below the if so it is only described once? port could easily stay a variable, since that is different between the ssl/non-ssl versions, and you could just set backend_port to nil/undef (unless this causes haproxy config to be incorrect, but passing undef as the value should be the same as not even calling it, as I understand it). Then you can just use this if block to set those params and perhaps create the horizon_http resource. |
||
addr => [ $frontend_pub_host, | ||
$frontend_priv_host, | ||
$frontend_admin_host ], | ||
port => "$port", | ||
mode => "$mode", | ||
|
||
port => "443 ssl crt /etc/ssl/horizon.pem", | ||
mode => $mode, | ||
listen_options => { | ||
'option' => [ "$log" ], | ||
'option' => [ $option ], | ||
'cookie' => 'SERVERID insert indirect nocache', | ||
}, | ||
member_options => [ 'check inter 1s' ], | ||
define_cookies => true, | ||
backend_port => $backend_port, | ||
backend_server_addrs => $backend_server_addrs, | ||
backend_server_names => $backend_server_names, | ||
} | ||
|
||
quickstack::load_balancer::proxy { 'horizon_http': | ||
addr => [ $frontend_pub_host, | ||
$frontend_priv_host, | ||
$frontend_admin_host ], | ||
port => "80", | ||
mode => $mode, | ||
listen_options => { | ||
'option' => [ $option ], | ||
'reqadd' => 'X-Forwarded-Proto:\ http', | ||
'redirect' => 'scheme https if !{ ssl_fc }', | ||
}, | ||
member_options => [ 'check inter 1s' ], | ||
define_cookies => true, | ||
backend_port => $backend_port, | ||
backend_server_addrs => undef, | ||
backend_server_names => undef, | ||
} | ||
} | ||
|
||
else { | ||
quickstack::load_balancer::proxy { 'horizon': | ||
addr => [ $frontend_pub_host, | ||
$frontend_priv_host, | ||
$frontend_admin_host ], | ||
port => "80", | ||
mode => "$mode", | ||
listen_options => { | ||
'option' => [ "$option" ], | ||
'cookie' => 'SERVERID insert indirect nocache', | ||
}, | ||
member_options => [ 'check inter 1s' ], | ||
define_cookies => true, | ||
backend_server_addrs => $backend_server_addrs, | ||
backend_server_names => $backend_server_names, | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This becomes $log after the new patch, and we want it to be tcplog for consistency.