Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
and we wind up with envoy spitting out tcp/http mismatch protocol errors (due to the compiled discovery chain thinking that the referenced, non-existent splitter should be treated as a TCP-resolver discovery node).
Reproduction Steps
Create and attach an HTTPRoute with referencing two services in a routing rule where each has 0 weight, such as:
Rules = [
{
Services = [
{
Name = "service-one"
},
{
Name = "service-two"
}
]
}
]
Attach to a gateway and watch Consul logs for protocol mismatch errors.
This should be fixed in two ways:
We should normalize to, Weight = 1, and
We shouldn't add a route to the router if no corresponding splitter was added.
Overview of the Issue
Two issues we have with HTTPRoute services is that we:
https://github.com/hashicorp/consul/blob/73b9b407ba357f99cd02b5387fa15e159ab24327/agent/consul/discoverychain/gateway_httproute.go#L131-L133
we can potentially wind up with no service splits (if we have no services with non-zero weight), and we fail to append a corresponding splitter here:
https://github.com/hashicorp/consul/blob/73b9b407ba357f99cd02b5387fa15e159ab24327/agent/consul/discoverychain/gateway_httproute.go#L156-L158
that winds up with our synthetic router referencing a service route for a splitter that doesn't exist:
https://github.com/hashicorp/consul/blob/73b9b407ba357f99cd02b5387fa15e159ab24327/agent/consul/discoverychain/gateway_httproute.go#L168-L171
and we wind up with envoy spitting out tcp/http mismatch protocol errors (due to the compiled discovery chain thinking that the referenced, non-existent splitter should be treated as a TCP-resolver discovery node).
Reproduction Steps
Create and attach an HTTPRoute with referencing two services in a routing rule where each has 0 weight, such as:
Attach to a gateway and watch Consul logs for protocol mismatch errors.
This should be fixed in two ways:
Weight = 1
, and