-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add a startup field for checks, and start-checks and stop-checks actions #560
Draft
tonyandrewmeyer
wants to merge
19
commits into
canonical:master
Choose a base branch
from
tonyandrewmeyer:disable-checks
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
…eed, and it wasn't in the spec.
…d plan doesn't gain a lot of 'startup: enabled' lines.
@benhoyt as discussed, if you could give this a "pre-review", that would be great, thanks! |
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.
This is not at all ready - the PR gives me a convenient place to put notes.
Add support for starting and stopping checks, in a very similar manner to starting and stopping services.
Layer
The layer specification gains a new
startup
field for checks, which must be eitherenabled
ordisabled
, and defaults toenabled
for backwards compatibility.The impact of this field is that when the plan is updated (including when Pebble first starts) or a layer is added, new checks where
startup
is set todisabled
will not be started. If a check's configuration changes (for example, the timeout or period), and it is set tostartup: disabled
but is currently running, then it will be restarted as previously. Any stopped checks withstartup: enabled
will also be started when the plan changes.This field is implemented via the existing check manager
PlanChanged
function. That function is registered as a listener for when the plan changes, which includes new checks being added, and check fields (includingstartup
) changing. The function is adjusted in this PR to only start new checks ifstartup
is enabled. For replan write details here.CLI
Minor change: since
replan
now impacts checks as well as services, it is moved in the help listing from theservices
section to theplan
section.Two new commands are added:
start-checks
andstop-checks
. These take one or more check names as arguments, and start or stop the specified checks. Starting a running check or stopping a stopped check is a no-op.The
checks
command output is altered to include a new "Startup" column, which is simply the value of the field from the combined plan for that check, and to showinactive
in the "Status" column for any checks that have been stopped (these also get a-
value for both "Change" and "Failures").start-checks
andstop-checks
are very similar tostart
andstop
, except that they are synchronous so do not offer wait. Checks currently have exactly one change (this PR changes that to zero or one), with the appropriate tasks contained within that change. Sincestart-check
andstop-check
can operate on more than one check, that means that they are operating on more than one change, so an interface where a single change ID is returned (and then can be waited on) does not fit.We could only offer
start-check
andstop-check
, but in the spec review we preferred to have the option to specify multiple checks (as with services). For services, a new change is created that contains the tasks to start or stop all of the services (in the appropriate order) - doing this for checks does not seem to make sense, given that there is already a change running for each check. We could have a new response type that can wait for multiple changes, but that seems like a lot just for this small feature.API
The existing
/v1/checks
endpoint is extended to also supportPOST
, requiring admin access. The structure for this endpoint is similar to posting to/v1/services
, in that it requires a list of check names and an action to perform (currently eitherstart
orstop
).TODO
The checks client has the level as well as check names in the options: we currently ignore the level, because it doesn't seem like you'd want to do "stop all ready checks", but it would probably be cleaner if it was actually used to filer.Spec - OP052 (internal link only, sorry).