-
Notifications
You must be signed in to change notification settings - Fork 553
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
Restore hook language removed by create/start split #532
Restore hook language removed by create/start split #532
Conversation
runtime.md
Outdated
@@ -54,17 +56,28 @@ The lifecycle describes the timeline of events that happen from when a container | |||
3. Once the container is created additional actions MAY be performed based on the features the runtime chooses to support. | |||
However, some actions might only be available based on the current state of the container (e.g. only available while it is started). | |||
4. Runtime's `start` command is invoked with the unique identifier of the container. | |||
The runtime MUST run the user-specified code, as specified by [`process`](config.md#process-configuration). | |||
5. The container's process is stopped. | |||
5. The [prestart hooks](config.md#prestart) MUST be invoked by the runtime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On IRC, @Mrunal suggested switching steps 4 and 5, so the pre-start
hooks fire at the end of create
instead of the beginning of start
. I think that would be surprising considering the naming (621bdb4 talks about a possible postcreate
anchor in that position). But we already have the confusing poststop
running after delete
(621bdb4 talks about this too).
Personally, I'd rather drop hooks (#483). But if we keep them for backwards compat, I can see that updating consumers to go from runtime-executed hooks to orchestrator executed hooks would be a largish change. However, renaming config fields (prestart
→ postcreate
) seems like a trivial change, and I'd much rather force pre-1.0 users to pay that cost now (they understood pre-1.0 was unstable) than have to explain to all new users why our hook names make no sense ;).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So to be clear on options for resolving this, we have:
a. Keep this line as it is, with prestart
firing after start
was called but before the meat of the start
action (execing the user-specified code).
b. Shift prestart
to fire at the end of create
.
i. And still call it prestart
.
ii. And rename it to postcreate
.
I'm ok with (a) and (b.ii). I think (b.i) will have cause more work for users resolving confusion, while (b.ii) will cause a small amount of work for existing hook consumers who have to rename their config settings.
On Thu, Aug 18, 2016 at 07:46:01PM -0700, Anush Krishnamurthy wrote:
#405 is currently (38cbfc9) adding vm.imagePath, vm.kernel.path, |
On Tue, Aug 23, 2016 at 07:00:32PM -0700, Anush Krishnamurthy wrote:
I still don't see how 1. Can you be more specific about how you see |
@wking: Sorry about the churn. Got it now. I confused myself. |
Needs rebase. |
58e0001
to
31d8883
Compare
runtime.md
Outdated
@@ -13,6 +13,8 @@ The state of a container MUST include, at least, the following properties: | |||
* **`id`**: (string) is the container's ID. | |||
This MUST be unique across all containers on this host. | |||
There is no requirement that it be unique across hosts. | |||
The ID is provided in the state because hooks will be executed with the state as the payload. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need to hijack the id's description to tell someone why its here because of another feature. It is enable to document that in the hooks description that the container's state is given to the hook as it's payload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was just recovered from the graveyard. It sounds like you want it to stay dead, so I'll drop it when I rebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to squash and fix the commits because they show up as merges of a remote tracking branch
31d8883
to
f0835e9
Compare
I expect the lifecycle information was removed accidentally in be59415 (Split create and start, 2016-04-01, opencontainers#384), because for a time it seemed like that PR would also be removing hooks. Putting the lifecycle information back in, I made some tweaks to adjust to the new environment, for example: * Put the pre-start hooks after the 'start' call, but before the meat of the start call (the container-process exec trigger). Folks who want a post-create hook can add one with that name. I'd like to have renamed poststop to post-delete to avoid confusion like [1]. But the motivation for keeping hooks was backwards compatibility [2] so I've left the name alone. * Put each "...command is invoked..." lifecycle entry in its own list entry, to match the 'create' list entry. * Move the rules about what happens on hook failure into the lifecycle. This matches pre-split entries like: If any prestart hook fails, then the container MUST be stopped and the lifecycle continues at step 7. and avoids respecifying that information in a second location (config.md). * I added the warning section to try and follow post-split's generic "generates an error" approach while respecting the pre-split desire to see what failed (we had "then an error including the exit code and the stderr is returned to the caller" and "then an error is logged"). * I left the state 'id' context out, since Michael didn't want it [3]. [1]: opencontainers#395 Subject: Run post-stop hooks before the container sandbox is deleted. [2]: opencontainers#483 (comment) Subject: *: Remove hooks [3]: opencontainers#532 (comment) Subject: Restore hook language removed by create/start split Signed-off-by: W. Trevor King <wking@tremily.us>
I've pushed 31d8883 → f0835e9, dropping the state ‘id’ context [1],
removing the merges that enabled ‘git blame’ [2], picking up
@jlbutler's suggested MUST additions [3], and tightening the lifecycle
wording in the config.md entries.
[1]: #532 (comment)
[2]: #532 (review)
[3]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/%23opencontainers.2017-02-02.log.html#t2017-02-02T22:56:45
|
@wking can you rebase this today? |
f0835e9
to
17165f8
Compare
I expect the lifecycle information was removed accidentally in be59415 (Split create and start, 2016-04-01, opencontainers#384), because for a time it seemed like that PR would also be removing hooks. Putting the lifecycle information back in, I made some tweaks to adjust to the new environment, for example: * Put the pre-start hooks after the 'start' call, but before the meat of the start call (the container-process exec trigger). Folks who want a post-create hook can add one with that name. I'd like to have renamed poststop to post-delete to avoid confusion like [1]. But the motivation for keeping hooks was backwards compatibility [2] so I've left the name alone. * Put each "...command is invoked..." lifecycle entry in its own list entry, to match the 'create' list entry. * Move the rules about what happens on hook failure into the lifecycle. This matches pre-split entries like: If any prestart hook fails, then the container MUST be stopped and the lifecycle continues at step 7. and avoids respecifying that information in a second location (config.md). * I added the warning section to try and follow post-split's generic "generates an error" approach while respecting the pre-split desire to see what failed (we had "then an error including the exit code and the stderr is returned to the caller" and "then an error is logged"). * I left the state 'id' context out, since Michael didn't want it [3]. [1]: opencontainers#395 Subject: Run post-stop hooks before the container sandbox is deleted. [2]: opencontainers#483 (comment) Subject: *: Remove hooks [3]: opencontainers#532 (comment) Subject: Restore hook language removed by create/start split Signed-off-by: W. Trevor King <wking@tremily.us>
Needs rebase again :/ |
I expect the lifecycle information was removed accidentally in be59415 (Split create and start, 2016-04-01, opencontainers#384), because for a time it seemed like that PR would also be removing hooks. Putting the lifecycle information back in, I made some tweaks to adjust to the new environment, for example: * Put the pre-start hooks after the 'start' call, but before the meat of the start call (the container-process exec trigger). Folks who want a post-create hook can add one with that name. I'd like to have renamed poststop to post-delete to avoid confusion like [1]. But the motivation for keeping hooks was backwards compatibility [2] so I've left the name alone. * Put each "...command is invoked..." lifecycle entry in its own list entry, to match the 'create' list entry. * Move the rules about what happens on hook failure into the lifecycle. This matches pre-split entries like: If any prestart hook fails, then the container MUST be stopped and the lifecycle continues at step 7. and avoids respecifying that information in a second location (config.md). * I added the warning section to try and follow post-split's generic "generates an error" approach while respecting the pre-split desire to see what failed (we had "then an error including the exit code and the stderr is returned to the caller" and "then an error is logged"). * I left the state 'id' context out, since Michael didn't want it [3]. * Make runtime.md references to "generate an error" and "log a warning" links, so readers have an easier time finding more detail on that wording. Where I reference a section, I'm still using the auto-generated anchor for that header and not the anchors which were added in 41839d7 (Merge pull request opencontainers#707 from mrunalp/anchor_tags, 2017-03-03) and similar. Mrunal suggested that the manually-added anchors were mainly intended for the validation tooling [4]. [1]: opencontainers#395 Subject: Run post-stop hooks before the container sandbox is deleted. [2]: opencontainers#483 (comment) Subject: *: Remove hooks [3]: opencontainers#532 (comment) Subject: Restore hook language removed by create/start split [4]: http://ircbot.wl.linuxfoundation.org/eavesdrop/%23opencontainers/%23opencontainers.2017-03-03.log.html#t2017-03-03T18:02:12 Signed-off-by: W. Trevor King <wking@tremily.us>
17165f8
to
f636808
Compare
Details in the commit messages.
Instead of making these changes in a fresh commit off master:
I've made them in two merges so
git blame
can tell that some lines come from historical commits, and that I'm just pulling them out of the history. The structure of this branch is:where
b
is #384,c
is #384 landing, andd
ande
are new for this PR.