make task-name as an net-alias to the backing container#24973
make task-name as an net-alias to the backing container#24973mavenugo wants to merge 1 commit intomoby:masterfrom
Conversation
|
ping @tiborvass @thaJeztah . Do you think this is a useful thing to have ? I could not decide it myself if it is useful for 1.12 or nice to have.... |
|
So, for reference; given a service Individual task-containers can currently be discovered by their full (container) name (e.g. Without this change, I think the only way to find the container that's related to a task is to It's related to #24241, however, so the same concern could be raised #24241 (comment), so: ping @aluzzardi @dnephin @stevvooe PTAL |
|
Added to the milestone to make it easier to track, but we can move it or close it depending on what we think is best |
|
Oh, this fixes #24466, so added that to the description; and contains a use-case / more background |
There was a problem hiding this comment.
Minor nit:
return fmt.Sprintf("%s.%d", c.task.ServiceAnnotations.Name, c.task.Slot)would make this a little more obvious
|
Providing the task short id as a discoverable alias sounds good to me. In the case where a name is set, could we still add the |
This will help with resolving DNS names using task-name Signed-off-by: Madhu Venugopal <[email protected]>
|
@dnephin @thaJeztah addressed your comments. PTAL. |
|
LGTM /cc-ing @sfsmithcha in case we want to document this somewhere (although I'm not sure where directly) |
| // fallback to service.slot.id. | ||
| return strings.Join([]string{c.task.ServiceAnnotations.Name, fmt.Sprint(c.task.Slot), c.task.ID}, ".") | ||
| // fallback to service.slot.id | ||
| return fmt.Sprintf("%s.%s", c.shortName(), c.task.ID) |
There was a problem hiding this comment.
Sorry, I think my comment was misleading. Wont this use a name of service.slot.taskid ?
There was a problem hiding this comment.
I was thinking that every task would get the following aliases:
- container id
- task name (service.slot)
(as well as the service name which is load balanced)
There was a problem hiding this comment.
@dnephin you are looking at name() which is infact service.slot.taskid. whereas the shortName is service.slot which is the task-name and it is used as an net-alias.
In short, yes a container will have container-id and task-name as net-aliases. Ofcourse service-name is used for load-balancing.
|
@mavenugo Isn't this using a completely different method for generating the DNS name? Should we not have this all in the same place? What are the other projections of task into the dns space? |
|
Also, how are aliases on the network attachment propagated? |
|
@stevvooe Sorry. I dont quite get your comment. The only addition that this change brings in is the additional dns entry for a container with the task-name. So with this change, a container can be reached by its
container-name is the primary DNS entry for the container. |
|
@stevvooe the aliases are propagated the exact same way all other names are propagated (via Gossip SD mechanism). |
|
If this needs more discussions, we can consider it for later releases. I dont see this as mandatory for 1.12.0 release. |
|
Removing from the milestone, setting to design review. |
|
This feature is useful, if you have to create your own Loadbalancer service (with different balancing strategies than swarm provides) and need to know the backend tasks. At first I thought, that Example: you start with 3 replicas. So you get In my current project https://github.com/toughIQ/docker-maxscale I used the dnsRR (by now undocumented feature) results of |
|
@toughIQ For something like that, I'd really like to see something like In general, it is not critical that the load balancer is always synced with the current number of tasks if the load balancer is health checking backends. Even in the case where there replica holes, the load balancer will be able to work out which ones are up. The other option here would be to have it consume scaling events. |
|
@mavenugo To be compatible with the hierarchy we've been discussing, these really need to be the other way around:
taskid.slot.service
slot.service
container-id.service
service.namespace.cluster This will allow us to combine DNS spaces in the future in interesting ways. |
|
@stevvooe can you open a separate issue for that for discussion? Also; can we make that change after 1.12 without breaking backward compatibility? |
|
@thaJeztah Filed moby/swarmkit#1242. |
|
Not sure how useful this would be without having some way to discover how many slots there are. |
|
This change would help dockerize apps that cluster themselves together, such as Zookeeper. With the current version of Zookeeper, you need to specify other servers in the cluster for it to connect to. With this change you could have the following in the zoo.cfg: |
|
@mavenugo @youngnicks We are looking at a comprehensive solution here. These use cases are a particular pain point and we need to address them. |
|
@thaJeztah Until there is an actual plan here, we should not be changing the service mapping into DNS. |
|
ping @thaJeztah @mavenugo @stevvooe Should this be closed and the discussion moved to #27080 until a decision is made? |
|
@mavenugo This needs a proposal around moby/swarmkit#1242. We can't keep adding bespoke DNS entries without documenting their guarantees. For example, I've see slots proposed as a method of identifying instances consistently, but we need to make sure that slots have the right guarantees for that to work and we comfortable supporting that. I'm not wholly opposed to this addition, so I don't think we need to close this, but we do need to have a real plan for DNS-based service discovery. |
|
apologies on the delay. Yes, I agree that we should have a complete proposal on this. lets continue the discussion in moby/swarmkit#1242. |
|
@mavenugo can we close this? We have too many PRs now :) |
|
@LK4D4 yes... closing this. |
|
This sounds very useful, as mentioned, for mapping in external service load balancers. |
fixes #24466
This will help with resolving DNS names using task-name
Signed-off-by: Madhu Venugopal [email protected]