Merge ~hloeung/content-cache-charm:haproxy-config into content-cache-charm:master

Proposed by Haw Loeung
Status: Merged
Approved by: Jay Kuri
Approved revision: 5ad6f1c42aa974f083052f5c0a66b7a7ad86f8cb
Merged at revision: f640753c7c52a81131bb70b1c34774c20ff4d542
Proposed branch: ~hloeung/content-cache-charm:haproxy-config
Merge into: content-cache-charm:master
Diff against target: 434 lines (+58/-1)
11 files modified
lib/haproxy.py (+5/-1)
reactive/content_cache.py (+5/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output.txt (+10/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output2.txt (+2/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output3.txt (+1/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt (+10/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt (+2/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt (+10/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt (+10/-0)
tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt (+1/-0)
tests/unit/test_content_cache.py (+2/-0)
Reviewer Review Type Date Requested Status
Canonical IS Reviewers Pending
Content Cache Charmers Pending
Review via email: mp+396208@code.launchpad.net

Commit message

Improve resiliency with HAProxy redispatch

This is as suggested by Jay in an internal ticket. Note that retries already defaults to 3.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision f640753c7c52a81131bb70b1c34774c20ff4d542

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/haproxy.py b/lib/haproxy.py
2index a68068b..14d0fc7 100644
3--- a/lib/haproxy.py
4+++ b/lib/haproxy.py
5@@ -303,7 +303,11 @@ backend backend-{name}
6
7 opts = []
8 for option in loc_conf.get('backend-options', []):
9- opts.append('{indent}option {opt}'.format(opt=option, indent=INDENT))
10+ prefix = ''
11+ if option.split()[0] in ['allbackups', 'forceclose', 'forwardfor', 'redispatch']:
12+ prefix = 'option '
13+ opts.append('{indent}{prefix}{opt}'.format(opt=option, prefix=prefix, indent=INDENT))
14+
15 options = ''
16 if opts:
17 options = '\n'.join(opts + [''])
18diff --git a/reactive/content_cache.py b/reactive/content_cache.py
19index 42c0997..5d6ddee 100644
20--- a/reactive/content_cache.py
21+++ b/reactive/content_cache.py
22@@ -298,9 +298,14 @@ def configure_haproxy(): # NOQA: C901 LP#1825084
23 if backend_check_path:
24 new_cached_loc_conf['backend-check-path'] = backend_check_path
25 new_loc_conf['backend-check-path'] = backend_check_path
26+ new_loc_conf['backend-options'] = []
27 backend_options = loc_conf.get('backend-options')
28 if backend_options:
29 new_loc_conf['backend-options'] = backend_options
30+
31+ # Make it more resilient to failures and redispatch requests to different backends.
32+ new_loc_conf['backend-options'].append('redispatch 1')
33+
34 new_cached_loc_conf['signed-url-hmac-key'] = loc_conf.get('signed-url-hmac-key')
35 # Pass through selected backend location configs, if defined.
36 for key in ('site-name', 'backend-inter-time', 'backend-tls'):
37diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output.txt
38index bd1bd1e..6fa7004 100644
39--- a/tests/unit/files/content_cache_rendered_haproxy_test_output.txt
40+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output.txt
41@@ -147,6 +147,7 @@ backend backend-cached-site1-local
42 server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 2048
43
44 backend backend-site1-local
45+ option redispatch 1
46 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
47 http-request set-header Host site1.local
48 balance leastconn
49@@ -162,6 +163,7 @@ backend backend-cached-site2-local
50 server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 2048
51
52 backend backend-site2-local
53+ option redispatch 1
54 option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
55 http-request set-header Host site2.local
56 balance leastconn
57@@ -179,6 +181,7 @@ backend backend-cached-site3-local
58 backend backend-site3-local
59 option forwardfor except 127.0.0.1
60 option forceclose
61+ option redispatch 1
62 option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
63 http-request set-header Host site3.local
64 balance leastconn
65@@ -201,12 +204,14 @@ backend backend-cached-site5
66 server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 2048
67
68 backend backend-site5
69+ option redispatch 1
70 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
71 http-request set-header Host site5.local
72 balance leastconn
73 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
74
75 backend backend-site5-2
76+ option redispatch 1
77 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
78 http-request set-header Host site5.local
79 balance leastconn
80@@ -220,6 +225,7 @@ backend backend-cached-site6-local
81 server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 2048
82
83 backend backend-site6-local
84+ option redispatch 1
85 option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
86 http-request set-header Host site6.local
87 balance leastconn
88@@ -233,6 +239,7 @@ backend backend-cached-site7-local
89 server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 2048
90
91 backend backend-site7-local
92+ option redispatch 1
93 option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
94 http-request set-header Host site7.local
95 balance leastconn
96@@ -246,12 +253,14 @@ backend backend-cached-site8-local
97 server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 2048
98
99 backend backend-site8-local
100+ option redispatch 1
101 option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
102 http-request set-header Host site8.local
103 balance leastconn
104 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
105
106 backend backend-site8-local-2
107+ option redispatch 1
108 option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
109 http-request set-header Host auth.site8.local
110 balance leastconn
111@@ -265,6 +274,7 @@ backend backend-cached-site9-local
112 server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 2048
113
114 backend backend-site9-local
115+ option redispatch 1
116 option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
117 http-request set-header Host site9.local
118 balance leastconn
119diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt
120index ef8dfa0..fe8a37f 100644
121--- a/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt
122+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output2.txt
123@@ -93,6 +93,8 @@ backend backend-cached-site1-local
124 server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 2048
125
126 backend backend-site1-local
127+ retries 3
128+ option redispatch 1
129 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
130 http-request set-header Host site1.local
131 balance leastconn
132diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt
133index ad10667..0c134d3 100644
134--- a/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt
135+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output3.txt
136@@ -98,6 +98,7 @@ backend backend-cached-site1-local
137 server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 2048
138
139 backend backend-site1-local
140+ option redispatch 1
141 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
142 http-request set-header Host site1.local
143 balance leastconn
144diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt
145index d7c2c0a..9bc7d2b 100644
146--- a/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt
147+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_auto_maxconns.txt
148@@ -147,6 +147,7 @@ backend backend-cached-site1-local
149 server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 2048
150
151 backend backend-site1-local
152+ option redispatch 1
153 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
154 http-request set-header Host site1.local
155 balance leastconn
156@@ -162,6 +163,7 @@ backend backend-cached-site2-local
157 server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 2048
158
159 backend backend-site2-local
160+ option redispatch 1
161 option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
162 http-request set-header Host site2.local
163 balance leastconn
164@@ -179,6 +181,7 @@ backend backend-cached-site3-local
165 backend backend-site3-local
166 option forwardfor except 127.0.0.1
167 option forceclose
168+ option redispatch 1
169 option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
170 http-request set-header Host site3.local
171 balance leastconn
172@@ -201,12 +204,14 @@ backend backend-cached-site5
173 server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 2048
174
175 backend backend-site5
176+ option redispatch 1
177 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
178 http-request set-header Host site5.local
179 balance leastconn
180 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
181
182 backend backend-site5-2
183+ option redispatch 1
184 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
185 http-request set-header Host site5.local
186 balance leastconn
187@@ -220,6 +225,7 @@ backend backend-cached-site6-local
188 server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 2048
189
190 backend backend-site6-local
191+ option redispatch 1
192 option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
193 http-request set-header Host site6.local
194 balance leastconn
195@@ -233,6 +239,7 @@ backend backend-cached-site7-local
196 server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 2048
197
198 backend backend-site7-local
199+ option redispatch 1
200 option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
201 http-request set-header Host site7.local
202 balance leastconn
203@@ -246,12 +253,14 @@ backend backend-cached-site8-local
204 server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 2048
205
206 backend backend-site8-local
207+ option redispatch 1
208 option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
209 http-request set-header Host site8.local
210 balance leastconn
211 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
212
213 backend backend-site8-local-2
214+ option redispatch 1
215 option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
216 http-request set-header Host auth.site8.local
217 balance leastconn
218@@ -265,6 +274,7 @@ backend backend-cached-site9-local
219 server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 2048
220
221 backend backend-site9-local
222+ option redispatch 1
223 option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
224 http-request set-header Host site9.local
225 balance leastconn
226diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt
227index 06670cd..7f6ab4d 100644
228--- a/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt
229+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_backup.txt
230@@ -98,6 +98,7 @@ backend backend-cached-site1-local
231
232 backend backend-site1-local
233 option allbackups
234+ option redispatch 1
235 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
236 http-request set-header Host site1.local
237 balance leastconn
238@@ -105,6 +106,7 @@ backend backend-site1-local
239 server server_2 192.168.1.2:8080 backup check inter 5s rise 2 fall 5 maxconn 2048
240
241 backend backend-site1-local-2
242+ option redispatch 1
243 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
244 http-request set-header Host site1.local
245 balance leastconn
246diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt
247index 486f3a2..645b39c 100644
248--- a/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt
249+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_load_balancing_algorithm.txt
250@@ -147,6 +147,7 @@ backend backend-cached-site1-local
251 server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 2048
252
253 backend backend-site1-local
254+ option redispatch 1
255 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
256 http-request set-header Host site1.local
257 balance roundrobin
258@@ -162,6 +163,7 @@ backend backend-cached-site2-local
259 server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 2048
260
261 backend backend-site2-local
262+ option redispatch 1
263 option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
264 http-request set-header Host site2.local
265 balance roundrobin
266@@ -179,6 +181,7 @@ backend backend-cached-site3-local
267 backend backend-site3-local
268 option forwardfor except 127.0.0.1
269 option forceclose
270+ option redispatch 1
271 option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
272 http-request set-header Host site3.local
273 balance roundrobin
274@@ -201,12 +204,14 @@ backend backend-cached-site5
275 server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 2048
276
277 backend backend-site5
278+ option redispatch 1
279 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
280 http-request set-header Host site5.local
281 balance roundrobin
282 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
283
284 backend backend-site5-2
285+ option redispatch 1
286 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
287 http-request set-header Host site5.local
288 balance roundrobin
289@@ -220,6 +225,7 @@ backend backend-cached-site6-local
290 server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 2048
291
292 backend backend-site6-local
293+ option redispatch 1
294 option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
295 http-request set-header Host site6.local
296 balance roundrobin
297@@ -233,6 +239,7 @@ backend backend-cached-site7-local
298 server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 2048
299
300 backend backend-site7-local
301+ option redispatch 1
302 option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
303 http-request set-header Host site7.local
304 balance roundrobin
305@@ -246,12 +253,14 @@ backend backend-cached-site8-local
306 server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 2048
307
308 backend backend-site8-local
309+ option redispatch 1
310 option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
311 http-request set-header Host site8.local
312 balance roundrobin
313 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
314
315 backend backend-site8-local-2
316+ option redispatch 1
317 option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
318 http-request set-header Host auth.site8.local
319 balance roundrobin
320@@ -265,6 +274,7 @@ backend backend-cached-site9-local
321 server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 2048
322
323 backend backend-site9-local
324+ option redispatch 1
325 option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
326 http-request set-header Host site9.local
327 balance roundrobin
328diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt
329index 4e64b08..8e65dbc 100644
330--- a/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt
331+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_processes_and_threads.txt
332@@ -148,6 +148,7 @@ backend backend-cached-site1-local
333 server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 2048
334
335 backend backend-site1-local
336+ option redispatch 1
337 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
338 http-request set-header Host site1.local
339 balance leastconn
340@@ -163,6 +164,7 @@ backend backend-cached-site2-local
341 server server_1 127.0.0.1:6081 check inter 2s rise 2 fall 60 maxconn 2048
342
343 backend backend-site2-local
344+ option redispatch 1
345 option httpchk GET /check/ HTTP/1.0\r\nHost:\ site2.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
346 http-request set-header Host site2.local
347 balance leastconn
348@@ -180,6 +182,7 @@ backend backend-cached-site3-local
349 backend backend-site3-local
350 option forwardfor except 127.0.0.1
351 option forceclose
352+ option redispatch 1
353 option httpchk HEAD / HTTP/1.0\r\nHost:\ site3.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
354 http-request set-header Host site3.local
355 balance leastconn
356@@ -202,12 +205,14 @@ backend backend-cached-site5
357 server server_1 127.0.0.1:6084 check inter 2s rise 2 fall 60 maxconn 2048
358
359 backend backend-site5
360+ option redispatch 1
361 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
362 http-request set-header Host site5.local
363 balance leastconn
364 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
365
366 backend backend-site5-2
367+ option redispatch 1
368 option httpchk HEAD / HTTP/1.0\r\nHost:\ site5.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
369 http-request set-header Host site5.local
370 balance leastconn
371@@ -221,6 +226,7 @@ backend backend-cached-site6-local
372 server server_1 127.0.0.1:6085 check inter 2s rise 2 fall 60 maxconn 2048
373
374 backend backend-site6-local
375+ option redispatch 1
376 option httpchk HEAD / HTTP/1.0\r\nHost:\ site6.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
377 http-request set-header Host site6.local
378 balance leastconn
379@@ -234,6 +240,7 @@ backend backend-cached-site7-local
380 server server_1 127.0.0.1:6086 check inter 2s rise 2 fall 60 maxconn 2048
381
382 backend backend-site7-local
383+ option redispatch 1
384 option httpchk HEAD / HTTP/1.0\r\nHost:\ site7.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
385 http-request set-header Host site7.local
386 balance leastconn
387@@ -247,12 +254,14 @@ backend backend-cached-site8-local
388 server server_1 127.0.0.1:6087 check inter 2s rise 2 fall 60 maxconn 2048
389
390 backend backend-site8-local
391+ option redispatch 1
392 option httpchk HEAD / HTTP/1.0\r\nHost:\ site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
393 http-request set-header Host site8.local
394 balance leastconn
395 server server_1 127.0.1.10:80 check inter 5s rise 2 fall 5 maxconn 2048
396
397 backend backend-site8-local-2
398+ option redispatch 1
399 option httpchk HEAD / HTTP/1.0\r\nHost:\ auth.site8.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
400 http-request set-header Host auth.site8.local
401 balance leastconn
402@@ -266,6 +275,7 @@ backend backend-cached-site9-local
403 server server_1 127.0.0.1:6088 check inter 2s rise 2 fall 60 maxconn 2048
404
405 backend backend-site9-local
406+ option redispatch 1
407 option httpchk HEAD / HTTP/1.0\r\nHost:\ site9.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
408 http-request set-header Host site9.local
409 balance leastconn
410diff --git a/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt b/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt
411index 5391a03..9c3ead5 100644
412--- a/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt
413+++ b/tests/unit/files/content_cache_rendered_haproxy_test_output_srv_template.txt
414@@ -93,6 +93,7 @@ backend backend-cached-site1-local
415 server server_1 127.0.0.1:6080 check inter 2s rise 2 fall 60 maxconn 2048
416
417 backend backend-site1-local
418+ option redispatch 1
419 option httpchk HEAD / HTTP/1.0\r\nHost:\ site1.local\r\nUser-Agent:\ haproxy/httpchk\r\nCache-Control:\ no-cache
420 http-request set-header Host site1.local
421 balance leastconn
422diff --git a/tests/unit/test_content_cache.py b/tests/unit/test_content_cache.py
423index 1c11a30..ef464aa 100644
424--- a/tests/unit/test_content_cache.py
425+++ b/tests/unit/test_content_cache.py
426@@ -421,6 +421,8 @@ site1.local:
427 /:
428 backend-tls: false
429 backends: ['192.168.1.1:8080']
430+ backend-options:
431+ - retries 3
432 tls-cert-bundle-path: /var/lib/haproxy/certs
433 '''
434 self.mock_config.return_value = {'haproxy_hard_stop_after': '15m', 'max_connections': 8192, 'sites': config}

Subscribers

People subscribed via source and target branches