-
Notifications
You must be signed in to change notification settings - Fork 619
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
Refactor urlprefix tags #111
Comments
Each service in Consul is a single ip/port combination so this is really a 1-2-many mapping problem. This one ip/port could be routed differently (in theory) for http, https, wss and tcp. Clearly not all combinations of these make sense but you get the idea. So I suggest 1 tag per protocol with each tag starting with the protocol and then providing the protocol-specific details. For http this would be the hostname/path to be routed, for tcp I assume it would just be the listening port, then followed by generic details such as weighting and logging etc. So you'd have something like:
you could also support mixed protocols such as: If tags can't contain spaces then still best to avoid commas because of how Registrator works. Maybe use something like: |
you could use |
Another approach is to leave the |
Fantastic work on the project @magiconair!
it would be nice if these |
OK, here is what I am going to do: Step 1Add support for
Step 2Add support for multiple tag prefixes to allow migration from
which is equivalent to
which is equivalent to
Maybe step 2 won't be needed but I'd like to add step 1 ASAP to support additional use cases without breaking existing setups. |
Add support for generic 'key=val key=val ...' options after an 'urlprefix-' tag. The parser still needs to be updated to recognize them. This will happen in the next commit.
Add a new route parser which is better structured and less strict on whitespace within commands. It supports the route options which have been added in the previous commit. The old parser is still around but disabled in case I have to switch back quickly. It ignores the options and will be removed in a later commit.
Use the RouteDef struct instead of individual arguments which have the same type.
Add support for generic 'key=val key=val ...' options after an 'urlprefix-' tag. The parser still needs to be updated to recognize them. This will happen in the next commit.
Add a new route parser which is better structured and less strict on whitespace within commands. It supports the route options which have been added in the previous commit. The old parser is still around but disabled in case I have to switch back quickly. It ignores the options and will be removed in a later commit.
Use the RouteDef struct instead of individual arguments which have the same type.
Merged new route parser to master |
The TestParse() function was not testing the old and the new parser but only the new parser. Skipped tests are now also properly reported.
Move the regexp out of the matching functions so that they are compiled only once and during startup and not at runtime.
Merge the TableWeight and TableRoute test since they were doing similar things but in different ways. Use only text routing tables instead of internal structs.
Merge the TableWeight and TableRoute test since they were doing similar things but in different ways. Use only text routing tables instead of internal structs.
The new route parser is in use. Closing. |
Related open issues: #1, #42, #44, #56, #75, #80, #105, #110, #129, #164
Related closed issues: #35, #45, #53, #87, #90, #93, #107
fabio currently uses the
urlprefix-
tag prefix to identify routes. The format is limited to specifying ahost/path
prefix which makes it difficult to allow optional features for a given route. Issue #42 mentions an alternative syntax which provides more options but is still primarily focussed on prefixes.consul issue 1107 mentions a revamp of the API to provide generic KV support for services but doesn't provide a timeline. However, one suggestion is something like RFC 1464 which is used to store arbitrary k/v data in DNS TXT records.
fabio could use this as follows which would provide a generic key/value config mechanism which can also be moved to something else later. Note that RFC 1464 uses the backtick for escaping the
and the backtick itself.
=
,This would allow a generic mechanism to add options to routes and protocols other than HTTP like TCP to be configured properly.
Several design questions come to mind:
uri
attributes in a single tag or as multiple tags?The challenge here would be a length restriction in the tags but we could allow both multiple tags and multiple
uri
attributes to work around this.As part of the URL has the benefit of being familiar but will require duplication if a path should be exposed via HTTP and HTTPS but not WS. Therefore,
uri=host/path proto=http,https
might be more compact.Another approach would be to use JSON but the quoting makes this more difficult.
The text was updated successfully, but these errors were encountered: