Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow uppercase in proxy launch -sidecar-for arg #14034

Merged
merged 1 commit into from
Aug 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/14034.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cli: When launching a sidecar proxy with `consul connect envoy` or `consul connect proxy`, the `-sidecar-for` service ID argument is now treated as case-insensitive.
```
2 changes: 1 addition & 1 deletion command/connect/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func LookupProxyIDForSidecar(client *api.Client, sidecarFor string) (string, err
var proxyIDs []string
for _, svc := range svcs {
if svc.Kind == api.ServiceKindConnectProxy && svc.Proxy != nil &&
strings.ToLower(svc.Proxy.DestinationServiceID) == sidecarFor {
strings.EqualFold(svc.Proxy.DestinationServiceID, sidecarFor) {
proxyIDs = append(proxyIDs, svc.ID)
}
}
Expand Down
11 changes: 11 additions & 0 deletions command/connect/proxy/proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ func TestCommandConfigWatcher(t *testing.T) {
require.Equal(t, 9999, cfg.PublicListener.BindPort)
},
},

{
Name: "-sidecar-for, one sidecar case-insensitive",
Flags: []string{
"-sidecar-for", "One-SideCar",
},
Test: func(t *testing.T, cfg *proxy.Config) {
// Sanity check we got the right instance.
require.Equal(t, 9999, cfg.PublicListener.BindPort)
},
},
}

for _, tc := range cases {
Expand Down