File tree 2 files changed +29
-3
lines changed
2 files changed +29
-3
lines changed Original file line number Diff line number Diff line change 1
- # Copyright (c) 2019 The Regents of the University of Michigan.
1
+ # Copyright (c) 2019, 2024 The Regents of the University of Michigan.
2
2
# All Rights Reserved. Licensed according to the terms of the Revised
3
3
# BSD License. See LICENSE.txt for details.
4
4
45
45
# @param dynamic_weight_smoothing This value is added to the weight for each
46
46
# backend server regardless of server load to help "smooth" the effect of the weighting
47
47
#
48
+ # @param check_timeout_milliseconds How long to wait for http status
49
+ # checks; defaults to 5 seconds
50
+ #
48
51
# @example
49
52
# nebula::haproxy::service { 'www-whatever':
50
53
# floating_ip => '1.2.3.4'
70
73
Hash $whitelists = {},
71
74
Boolean $custom_503 = false ,
72
75
Boolean $dynamic_weighting = false ,
73
- Integer $dynamic_weight_smoothing = 2
76
+ Integer $dynamic_weight_smoothing = 2,
77
+ Optional[Integer] $check_timeout_milliseconds = undef
74
78
) {
75
79
76
80
include nebula::profile::haproxy::prereqs
144
148
content => " option httpchk GET /monitor/monitor.pl\n http-check expect status 200\n " ,
145
149
order => ' 02'
146
150
}
151
+
152
+ if $check_timeout_milliseconds != undef {
153
+ concat_fragment { "${service_prefix} check_timeout" :
154
+ target => $service_cfg ,
155
+ content => " timeout connect ${check_timeout_milliseconds} \n " ,
156
+ order => ' 02'
157
+ }
158
+ }
147
159
}
148
160
149
161
if ($custom_503 ) {
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- # Copyright (c) 2018 The Regents of the University of Michigan.
3
+ # Copyright (c) 2018, 2024 The Regents of the University of Michigan.
4
4
# All Rights Reserved. Licensed according to the terms of the Revised
5
5
# BSD License. See LICENSE.txt for details.
6
6
require 'spec_helper'
253
253
. with_environment ( [ 'HAPROXY_SMOOTHING_FACTOR=2' ] )
254
254
end
255
255
end
256
+
257
+ it { is_expected . not_to contain_concat_fragment ( 'svc1-dc1-https check_timeout' ) }
258
+
259
+ context 'with check_timeout_milliseconds set to 15000' do
260
+ let ( :params ) do
261
+ super ( ) . merge ( check_timeout_milliseconds : 15000 )
262
+ end
263
+
264
+ it do
265
+ is_expected . to contain_concat_fragment ( 'svc1-dc1-https check_timeout' )
266
+ . with_target ( service_config )
267
+ . with_content ( "timeout connect 15000\n " )
268
+ end
269
+ end
256
270
end
257
271
258
272
describe 'http service config' do
You can’t perform that action at this time.
0 commit comments