Service defaults `MaxFailures` accepts negative numbers
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 39
Description
#### Overview of the Issue
`MaxFailures` can be set to a negative integer but it will be converted to an unsigned integer when sent to Envoy.
```hcl
Kind = "service-defaults"
Name = "frontend"
Protocol = "http"
UpstreamConfig {
Defaults {
PassiveHealthCheck {
MaxFailures = -1
}
}
}
```
```console
curl -s localhost:19000/config_dump?format=json | grep -A 2 outlier
"outlier_detection": {
"consecutive_5xx": 4294967295
},
```
### Thoughts
On the one hand, it's doing what I want, which is to essentially disable passive health checking. On the other hand, it seems kinda not good that we're just converting it into an unsigned int.
Maybe we could have `-1` mean "disable outlier detection" and anything other than that throw an error?
### Consul info for both Client and Server
Consul 1.10.3
Contributor guide
Research direction
Start by tracing validation and Envoy conversion for the service-defaults path `UpstreamConfig.Defaults.PassiveHealthCheck.MaxFailures`, then reproduce the negative-value behavior shown by the `/config_dump?format=json` command. Confirm the intended handling of `-1` and other negative values with maintainers; done should include explicit behavior and coverage for the selected validation or conversion outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100