@@ -288,7 +288,8 @@ backend be_edge_http_{{$cfgIdx}}
288
288
{{ end }}
289
289
http-request set-header Forwarded for=%[src];host=%[req.hdr(host)];proto=%[req.hdr(X-Forwarded-Proto)]
290
290
{{ range $serviceUnitName, $weight := $cfg.ServiceUnitNames }}
291
- {{ with $serviceUnit := index $.ServiceUnits $serviceUnitName }}
291
+ {{ if ne $weight 0 }}
292
+ {{ with $serviceUnit := index $.ServiceUnits $serviceUnitName }}
292
293
{{ range $idx, $endpoint := endpointsForAlias $cfg $serviceUnit }}
293
294
{{ with $healthIntv := index $cfg.Annotations "router.openshift.io/haproxy.health.check.interval" }}
294
295
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" $healthIntv) }}
@@ -304,7 +305,8 @@ backend be_edge_http_{{$cfgIdx}}
304
305
{{ end }}
305
306
{{ end }}
306
307
{{ end }}
307
- {{ end }}
308
+ {{ end }}
309
+ {{ end }}{{/* end if weight != 0 */}}
308
310
{{ end }}{{/* end iterate over services */}}
309
311
{{ end }}{{/* end if tls==edge/none */}}
310
312
@@ -329,8 +331,9 @@ backend be_tcp_{{$cfgIdx}}
329
331
hash-type consistent
330
332
timeout check 5000ms
331
333
{{ range $serviceUnitName, $weight := $cfg.ServiceUnitNames }}
332
- {{ with $serviceUnit := index $.ServiceUnits $serviceUnitName }}
333
- {{ range $idx, $endpoint := endpointsForAlias $cfg $serviceUnit }}
334
+ {{ if ne $weight 0 }}
335
+ {{ with $serviceUnit := index $.ServiceUnits $serviceUnitName }}
336
+ {{ range $idx, $endpoint := endpointsForAlias $cfg $serviceUnit }}
334
337
{{ with $healthIntv := index $cfg.Annotations "router.openshift.io/haproxy.health.check.interval" }}
335
338
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" $healthIntv) }}
336
339
server {{$endpoint.IdHash}} {{$endpoint.IP}}:{{$endpoint.Port}} check inter {{$healthIntv}} weight {{$weight}}
@@ -344,8 +347,9 @@ backend be_tcp_{{$cfgIdx}}
344
347
server {{$endpoint.IdHash}} {{$endpoint.IP}}:{{$endpoint.Port}} check inter 5000ms weight {{$weight}}
345
348
{{ end }}
346
349
{{ end }}
347
- {{ end }}
348
- {{ end }}
350
+ {{ end }}{{/* end range endpointsForAlias */}}
351
+ {{ end }}{{/* end get ServiceUnit from serviceUnitName */}}
352
+ {{ end }}{{/* end if weight != 0 */}}
349
353
{{ end }}{{/* end iterate over services*/}}
350
354
{{ end }}{{/*end tls==passthrough*/}}
351
355
@@ -375,8 +379,9 @@ backend be_secure_{{$cfgIdx}}
375
379
http-request set-header Forwarded for=%[src];host=%[req.hdr(host)];proto=%[req.hdr(X-Forwarded-Proto)]
376
380
cookie {{$cfg.RoutingKeyName}} insert indirect nocache httponly secure
377
381
{{ range $serviceUnitName, $weight := $cfg.ServiceUnitNames }}
378
- {{ with $serviceUnit := index $.ServiceUnits $serviceUnitName }}
379
- {{ range $idx, $endpoint := endpointsForAlias $cfg $serviceUnit }}
382
+ {{ if ne $weight 0 }}
383
+ {{ with $serviceUnit := index $.ServiceUnits $serviceUnitName }}
384
+ {{ range $idx, $endpoint := endpointsForAlias $cfg $serviceUnit }}
380
385
{{ with $healthIntv := index $cfg.Annotations "router.openshift.io/haproxy.health.check.interval" }}
381
386
{{ if (matchPattern "[1-9][0-9]*(us|ms|s|m|h|d)?" $healthIntv) }}
382
387
server {{$endpoint.IdHash}} {{$endpoint.IP}}:{{$endpoint.Port}} ssl check inter {{$healthIntv}} verify required ca-file {{ $workingDir }}/cacerts/{{$cfgIdx}}.pem cookie {{$endpoint.IdHash}} weight {{$weight}}
@@ -389,10 +394,11 @@ backend be_secure_{{$cfgIdx}}
389
394
{{ else }}
390
395
server {{$endpoint.IdHash}} {{$endpoint.IP}}:{{$endpoint.Port}} ssl check inter 5000ms verify required ca-file {{$workingDir}}/cacerts/{{$cfgIdx}}.pem cookie {{$endpoint.IdHash}} weight {{$weight}}
391
396
{{ end }}
392
- {{ end }}
393
- {{ end }}
394
- {{ end }}
395
- {{ end }}
397
+ {{ end }}{{/* end get health interval annotation */}}
398
+ {{ end }}{{/* end range endpointsForAlias */}}
399
+ {{ end }}{{/* end get serviceUnit from its name */}}
400
+ {{ end }}{{/* end if weight != 0 */}}
401
+ {{ end }}{{/* end range over serviceUnitNames */}}
396
402
{{ end }}{{/* end tls==reencrypt */}}
397
403
{{ end }}{{/* end loop over routes */}}
398
404
{{ end }}{{/* end haproxy config template */}}
0 commit comments