Skip to content

Commit 1fd25d3

Browse files
author
Deepak Tiwari
committed
Manage Haproxy frontend timeout from Hiera file
1 parent 6f3d432 commit 1fd25d3

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

modules/enableit/eit_haproxy/manifests/basic_config.pp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
class eit_haproxy::basic_config (
55
Eit_haproxy::Domains $domains,
66
Eit_haproxy::Listen $listens = {},
7+
Eit_haproxy::Timeout $frontend_timeout = {},
78
Boolean $ddos_protection = false,
89
Boolean $https = true,
910
Boolean $http = false,
@@ -204,12 +205,18 @@
204205
{ 'http-request' => 'deny deny_status 429 if !is_priority ww_rl_reached' },
205206
]
206207

208+
$_frontend_timeout = Hash(
209+
$frontend_timeout.map |$k, $v| {
210+
["timeout ${k}", $v]
211+
}
212+
)
207213

208214
haproxy::frontend { 'web':
209215
mode => $mode,
210216
bind => $binds,
211217
options => [
212218
{'option' => "${mode}log"},
219+
$_frontend_timeout,
213220
if $https and $use_lets_encrypt {
214221
{ 'acl is_letsencrypt' => 'path_beg /.well-known/acme-challenge/' }
215222
},

modules/enableit/eit_haproxy/manifests/init.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Enum['auto', 'manual'] $configure,
66
Eit_haproxy::Domains $domains,
77
Eit_haproxy::Listen $listens,
8+
Eit_haproxy::Timeout $frontend_timeout,
89
Hash[Eit_types::IP,Variant[
910
Array[Stdlib::Port],
1011
Stdlib::Port
@@ -64,6 +65,7 @@
6465
listens => $listens,
6566
mode => $mode,
6667
listen_on => $listen_on,
68+
frontend_timeout => $frontend_timeout,
6769
encryption_ciphers => $encryption_ciphers,
6870
}
6971
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Haproxy Timeouts
2+
3+
type Eit_haproxy::Timeout = Struct[{
4+
client => Optional[String],
5+
connect => Optional[String],
6+
server => Optional[String],
7+
queue => Optional[String],
8+
tunnel => Optional[String],
9+
check => Optional[String],
10+
http-request => Optional[String],
11+
http-keep-alive => Optional[String],
12+
http-connection => Optional[String],
13+
tarpit => Optional[String],
14+
}]

modules/enableit/profile/manifests/haproxy.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Optional[String] $manual_config,
55
Eit_haproxy::Domains $domains = {},
66
Eit_haproxy::Listen $listens = {},
7+
Eit_haproxy::Timeout $frontend_timeout = {},
78
Boolean $ddos_protection = false,
89
Boolean $https = true,
910
Boolean $http = false,
@@ -49,6 +50,7 @@
4950
use_hsts => $use_hsts,
5051
mode => $mode,
5152
listen_on => $listen_on,
53+
frontend_timeout => $frontend_timeout,
5254
manual_config => $manual_config,
5355
configure => $configure,
5456
firewall => $firewall,

modules/enableit/role/manifests/web/haproxy.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
Optional[String] $manual_config = undef,
4747
Eit_haproxy::Domains $domains = {},
4848
Eit_haproxy::Listen $listens = {},
49+
Eit_haproxy::Timeout $frontend_timeout = {},
4950
Boolean $ddos_protection = false,
5051
Boolean $https = true,
5152
Boolean $http = false,
@@ -81,6 +82,7 @@
8182
version => $version,
8283
configure => $configure,
8384
listen_on => $listen_on,
85+
frontend_timeout => $frontend_timeout,
8486
encryption_ciphers => $encryption_ciphers,
8587
firewall => $firewall,
8688
service_options => $service_options,

0 commit comments

Comments
 (0)