Register/Deregister services created by docker service in swarm mode#520
Register/Deregister services created by docker service in swarm mode#520omauger wants to merge 7 commits intogliderlabs:masterfrom
Conversation
|
Seems this PR is inspired by #476. Right? |
| } | ||
| } | ||
|
|
||
| func (b *Bridge) SyncSwarmServices() { |
There was a problem hiding this comment.
Whats the purpose of this function? Why remove already registered services?
|
|
||
| if inside { | ||
| // VIP is global and singleton, so we can use service name as service id | ||
| service.ID = service.Name |
There was a problem hiding this comment.
service.ID has to be in the format HOST_NAME:CONTAINER_NAME:EXPOSED_PORT. Otherwise it will not be cleaned up properly. See https://github.com/alterway/registrator/blob/175e46ca15cc9b9a66ee1e61daa0f49e9b62b090/bridge/bridge.go#L160
| // remove register services doesn't exist in swarm services | ||
| for _, myservice := range myservices { | ||
| for _, tag := range myservice.Tags { | ||
| if tag == "vip-outside" { |
There was a problem hiding this comment.
According to documentation only consul backend support tags currently, so this will not work with other backends.
|
Any update on this PR ? It seems that swarm events are now available as "docker events" per: moby/moby#23827 This feature would be very useful |
|
Supersceded by #588. Thanks for the initial PR though! |
Register services created with docker service command in swarm mode and deregister services if it's deleted. Use same way of containers to configure IP, name and tags.
An improvement will be to register vip service in swarm if we want use internal routing rather than host IP.
I'm a beginner in Golang, don't hesitate to give me corrections instructions.