fabio
fabio copied to clipboard
Add `only=` tag
The new tag only=
allows the user to have more granular control over which checked services
get added to the routing table.
Example: Nomad publishes service checks for the HTTP, RPC, and Serf services to consul. Registering the tag below results in a routing table that splits requests for nomad.service.example.com between the three different protocols.
Service Tag
"urlprefix-nomad.service.example.com:443/ proto=https tlsskipverify=true"
Resulting Routing Table Entries
nomad nomad.service.example.com:443/ https://172.16.1.8:4646 tlsskipverify=true 33%
nomad nomad.service.example.com:443/ https://172.16.1.8:4647 tlsskipverify=true 33%
nomad nomad.service.example.com:443/ https://172.16.1.8:4648 tlsskipverify=true 33%
Since we really only want to route the HTTP traffic, this commit allows you to use the rule below to only generate a single routing table entry based on the port number associated with our HTTP port.
Service Tag
"urlprefix-nomad-0.service.example.com:443/ proto=https only=4646 tlsskipverify=true"
Resulting Routing Table Entries
nomad nomad.service.example.com:443/ https://172.16.1.8:4646 tlsskipverify=true 100.00%
@nathanejohnson Sorry, I had signed the CLA but had accidentally messed up the email address in one of the commits so it wasn't registering. Went ahead and squashed everything down to 1 commit and re-signed the CLA so it should be good now.
@rigrassm tentatively this looks good, could you add a test case in routecmd_test.go to cover this option. Now the interesting part here is this means consul registry will have a route option that doesn't exist otherwise. On the other hand, filtering doesn't make much sense in other cases. I went looking for documentation specific to consul tags and it's not really there other than a brief mention in the Quickstart. I would have asked you to update that documentation, but since it doesn't exist I'll make it a point to create that page and roll it out with the next release.
TLDR; add a test case and I'll merge this.