Forward sandbox config to PullImage request

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
Justin Terry (VM) 2019-05-10 11:35:09 -07:00
parent e4ebb718c6
commit bc445d7595
2 changed files with 3 additions and 3 deletions

View File

@ -275,7 +275,7 @@ func getUserFromImage(user string) (*int64, string) {
// ensureImageExists returns corresponding metadata of the image reference, if image is not // ensureImageExists returns corresponding metadata of the image reference, if image is not
// pulled yet, the function will pull the image. // pulled yet, the function will pull the image.
func (c *criService) ensureImageExists(ctx context.Context, ref string) (*imagestore.Image, error) { func (c *criService) ensureImageExists(ctx context.Context, ref string, config *runtime.PodSandboxConfig) (*imagestore.Image, error) {
image, err := c.localResolve(ref) image, err := c.localResolve(ref)
if err != nil && err != store.ErrNotExist { if err != nil && err != store.ErrNotExist {
return nil, errors.Wrapf(err, "failed to get image %q", ref) return nil, errors.Wrapf(err, "failed to get image %q", ref)
@ -284,7 +284,7 @@ func (c *criService) ensureImageExists(ctx context.Context, ref string) (*images
return &image, nil return &image, nil
} }
// Pull image to ensure the image exists // Pull image to ensure the image exists
resp, err := c.PullImage(ctx, &runtime.PullImageRequest{Image: &runtime.ImageSpec{Image: ref}}) resp, err := c.PullImage(ctx, &runtime.PullImageRequest{Image: &runtime.ImageSpec{Image: ref}, SandboxConfig: config})
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "failed to pull image %q", ref) return nil, errors.Wrapf(err, "failed to pull image %q", ref)
} }

View File

@ -92,7 +92,7 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
) )
// Ensure sandbox container image snapshot. // Ensure sandbox container image snapshot.
image, err := c.ensureImageExists(ctx, c.config.SandboxImage) image, err := c.ensureImageExists(ctx, c.config.SandboxImage, config)
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)
} }