api: additions for host-level port publishing#1645
Conversation
|
And #543 |
|
@aluzzardi I'll work that in when we've decided whether we like this model. The alternative is to define a new |
|
Also #1077 |
api/types.proto
Outdated
|
|
||
| // PortConfigExpositionHost exposes the port on just the target host. | ||
| // If the published port is undefined, an ephemeral port will be | ||
| // allocated. If the published port is defined, the node will attempt |
There was a problem hiding this comment.
Question :
is this task-specific publish-port ?
If it is service-wide publish-port, how can we support multiple tasks on the same host ?
There was a problem hiding this comment.
@mavenugo If the user defines a publish port in host mode, only one instance of the task can run per node. If the user leaves this undefined, each instance will take a new ephemeral port.
There was a problem hiding this comment.
Yes, this is the part we kind of discussed in the meeting and it was felt that the major use case is to have ephemeral port mapping capability as long as it is query-able at the task level from docker api. Later on not sure if these can be tied to a scheduler constraint since the manager would effectively know about all the ports that swarm tasks bind to on any node if some service wants to use a specific port.
|
@stevvooe I think one overall problem with this is that at a port level it is mutually exclusive i.e for a given |
|
@mrjana question on mutual exclusion. What is your suggestion for the user to configure a static |
|
@mavenugo I think this data model separates the "endpoint mode" from how the port is exposed. A port can be declared twice under the same endpoint, both under Let's look at valid configuration where we want to expose the port 8080 under several The above would do the following, by order of flag:
What do we see in Note that these are So, we have two replicas running, across two nodes with ips 192.168.1.20 and 192.168.1.30. We can see the host ports exposed in Implications:
What do we do for docker/docker:
|
api/types.proto
Outdated
| // port is automatically assigned. | ||
| uint32 published_port = 4; | ||
|
|
||
| Exposition exposition = 5; |
There was a problem hiding this comment.
@aaronlehmann @mrjana @aluzzardi @mavenugo @mstanleyjones I really hate this terminology. Calling in the semantic adaptationists.
There was a problem hiding this comment.
PublishMode
PortMode
There was a problem hiding this comment.
Yeah we probably need a better term than Exposition
|
@mavenugo @mrjana In a separate comment, I wanted to show the protobuf of This all sits under the same endpoint specification. |
|
@stevvooe I think I like this model proposal. If we have enough consensus we can get the ball rolling. |
|
@jpetazzo @aluzzardi @joegross @binman-docker Can you guys please chime in on the model/ui/api? Especially this: #1645 (comment) |
|
This looks great, nothing to add re: model/ui/api. Thank you! |
4094758 to
23b3af2
Compare
23b3af2 to
42596b6
Compare
Current coverage is 57.18% (diff: 100%)@@ master #1645 diff @@
==========================================
Files 91 91
Lines 14724 14724
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
- Hits 8443 8420 -23
- Misses 5183 5209 +26
+ Partials 1098 1095 -3
|
api/types.proto
Outdated
| option (gogoproto.goproto_enum_prefix) = false; | ||
|
|
||
| // PublishModeIngress exposes the port across the cluster on all nodes. | ||
| PUBLISH_INGRESS = 0 [(gogoproto.enumvalue_customname) = "PublishModeIngress"]; |
42596b6 to
048ede4
Compare
|
Minor nit LGTM |
@dperny is working on a PR to add an address into the Also - beside this change, there's going to be a need to surface dynamically bound ports into the TaskStatus (so you can figure out which port was bound - basically the port part of This has been spec'ed in the past and I think you can just reuse this: https://github.com/docker/swarmkit/pull/550/files @stevvooe Still okay with that PR from May? In the end, retrieving |
|
@aluzzardi The PR from May looks fine, but we may want to define a |
To allow exposing ports on the host to which a task is scheduled, we have introduced the concept of an publish mode parameter to the PortConfig. The default, ingress, works as it does today. The new mode, host, will bind the port to the host's port space, optimistically deferring allocation to the target node. Signed-off-by: Stephen J Day <stephen.day@docker.com>
048ede4 to
b2f4cd0
Compare
|
@stevvooe Can we add the |
|
Ok then let @mrjana take care of it 😉 |
To allow exposing ports on the host to which a task is scheduled, we
have introduced the concept of an publish mode parameter to the
PortConfig. The default, ingress, works as it does today. The new mode,
host, will bind the port to the host's port space, optimistically
deferring allocation to the target node.
Signed-off-by: Stephen J Day stephen.day@docker.com
cc @mrjana @aluzzardi @mavenugo