Skip to content

Why poststart and poststop hook are not consistent with the standard? #1765

@duguhaotian

Description

@duguhaotian
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.

The poststop hooks MUST be invoked by the runtime. If any poststop hook fails, the runtime MUST log a warning, but the remaining hooks and lifecycle continue as if the hook had succeeded.

link at

our runc implements like this

                        for i, hook := range c.config.Hooks.Poststart {
				if err := hook.Run(s); err != nil {
					if err := ignoreTerminateErrors(parent.terminate()); err != nil {
						logrus.Warn(err)
					}
					**return newSystemErrorWithCausef(err, "running poststart hook %d", i)**
				}
			}

                    for i, hook := range c.config.Hooks.Poststop {
			logrus.Infof("run poststop hook %d:%s", i, hook.Info())
			if err := hook.Run(s); err != nil {
				logrus.Errorf("running poststop hook %d: %s failed: %s", i, hook.Info(), err)
				**return newSystemErrorWithCausef(err, "running poststop hook %d:%s", i, hook.Info())**
			}
			logrus.Infof("poststop hook %d:%s done", i, hook.Info())
		}

If hook run is failed, we will return a err. But spec say: "but the remaining hooks and lifecycle continue as if the hook had succeeded."

Why we implement like this????

Thanks!!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions