docker-flow / docker-flow-proxy

Docker Flow Proxy
https://docker-flow.github.io/docker-flow-proxy/
MIT License
317 stars 189 forks source link

Two swarm services, one serviceName #80

Closed rvega-arg closed 5 years ago

rvega-arg commented 5 years ago

Description

I'm trying to implement a canary deploy strategy in my docker swarm. I want to create a secondary service and route traffic from the main service using weights. However in swarm mode, docker-flow-proxy is not using the serviceName label, instead is always using the service name provided in the stack file.

Steps to reproduce the issue: stack.yaml:

version: "3.5"
services:
  proxy:
    image: dockerflow/docker-flow-proxy
    ports:
      - 80:80
      - 443:443
    networks:
      - proxy
    environment:
      - LISTENER_ADDRESS=swarm-listener
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]

  swarm-listener:
    image: dockerflow/docker-flow-swarm-listener
    ports:
      - 8080:8080
    networks:
      - proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DF_NOTIFY_CREATE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/reconfigure
      - DF_NOTIFY_REMOVE_SERVICE_URL=http://proxy:8080/v1/docker-flow-proxy/remove
    deploy:
      mode: global
      placement:
        constraints: [node.role == manager]

  whoami:
      image: jwilder/whoami:latest
      networks:
        - proxy
      ports:
        - 8000:8000
      deploy:
        mode: replicated
        replicas: 2
        labels:
          - com.df.notify=true
          - com.df.port=80
          - com.df.serviceName=whoami
          - com.df.srcPort=8000

  whoami-canary:
      image: jwilder/whoami:latest
      networks:
        - proxy
      ports:
      - 8001:8000
      deploy:
        mode: replicated
        replicas: 1
        labels:
          - com.df.notify=true
          - com.df.port=80
          - com.df.serviceName=whoami
          - com.df.srcPort=8001
networks:
  proxy:
    driver: overlay

Describe the results you received: I get two services with no balancers working.

Describe the results you expected: I expect get one balancer sending request to both services.

Is there any way i can achieve the expected deployment?

thomasjpfan commented 5 years ago

Current DFP does not support this use case.