Skip to content
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

Merged

Conversation

wking
Copy link
Contributor

@wking wking commented Aug 17, 2016

Details in the commit messages.

Instead of making these changes in a fresh commit off master:

o---o---o  master
         \
          o  tk/restore-hook-lifecycle

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:

a---c---o---o  master
 \ x         \
  b-d---------e  tk/restore-hook-lifecycle

where b is #384, c is #384 landing, and d and e are new for this PR.

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.
Copy link
Contributor Author

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 (prestartpostcreate) 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 ;).

Copy link
Contributor Author

@wking wking Aug 17, 2016

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.

@iamanush
Copy link

@wking I'm curious if bringing back the hooks will then enable the VM-based runtime configuration details [1] as a hook?

[1] #405

@wking
Copy link
Contributor Author

wking commented Aug 19, 2016

On Thu, Aug 18, 2016 at 07:46:01PM -0700, Anush Krishnamurthy wrote:

@wking I'm curious if bringing back the hooks will then enable the
VM-based runtime configuration details [1] as a hook?

#405 is currently (38cbfc9) adding vm.imagePath, vm.kernel.path,
vm.kernel.parameters, and vm.kernel.initrd. I don't see how you'd
address any of those via hooks; can you explain the connection you see
in more detail?

@iamanush
Copy link

@wking I was wondering if #405 can be enabled alternately via hooks.

@wking
Copy link
Contributor Author

wking commented Aug 24, 2016

On Tue, Aug 23, 2016 at 07:00:32PM -0700, Anush Krishnamurthy wrote:

@wking I was wondering if #405 can be enabled alternately via hooks.

I still don't see how 1. Can you be more specific about how you see
it working? Without something like #405 landing, I think you'd have
to address the #405 use cases with annotations 2 or runtime options
[3](and not hooks).

@iamanush
Copy link

@wking: Sorry about the churn. Got it now. I confused myself.

@mrunalp mrunalp added this to the 1.0.0 milestone Jan 4, 2017
@mrunalp
Copy link
Contributor

mrunalp commented Jan 6, 2017

Needs rebase.

@wking wking force-pushed the tk/restore-hook-lifecycle branch 3 times, most recently from 58e0001 to 31d8883 Compare January 6, 2017 06:15
@wking
Copy link
Contributor Author

wking commented Jan 6, 2017 via email

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.
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@crosbymichael crosbymichael left a 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

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Feb 3, 2017
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>
@wking
Copy link
Contributor Author

wking commented Feb 3, 2017 via email

@crosbymichael
Copy link
Member

@wking can you rebase this today?

@wking wking force-pushed the tk/restore-hook-lifecycle branch from f0835e9 to 17165f8 Compare March 1, 2017 22:24
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Mar 1, 2017
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>
@wking
Copy link
Contributor Author

wking commented Mar 1, 2017 via email

@crosbymichael
Copy link
Member

crosbymichael commented Mar 3, 2017

LGTM

Approved with PullApprove

@mrunalp
Copy link
Contributor

mrunalp commented Mar 3, 2017

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>
@wking wking force-pushed the tk/restore-hook-lifecycle branch from 17165f8 to f636808 Compare March 3, 2017 18:07
@wking
Copy link
Contributor Author

wking commented Mar 3, 2017 via email

@mrunalp
Copy link
Contributor

mrunalp commented Mar 3, 2017

LGTM

Approved with PullApprove

1 similar comment
@crosbymichael
Copy link
Member

crosbymichael commented Mar 3, 2017

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit 7da699d into opencontainers:master Mar 3, 2017
@wking wking deleted the tk/restore-hook-lifecycle branch March 3, 2017 19:12
@vbatts vbatts mentioned this pull request Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants