hashicorp / hashicorp/consul

Cannot start sidecar proxy if the -sidecar-for has capital letters exactly matching the proxying service id

Open
#6,765 2 comments 0 reactions 0 assignees View on GitHub
needs-investigation
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Overview of the Issue

Cannot start sidecar proxy if the `-sidecar-for` has capital letters exactly matching the proxying service id

#### Reproduction Steps

1. Register a service on consul agent with following service config :
```
{
"services": [
{
"id": "Service_A",
"name": "Service_A",
"port": 80,
"connect": {
"sidecar_service": {
"proxy": {
"upstreams": [
{
"destination_name": "service_x",
"local_bind_port": 11000
}
]
}
}
}
}
]
}
```
2. Run `consul connect proxy -sidecar-for Service_A` will fail
3. Run `consul connect proxy -sidecar-for service_a` will be successful

#### Probable Root Cause
The code does strings.ToLower before comparing with `-sidecar-for` value : https://github.com/hashicorp/consul/blob/master/command/connect/proxy/proxy.go#L230

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.