Add --stop-signal for service create and service update#30754
Add --stop-signal for service create and service update#30754thaJeztah merged 1 commit intomoby:masterfrom
--stop-signal for service create and service update#30754Conversation
|
I think this needs some validation of |
|
Design LGTM, @aaronlehmann not sure how much validation we should do, or leave it to Linux? |
|
@yongtang I think we can do |
|
@thaJeztah: I think |
8904480 to
dca6c92
Compare
|
Thanks @aaronlehmann @thaJeztah for the review. The PR has been updated. Now the signal is validated in For That might be an issue to define it in protobuf. I will take a look and see how to solve it. |
|
For --stop-timeout, I noticed that in docker it is defined as a pointer:
https://github.com/docker/docker/blob/v1.13.0/api/types/container/config.go#L60
type Config struct {
...
StopTimeout *int `json:",omitempty"` // Timeout (in seconds) to stop a container
...
}
That might be an issue to define it in protobuf. I will take a look and see how to solve it.
One way to do it is to define a protobuf message containing just this. The message will be nil by default.
But it is cleaner to use an int directly and use the 0 value to indicate it's unset, if that's possible in this case.
|
|
@aaronlehmann It looks like is kind of Also, I am wondering if |
Yeah, this is covered by
I'm not sure whether this is intentional. It may make sense to also apply this value in the container config. The initial purpose of |
|
I'm not completely sure how the inner workings are w.r.t. Slightly orthogonal, but should we rename |
|
My understanding is that |
|
Agreed; if they both do the same, we should have a single flag (and think of unifying the |
|
@htc2u if you have a bot running on your account; would it be possible to turn it off? It's generating a lot of noise (keep in mind that each comment sends over 3000 e-mails / notifications to subscribers to this repository) |
This fix tries to update the SwarmKit from ed384f3 to 6bc357e The following is the list of docker related changes: 1. Took long time for Docker Swarm service turn desired state from Ready to Running (Issue moby#28291) 2. Native Swarm in 1.12 - panic: runtime error: index out of range (Issue moby#25608) 3. Global mode target replicas keep increasing (Issue moby#30854) 4. Creating service with publish mode=host and without published port crashes swarm manager (Issue moby#30938) 5. Define signals used to stop containers for updates (Issue moby#25696) (PR moby#30754) This fix fixes moby#28291, moby#25608, moby#30854, moby#30938. This fix is required by PR moby#30754. Signed-off-by: Yong Tang <[email protected]>
dca6c92 to
2a7df59
Compare
|
The PR has been updated with #31091 (SwarmKit vendoring) merged. |
|
I still think some validation of |
|
Thanks @aaronlehmann for the feedback. I wasn't sure previously but let me take a look and see if we could do something with validation. |
2a7df59 to
3a2c9be
Compare
|
@aaronlehmann Before a service is created, the I created an additional test case in |
cli/command/service/update.go
Outdated
There was a problem hiding this comment.
I suppose this could use updateString for consistency with the code above. It doesn't really matter though.
There was a problem hiding this comment.
Thanks @aaronlehmann. The PR has been updated.
It just occurred to me that this will validate against the set of signals that are valid on the manager. In a future mixed-OS cluster, it might cause problems if one, for example, connects to a Windows manager to set up a Linux service. Ideally we would validate against the superset of signals defined on all platforms, but this might be making things complicated. I suppose we could move the cc @friism |
|
I think it would be better to remove the validation. |
This fix tries to address the issue raised in 25696 where it was not possible to specify `--stop-signal` for `docker service create` and `docker service update`, in order to use special signal to stop the container. This fix adds `--stop-signal` and update the `StopSignal` in `Config` through `service create` and `service update`. Related docs has been updated. Integration test has been added. This fix fixes 25696. Signed-off-by: Yong Tang <[email protected]>
3a2c9be to
c2d49ec
Compare
|
LGTM |
|
Thanks @aaronlehmann @dnephin for the review. I think the mixture of workers with different OS might be a legitimate concern in the future. At least the platform related elements (like signals) probably could be considered as "constraints". In this case, tasks will not be deployed to those workers that cannot meet the constraint (like specific signals). For now I just removed the validation. I think we could revisit it in the future. |
Add `--stop-signal` for `service create` and `service update`
- What I did
This fix tries to address the issue raised in #25696 where it was not possible to specify
--stop-signalfordocker service createanddocker service update, in order to use special signal to stop the container.- How I did it
This fix adds
--stop-signaland update theStopSignalinConfigthroughservice createandservice update.A SwarmKit PR moby/swarmkit#1924 has been opened separately.
Related docs has been updated.
- How to verify it
Additional unit test and Integration tests have been added.
- Description for the changelog
Add
--stop-signalforservice createandservice update- A picture of a cute animal (not mandatory but encouraged)
This fix fixes #25696.
Signed-off-by: Yong Tang [email protected]