You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log.Fatalf("No sidecar proxy found for service with tag %s", *serviceTag)
Having skipped sidecars (assuming that works, see #7), this code attempts to find the first tag match on an actual service instance. But if it fails it returns an error about not finding the sidecar proxy which is confusing since it might have been there you just skipped it.
I think I understand the intent and it's rely on the existing sidecarFor lookup code copied from Consul (great - was going to recommend that part), but as it is there are a lot of confusing ways this can break:
if there is a proxy registered but no service instance (which is technically valid although not that useful, but in practice can happen transiently due to timing of processes registering).
if there are multiple services registered locally with that tag, it will arbitrarily pick the first one which isn't great UX. Better would be to detect the ambiguity and error in the same way LookupProxyIDForSidecar in the Consul command code does.
I suggest it might be easier if all the lookup stuff was moved out of the /consul package and into the main.go so that you can handle all this resolving stuff in one place and just start the main body of the work with a proxy's ID already resolved or all argument errors already handled with messages that are clear to the user where there is ambiguity.
The text was updated successfully, but these errors were encountered:
Note if this is changed it might make #7 invalid.
haproxy-consul-connect/main.go
Lines 61 to 68 in 55bff42
Having skipped sidecars (assuming that works, see #7), this code attempts to find the first tag match on an actual service instance. But if it fails it returns an error about not finding the sidecar proxy which is confusing since it might have been there you just skipped it.
I think I understand the intent and it's rely on the existing
sidecarFor
lookup code copied from Consul (great - was going to recommend that part), but as it is there are a lot of confusing ways this can break:LookupProxyIDForSidecar
in the Consul command code does.I suggest it might be easier if all the lookup stuff was moved out of the /consul package and into the main.go so that you can handle all this resolving stuff in one place and just start the main body of the work with a proxy's ID already resolved or all argument errors already handled with messages that are clear to the user where there is ambiguity.
The text was updated successfully, but these errors were encountered: