Remove --port and update --publish for services to support syntaxes#28943
Remove --port and update --publish for services to support syntaxes#28943thaJeztah merged 2 commits intomoby:masterfrom
Conversation
|
Cc @vieux: I'm not sure if you want to take this for 1.13.0. |
cli/command/service/opts.go
Outdated
There was a problem hiding this comment.
No, --port was added in 1.13, and is not present in 1.12
f9ef9e5 to
395d3bf
Compare
|
LGTM |
395d3bf to
0e2bbdd
Compare
mavenugo
left a comment
There was a problem hiding this comment.
Thanks @vdemeester
minor comments on tests. I will try it out and give more comments if any.
opts/port_test.go
Outdated
There was a problem hiding this comment.
Good tests. Can you also pls include a "ingress" mode test ?
There was a problem hiding this comment.
ah you're rihgt, I thought there was one, my bad 😅
opts/port_test.go
Outdated
There was a problem hiding this comment.
Is there a reason to not check for other default states such as Protocol, PublishMode ?
I think it is important to make sure the default protocol (tcp) and publishmode (ingress) are parsed appropriately
There was a problem hiding this comment.
I should have added comment. This one is just about the required field (target here). The default protocol and publish mode are handled server side so the client doesn't send them (that's why the Swarm.PortConfig is that plain).
0e2bbdd to
b7fe613
Compare
|
Thanks @vdemeester LGTM |
|
@vdemeester can you also update the completion scripts? Should we update the changelog as part of this PR as well? (I suggest to add both the "old" and "new" PR as a link); https://github.com/docker/docker/blob/caaa52c124539acb396c0b711ab95bc7ed459540/CHANGELOG.md#L59 |
|
ah right 👼 |
b7fe613 to
6dda197
Compare
|
@thaJeztah updated 👼 |
|
@vdemeester rebase needed :( |
|
Found one issue; if defaults are omitted during publish on port 8080, "ingress" mode change to "host" mode change back to "ingress" mode publish on port 8080, "tcp" (default) change to "udp" change back to "tcp" (default) |
6dda197 to
a05fc7a
Compare
|
So… this is conflicting with #25860 😅 I temporarly disabled the validation and added comment because I'm not sure about what to do… |
|
Please look closely at 9d4aa36 (this fixes @thaJeztah's comment BUT changes a little bit the UX to something that feels more natural). With that commit, /cc @dnephin @thaJeztah @icecrime @mavenugo @aaronlehmann @stevvooe |
ed452c7 to
7332444
Compare
Add support for simple and complex syntax to `--publish` through the use of `PortOpt`. Signed-off-by: Vincent Demeester <[email protected]>
`--publish-add 8081:81 --publish-add 8082:82 --publish-rm 80 --publish-rm 81/tcp --publish-rm 82/tcp` would thus result in 81 and 82 to be published. Signed-off-by: Vincent Demeester <[email protected]>
7332444 to
9d4aa36
Compare
|
Rebased 👼 |
|
Testing my previous examples, I ran into this; adding a port in mode "host" cannot be removed using the "simple" syntax This worked; |
|
@thaJeztah @vdemeester @vieux we need this for 1.13.0 and I think @thaJeztah's UX observation is expected. Do we have any concerns with this PR still to be merged and cherry-picked ? |
|
@mavenugo I'm good with this PR, just wanted confirmation that we agree on the change in behavior, i.e.;
I think this was an oversight in the original implementation, and I cannot think of a practical use of adding a new port and removing it in the same update. Similarly, I cannot think of a case where this would be a real "breaking" change. If we agree on this, I suggest we look at other |
|
@thaJeztah I agree. the current behaviour is more correct than the previous one. |
|
ok, let's go for it 👍 |
Remove --port and update --publish for services to support syntaxes
This is part of #28527 — "The newly introduced
--portflag should likely disappear in favor of--publish, ensuring that the short form maps cleanly to the long form"--port,--port-add,--port-rmflags--publishflag (and--publish-add,--publish-rm), usingPortOptPortOptwith unit tests./cc @thaJeztah @icecrime @dnephin @mavenugo
🐸
Signed-off-by: Vincent Demeester [email protected]