Merge pull request #953 from Starnop/getruntime-before-setupnetwork
refactor: setup network after get Sandbox runtime
This commit is contained in:
commit
36893c3ec9
@ -89,6 +89,13 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to get sandbox image %q", c.config.SandboxImage)
|
return nil, errors.Wrapf(err, "failed to get sandbox image %q", c.config.SandboxImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ociRuntime, err := c.getSandboxRuntime(config, r.GetRuntimeHandler())
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "failed to get sandbox runtime")
|
||||||
|
}
|
||||||
|
logrus.Debugf("Use OCI %+v for sandbox %q", ociRuntime, id)
|
||||||
|
|
||||||
securityContext := config.GetLinux().GetSecurityContext()
|
securityContext := config.GetLinux().GetSecurityContext()
|
||||||
//Create Network Namespace if it is not in host network
|
//Create Network Namespace if it is not in host network
|
||||||
hostNet := securityContext.GetNamespaceOptions().GetNetwork() == runtime.NamespaceMode_NODE
|
hostNet := securityContext.GetNamespaceOptions().GetNetwork() == runtime.NamespaceMode_NODE
|
||||||
@ -132,12 +139,6 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
ociRuntime, err := c.getSandboxRuntime(config, r.GetRuntimeHandler())
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.Wrap(err, "failed to get sandbox runtime")
|
|
||||||
}
|
|
||||||
logrus.Debugf("Use OCI %+v for sandbox %q", ociRuntime, id)
|
|
||||||
|
|
||||||
// Create sandbox container.
|
// Create sandbox container.
|
||||||
spec, err := c.generateSandboxContainerSpec(id, config, &image.ImageSpec.Config, sandbox.NetNSPath)
|
spec, err := c.generateSandboxContainerSpec(id, config, &image.ImageSpec.Config, sandbox.NetNSPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user