Repository navigation
plan: a stopped service is started, not a blocker - #103
Merged
Merged
Conversation
`state:` can stop a service (#101), but stopping it was still a one-way door and a stopped container still blocked the whole fleet. A stopped container has no IPv4 address, so the route check reports `no IPv4 address (is it stopped?)` as a blocker, and a blocked plan is refused whole. Two cases hit that: * resuming: `state: stopped` removed (or set to running) adds `start`, then falls through to the route check and blocks - so the deploy meant to bring the service back is refused before it runs; * anything stopped without a manifest saying so: a host reboot, a manual stop, or a manifest written before `state:` existed (the twenty case). Nothing is planned to start it, and every other service's deploy is refused too. Running is the default, so both are starts: a stopped container is started, the route is published once it has an address, and the plan never blocks on an address the service does not have yet. A replacement still brings the service up by itself, so no start is planned alongside it. `state: stopped` still wins outright over the default. Adds the address wait after a start in converge (a route is published to an address, and a container that has just started has none), and gives the host simulator's `incus start` the address a real one gets, so a resume can be tested. Tests: stopped with no state (start, no blocker, route republished), stopped with `state: running` (the resume dead-end), and `state: stopped` still stopping without a start. README's `state:` note now says what the default does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #101 (
state: stopped|running): stopping a service still dead-ended the fleet, in two ways.The bug
A stopped container has no IPv4 address, so the route check reports
and a blocked plan is refused whole (
the plan is blocked; nothing was applied).1. Resume is blocked.
state: stoppedremoved (or set torunning) addsstart, then falls through to the route check and blocks. The deploy meant to bring the service back never runs.TestExplicitRunningStartsStoppedmisses it because it asserts only the change kinds, not the blockers.2. Anything stopped without a
state:blocks everyone. A host reboot, a manual stop, or a manifest written before the field existed. Nothing is planned to start it, and because the plan is refused whole, every other service in the fleet cannot deploy. That is how a stoppedtwentyblocked a crew roll.The fix
Running is the default, so both cases are starts:
start <svc>), the route is published once it has an address, and the plan never blocks on an address the service does not have yet;replace-image;state: stoppedstill wins outright over the default — nothing gets started behind its back.convergenow waits for the address after a start (a route is published to an address, and a just-started container has none), and the host simulator givesincus startthe address a real one gets, so a resume is testable.Tests
gofmtclean,go vet ./...clean,go test -race ./...green.TestStoppedServiceWithoutStateIsStartedNotBlockedstartchange, apply starts it and republishes the routeTestExplicitRunningIsNotBlockedByTheAddressItHasNotGotYetstate: runningon a stopped service plans a start with no blocker, and apply brings it backTestADeclaredStopStillWinsOverTheDefaultstate: stoppedstill stops, and never plans a startAlso updated the two tests that asserted the old blocking behaviour, and README's
state:note now says what the default does.