From 0e57393fccd362eaf4adb8b0db3f1c51fd1554f0 Mon Sep 17 00:00:00 2001 From: Snir Sheriber Date: Wed, 13 Jan 2021 17:11:07 +0200 Subject: [PATCH] shimv2: log a warning and continue on post-start hook failure According to runtime-spec: The poststart hooks MUST be invoked by the runtime. If any poststart hook fails, the runtime MUST log a warning, but the remaining hooks and lifecycle continue as if the hook had succeeded Fixes: #1252 Signed-off-by: Snir Sheriber --- src/runtime/containerd-shim-v2/start.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/containerd-shim-v2/start.go b/src/runtime/containerd-shim-v2/start.go index 2f57948bac..9a81ec9591 100644 --- a/src/runtime/containerd-shim-v2/start.go +++ b/src/runtime/containerd-shim-v2/start.go @@ -52,7 +52,9 @@ func startContainer(ctx context.Context, s *service, c *container) error { return katautils.PostStartHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle) }) if err != nil { - return err + // log warning and continue, as defined in oci runtime spec + // https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#lifecycle + shimLog.WithError(err).Warn("Failed to run post-start hooks") } c.status = task.StatusRunning