mohsenasm / swarm-dashboard

A Simple Monitoring Dashboard for Docker Swarm Cluster
MIT License
162 stars 26 forks source link

Expecting VirtualIPs but got Spec #19

Open trajano opened 6 years ago

trajano commented 6 years ago

The server seems to be yielding the following error message

Expecting an object with a field named `VirtualIPs` at _.services[12].Endpoint but instead got: {"Spec":{}}

image

trajano commented 6 years ago

I found that it is because of a specific stack. Here's my config file

version: '3.4'
services:
  forward:
    image: marcnuri/port-forward
    depends_on:
    - consul
    networks:
    - consul
    environment:
    - 'REMOTE_HOST=consul'
    - 'REMOTE_PORT=8500'
    - 'LOCAL_PORT=8500'
    ports:
    - 8500:8500
    deploy:
      replicas: 3
  consul:
    image: consul
    command: agent -server -retry-join=consul -bootstrap-expect=3 -client=0.0.0.0
    networks:
    - consul
    environment:
    - 'CONSUL_BIND_INTERFACE=eth0'
    deploy:
      replicas: 3
      endpoint_mode: dnsrr
networks:
  consul: 
    driver: overlay
    attachable: false
    ipam:
      driver: default
      config:
      - subnet: 172.16.238.0/24

When executed the consul service has _.EndPoint == { Spec {} }

trajano commented 6 years ago

It appears to "work" if I take out endpoint_mode: dnsrr but that would fail consul

anton-johansson commented 6 years ago

I also have this problem. I need dnsrr in one of my containers.

Not sure why the Docker API does not give us information about virtual IPs when we use dnsrr though :S

pablolibo commented 5 years ago

the same issue :(

+1 for @trajano

pablolibo commented 5 years ago

the same issue too

shinybrar commented 5 years ago

+1 @trajano This is still happening.

The error actually happens because of missing arguments in a docker service configuration. You can replicate it by simply executingdocker service inspect SERVICE on a service without certain network configurations.

e.g. If you spawn a service with an overlay network, you get the following configuration output format under Spec --> TaskTemplate --> Endpoint

"Endpoint": {
            "Spec": {
                "Mode": "vip",
                "Ports": [
                    { ... }
                ]
            },
            "Ports": [
                { ... }
            ],
            "VirtualIPs": [
                { ... }
            ]
        }

However, if you have a service with no network configuration you get an output along the lines shown below:

 "Endpoint": {
            "Spec": {}
        }`

This causes the viewer to crash!

@charypar Any idea, if you will get around to fixing this, or can we assume that this project is no longer maintained?