Traefik: Frontend rules are not updated based on priorities for identical rules.

Created on 18 Jul 2017  路  3Comments  路  Source: traefik/traefik

Do you want to request a feature or report a bug?

bug

What did you do?

I am creating a series of containers that have the same frontend.rule and would like the highest frontend.priority to dictate the route.

sudo docker service create \
  --name hello-world-A \
  --network mynetwork \
  --publish :80 \
  --label traefik.protocol=http \
  --label traefik.port=80 \
  --label traefik.frontend.rule="Host:helloworld.com" \
  --label traefik.frontend.priority=1707180001 \
  --label traefik.docker.network=mynetwork \
  localhost:5000/hello-world-nginx:170718a

sudo docker service create \
  --name hello-world-B \
  --network mynetwork \
  --publish :80 \
  --label traefik.protocol=http \
  --label traefik.port=80 \
  --label traefik.frontend.rule="Host:helloworld.com" \
  --label traefik.frontend.priority=1707180002 \
  --label traefik.docker.network=mynetwork \
  localhost:5000/hello-world-nginx:170718b

When created simultaneously, Traefik routes to hello-world-B properly.

sudo docker service create \
  --name hello-world-C \
  --network mynetwork \
  --publish :80 \
  --label traefik.protocol=http \
  --label traefik.port=80 \
  --label traefik.frontend.rule="Host:helloworld.com" \
  --label traefik.frontend.priority=1707180003 \
  --label traefik.docker.network=mynetwork \
  localhost:5000/hello-world-nginx:170718c

Later, adding a service with the same frontend.rule and incremented frontend.priority it does not register (i.e. hello-world-B stays live).

hello-world-C will appear if hello-world-A and hello-world-B are removed.

(Also, a nice to have would be is to display all identical rules that are overridden via the UI/API. )

Output of traefik version: (_What version of Traefik are you using?_)

Version:      v1.3.1
Codename:     raclette
Go version:   go1.8.3
Built:        2017-06-16_11:21:48AM
OS/Arch:      linux/amd64
arerules kinbuconfirmed statu5-frozen-due-to-age

Most helpful comment

Discussed with @ewah on slack, and it appears that only one frontend gets created:

2017-07-18T22:29:52.168262986Z time="2017-07-18T22:29:52Z" level=debug msg="Configuration received from provider docker: {"backends":{"backend-hello-world-A":{"servers":{"server-hello-world-A-1":{"url":"http://10.0.0.5:80","weight":0}},"loadBalancer":{"method":"wrr"}},"backend-hello-world-B":{"servers":{"server-hello-world-B-1":{"url":"http://10.0.0.7:80","weight":0}},"loadBalancer":{"method":"wrr"}},"backend-hello-world-C":{"servers":{"server-hello-world-C-1":{"url":"http://10.0.0.9:80","weight":0}},"loadBalancer":{"method":"wrr"}}},"frontends":{"frontend-Host-helloworld-com":{"entryPoints":["http","https"],"backend":"backend-hello-world-A","routes":{"route-frontend-Host-helloworld-com":{"rule":"Host:helloworld.com"}},"passHostHeader":true,"priority":1707180001,"basicAuth":[]}}}"

However, it also appears that the frontend name is only generated with the frontend rule, without any container name information.

All 3 comments

Discussed with @ewah on slack, and it appears that only one frontend gets created:

2017-07-18T22:29:52.168262986Z time="2017-07-18T22:29:52Z" level=debug msg="Configuration received from provider docker: {"backends":{"backend-hello-world-A":{"servers":{"server-hello-world-A-1":{"url":"http://10.0.0.5:80","weight":0}},"loadBalancer":{"method":"wrr"}},"backend-hello-world-B":{"servers":{"server-hello-world-B-1":{"url":"http://10.0.0.7:80","weight":0}},"loadBalancer":{"method":"wrr"}},"backend-hello-world-C":{"servers":{"server-hello-world-C-1":{"url":"http://10.0.0.9:80","weight":0}},"loadBalancer":{"method":"wrr"}}},"frontends":{"frontend-Host-helloworld-com":{"entryPoints":["http","https"],"backend":"backend-hello-world-A","routes":{"route-frontend-Host-helloworld-com":{"rule":"Host:helloworld.com"}},"passHostHeader":true,"priority":1707180001,"basicAuth":[]}}}"

However, it also appears that the frontend name is only generated with the frontend rule, without any container name information.

Related to #1663

Now that we have segments, and hashed backends/and better frontend naming schemes, this should no longer be an issue.

Due to this, I will go ahead and close this issue.

If you have any further concerns, feel free to open a new issue.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rogeriollacerda picture rogeriollacerda  路  3Comments

OndroNR picture OndroNR  路  3Comments

mikaelmorvan picture mikaelmorvan  路  3Comments

leowmjw picture leowmjw  路  3Comments

saschagrunert picture saschagrunert  路  3Comments