Support invalid HTTPRoute status
Co-authored-by: Romain <rtribotte@users.noreply.github.com>
This commit is contained in:
parent
7fdb1ff8af
commit
0e215f9b61
7 changed files with 361 additions and 297 deletions
|
@ -222,6 +222,14 @@ func (m *Manager) getWRRServiceHandler(ctx context.Context, serviceName string,
|
|||
|
||||
balancer := wrr.New(config.Sticky, config.HealthCheck != nil)
|
||||
for _, service := range shuffle(config.Services, m.rand) {
|
||||
if service.Status != nil {
|
||||
serviceHandler := http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.WriteHeader(*service.Status)
|
||||
})
|
||||
balancer.Add(service.Name, serviceHandler, service.Weight)
|
||||
continue
|
||||
}
|
||||
|
||||
serviceHandler, err := m.BuildHTTP(ctx, service.Name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue