Scalingo / link

LinK is not Keepalived - Virtual IP manager backed by etcd
MIT License
40 stars 6 forks source link

Error: IP already assigned #191

Closed jdmedeiros closed 1 year ago

jdmedeiros commented 1 year ago

I installed LinK on 3 devices. On all 3 devices I have etcd working perfectly and on each device I run LinK:

image

On device 1 I run:

./link-client --user link --password Passw0rd add 172.31.56.111/32

and I get:

image

On device 2 I run the same command and I get:

Error: IP already assigned

Must be missing something. This is a very interesting concept, hence I would like to get it to work.

Error: IP already assigned

EtienneM commented 1 year ago

I currently fail to reproduce the problem you have here. Here is the steps I did to try to reproduce your problem:

  1. Start LinK on my local work station:
    docker compose up
  2. Add an IP to a first LinK agent:
    link-client --host localhost:1313 -u link -p password add 172.31.56.111/32
    link-client --host localhost:1313 -u link -p password list                
    +------------------------------------------+------------------+-----------+--------+
    |                    ID                    |        IP        |  STATUS   | CHECKS |
    +------------------------------------------+------------------+-----------+--------+
    | vip-5dc626b6-8faf-415d-ab68-fffed7fdb73b | 172.31.56.111/32 | ACTIVATED | None   |
    +------------------------------------------+------------------+-----------+--------+
  3. Add the same IP to a second LinK agent:
    link-client --host localhost:1314 -u link -p password add 172.31.56.111/32
    link-client --host localhost:1313 -u link -p password list
    +------------------------------------------+------------------+-----------+--------+
    |                    ID                    |        IP        |  STATUS   | CHECKS |
    +------------------------------------------+------------------+-----------+--------+
    | vip-5dc626b6-8faf-415d-ab68-fffed7fdb73b | 172.31.56.111/32 | ACTIVATED | None   |
    +------------------------------------------+------------------+-----------+--------+
    link-client --host localhost:1314 -u link -p password list               
    +------------------------------------------+------------------+---------+--------+
    |                    ID                    |        IP        | STATUS  | CHECKS |
    +------------------------------------------+------------------+---------+--------+
    | vip-8a913cbf-003d-4aca-8ea0-70745cd2ced8 | 172.31.56.111/32 | STANDBY | None   |
    +------------------------------------------+------------------+---------+--------+

I understand this is not exactly the setup you have but that may be a way for you to investigate, by comparing the local configuration and the one you have on your servers.

The error "IP already assigned" is returned here:

https://github.com/Scalingo/link/blob/e99441bea7ba1dd8ed0b79a9f26d970bf1b56bd3/scheduler/scheduler.go#L74-L81

Are you sure your call to link-client to add the IP to a second agent targets the intended agent? Maybe explicit the agent to target with--host?