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

Constraints on Consul Catalog not working as expected #703

Closed
ummecasino opened this issue Sep 29, 2016 · 2 comments
Closed

Constraints on Consul Catalog not working as expected #703

ummecasino opened this issue Sep 29, 2016 · 2 comments

Comments

@ummecasino
Copy link

ummecasino commented Sep 29, 2016

Hey guys,

I'm currently switching from reverse proxying with Nginx/consul-template to Traefik. I'm facing some problems with seperating different environments in Consul by different tags as I used to with consul-template.
I got 2 environments managed by the same consul instance, so I got service A deployed on environment QA and integration visible as Consul service.

[
    {
        "Address": "10.32.108.37",
        "CreateIndex": 28,
        "ModifyIndex": 4992,
        "Node": "int02",
        "ServiceAddress": "10.32.108.37",
        "ServiceEnableTagOverride": false,
        "ServiceID": "int02:mesos-20160919:80",
        "ServiceName": "tracking",
        "ServicePort": 31440,
        "ServiceTags": [
            "integration"
        ],
        "TaggedAddresses": {
            "lan": "10.32.108.37",
            "wan": "10.32.108.37"
        }
    },
    {
        "Address": "10.32.108.33",
        "CreateIndex": 2463,
        "ModifyIndex": 5045,
        "Node": "test01",
        "ServiceAddress": "10.32.108.33",
        "ServiceEnableTagOverride": false,
        "ServiceID": "test01:mesos-20160919:80",
        "ServiceName": "tracking",
        "ServicePort": 31276,
        "ServiceTags": [
            "traefik.tags=testenv",
            "test",
            "traefik.frontend.rule=PathPrefix:/tracking;PathPrefixStrip:/tracking"
        ],
        "TaggedAddresses": {
            "lan": "10.32.108.33",
            "wan": "10.32.108.33"
        }
    }
]

You see both services got different tags. I set up my Traefik instance with

[consulCatalog]
  endpoint = "127.0.0.1:8500"
  watch = true
  constraints = ["tag==testenv"]

and would expect just to see the second service instance in Traefik but I still see all my services known to consul including the first service shown here.
Am I wrong? What would I have to do to make all services by an environment routable by just the corresponding Traefik instance on that environment?

screen shot 2016-09-29 at 15 58 32

@ummecasino
Copy link
Author

Figured it out thanks to #451, the solution is to put it like:

  [[consulCatalog.constraints]]
    key = "tag"
    mustmatch = true
    regex = "testenv"

@emilevauge
Copy link
Member

@ummecasino constraints have been fixed in v1.1.0-rc1, you should now be able to write constraints = ["tag==testenv"] directly ;)

@ldez ldez changed the title Constraints on Consul Catalogue not working as expected Constraints on Consul Catalog not working as expected Feb 15, 2018
ibuziuk added a commit to ibuziuk/fabric8-oso-proxy that referenced this issue Nov 27, 2018
…ry parameter

Signed-off-by: Ilya Buziuk <ibuziuk@redhat.com>
nurali-techie pushed a commit to fabric8-services/fabric8-oso-proxy that referenced this issue Nov 28, 2018
…ry parameter (#44)

Signed-off-by: Ilya Buziuk <ibuziuk@redhat.com>
@traefik traefik locked and limited conversation to collaborators Sep 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants