Skip to content

Commit

Permalink
runtime: fail when a poststop hook fails
Browse files Browse the repository at this point in the history
If a poststop hook run failed(maybe because the resource is still not ready to be recycled),
we expect that the delete operation could fail and be retried util all
poststop hooks run succeed.

Signed-off-by: Abel Feng <[email protected]>
  • Loading branch information
abel-von committed Aug 2, 2024
1 parent 7017384 commit c59e20a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ The `poststart` hooks MUST be executed in the [runtime namespace](glossary.md#ru

### <a name="configHooksPoststop" />Poststop

The `poststop` hooks MUST be called [after the container is deleted](runtime.md#lifecycle) but before the [`delete`](runtime.md#delete) operation returns.
The `poststop` hooks MUST be called [after the user-specified process is killed](runtime.md#lifecycle), but before the [`delete`](runtime.md#delete) operation return.
Runtime should make sure that if a `poststop` hook failed, the [`delete`](runtime.md#delete) operation could fail and be retried.
Cleanup or debugging functions are examples of such a hook.

The `poststop` hooks' path MUST resolve in the [runtime namespace](glossary.md#runtime-namespace).
Expand Down
2 changes: 1 addition & 1 deletion runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The lifecycle describes the timeline of events that happen from when a container
11. Runtime's [`delete`](runtime.md#delete) command is invoked with the unique identifier of the container.
12. The container MUST be destroyed by undoing the steps performed during create phase (step 2).
13. The [`poststop` hooks](config.md#poststop) MUST be invoked by the runtime.
If any `poststop` hook fails, the runtime MUST [log a warning](#warnings), but the remaining hooks and lifecycle continue as if the hook had succeeded.
If any `poststop` hook fails, the runtime MUST [generate an error](#errors), so that the Runtime's [`delete`](runtime.md#delete) command fails and retry is required until all `poststop` hooks succeed.

## <a name="runtimeErrors" />Errors

Expand Down

0 comments on commit c59e20a

Please sign in to comment.