-
Notifications
You must be signed in to change notification settings - Fork 910
Register/Deregister services created by docker service in swarm mode #520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Seems this PR is inspired by #476. Right? |
| } | ||
| } | ||
|
|
||
| func (b *Bridge) SyncSwarmServices() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.