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

Consul Catalog constraints does not seem to work #954

Closed
leowmjw opened this issue Dec 9, 2016 · 3 comments
Closed

Consul Catalog constraints does not seem to work #954

leowmjw opened this issue Dec 9, 2016 · 3 comments

Comments

@leowmjw
Copy link

leowmjw commented Dec 9, 2016

Using latest traefik; and frontend Rules are working; hooked up automatically via tagging as per below via Nomad scheduler.

...
        tags = [
                "traefik.tag=blue",
                "traefik.frontend.rule=Host:www.10.0.2.5.xip.io;Path:/whoami",
                "traefik.frontend.entryPoints=http"
        ]
...

However, when running with simple constraints; it does not seem to work (everything is pruned).

sudo ./traefik  --constraints="tag==blue" --debug

Debug log:

...
DEBU[2016-12-09T13:01:31Z] Service global-whoami pruned by 'tag==blue' constraint 
DEBU[2016-12-09T13:01:31Z] Service global-whoami pruned by 'tag==blue' constraint 
DEBU[2016-12-09T13:01:31Z] Service global-whoami pruned by 'tag==blue' constraint 
DEBU[2016-12-09T13:01:31Z] Service global-whoami pruned by 'tag==blue' constraint 
DEBU[2016-12-09T13:01:31Z] Service global-whoami pruned by 'tag==blue' constraint 
...
@freefood89
Copy link

freefood89 commented Dec 13, 2016

Try changing "traefik.tag=blue" to "traefik.tags=blue"

You can add more tags: "traefik.tags=blue,external,lolcats"

@leowmjw
Copy link
Author

leowmjw commented Dec 14, 2016

@freefood89 Thanks; it works! For reference, the below setup works for me:

Only route to containers tagged 'lolcats':

sudo ./traefik  --constraints="tag==lolcats"

Jobs with multiple traefik.tags (including the 'lolcats' tag):

...
        tags = [
                "traefik.tags=blue,lolcats",
                "traefik.frontend.rule=Host:www.10.0.2.5.xip.io;Path:/whoami",
                "traefik.frontend.entryPoints=http"
        ]
..

@leowmjw leowmjw closed this as completed Dec 14, 2016
@kostyrev
Copy link

@freefood89 from docs it's not very evident that traefik will only parse consul tags that start with traefik.tags=, e.g.

{
    "services": [
        {
            "name": "web-srv", 
            "port": 8080, 
            "tags": [
                "traefik.tags=trk"
            ]
        }
    ]
}

it will be more user-friendly if traefik consumes ordinary consul tags, e.g

{
    "services": [
        {
            "name": "web-srv", 
            "port": 8080, 
            "tags": [
                "trk"
            ]
        }
    ]
}

as shown in consul docs

@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