mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-24 01:24:26 +01:00
hook: Move OCI hooks handling to the CLI
The CLI being the implementation of the OCI specification, and the hooks being OCI specific, it makes sense to move the handling of any OCI hooks to the CLI level. This changes allows the Kata API to become OCI agnostic. Fixes #599 Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
@@ -273,6 +273,14 @@ func createSandbox(ctx context.Context, ociSpec oci.CompatOCISpec, runtimeConfig
|
||||
return vc.Process{}, err
|
||||
}
|
||||
|
||||
// Run pre-start OCI hooks.
|
||||
err = enterNetNS(sandboxConfig.NetworkConfig.NetNSPath, func() error {
|
||||
return preStartHooks(ctx, ociSpec, containerID, bundlePath)
|
||||
})
|
||||
if err != nil {
|
||||
return vc.Process{}, err
|
||||
}
|
||||
|
||||
sandbox, err := vci.CreateSandbox(ctx, sandboxConfig)
|
||||
if err != nil {
|
||||
return vc.Process{}, err
|
||||
@@ -331,7 +339,15 @@ func createContainer(ctx context.Context, ociSpec oci.CompatOCISpec, containerID
|
||||
setExternalLoggers(ctx, kataLog)
|
||||
span.SetTag("sandbox", sandboxID)
|
||||
|
||||
_, c, err := vci.CreateContainer(ctx, sandboxID, contConfig)
|
||||
s, c, err := vci.CreateContainer(ctx, sandboxID, contConfig)
|
||||
if err != nil {
|
||||
return vc.Process{}, err
|
||||
}
|
||||
|
||||
// Run pre-start OCI hooks.
|
||||
err = enterNetNS(s.GetNetNs(), func() error {
|
||||
return preStartHooks(ctx, ociSpec, containerID, bundlePath)
|
||||
})
|
||||
if err != nil {
|
||||
return vc.Process{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user