imagepull

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package imagepull pulls images onto a node through the container runtime's image service (CRI), for the node-agent. Nothing from an image runs: the runtime only fetches and unpacks it, which is all a prepull needs, and the credentials of the pull are the tenant's own, handed over per request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DockerConfigCredentials

func DockerConfigCredentials(doc []byte) (func(ref string) *Auth, error)

DockerConfigCredentials turns a kubernetes.io/dockerconfigjson document into the lookup Options.Credentials wants: the entry of the image's registry, nil (anonymous) when the document has none for it. An empty document means no credentials at all.

Types

type Auth

type Auth struct {
	Username, Password string
}

Auth is the registry credential of one pull.

type CRIPuller

type CRIPuller struct {
	// contains filtered or unexported fields
}

CRIPuller pulls through the image service of the node's container runtime. Images land in the runtime's own namespace (the kubelet's), so the kubelet finds them.

func NewCRIPuller

func NewCRIPuller(sock string) (*CRIPuller, error)

NewCRIPuller connects (lazily) to the CRI socket.

func (*CRIPuller) Close

func (c *CRIPuller) Close() error

Close releases the connection.

func (*CRIPuller) Present

func (c *CRIPuller) Present(ctx context.Context, ref string) (bool, error)

Present implements Puller.

func (*CRIPuller) Pull

func (c *CRIPuller) Pull(ctx context.Context, ref string, auth *Auth) error

Pull implements Puller.

type Failure

type Failure struct {
	Image, Message string
}

Failure is an image that could not be pulled.

type Options

type Options struct {
	// Concurrency is how many images are pulled at once (2).
	Concurrency int
	// Timeout bounds one image (5m).
	Timeout time.Duration
	// Credentials returns the credential for an image's registry; nil or a nil Auth means anonymous.
	Credentials func(ref string) *Auth
}

Options bound a Pull.

type Puller

type Puller interface {
	// Present reports whether the node already holds the image.
	Present(ctx context.Context, ref string) (bool, error)
	// Pull fetches the image; auth is nil for an anonymous pull.
	Pull(ctx context.Context, ref string, auth *Auth) error
}

Puller is the container runtime's image service.

type Result

type Result struct {
	Pulled []string
	Failed []Failure
}

Result is the outcome for one node: every image is in exactly one of the lists.

func Pull

func Pull(ctx context.Context, p Puller, images []string, o Options) Result

Pull makes the node hold the images. An image the node already holds is not pulled again; one that cannot be pulled (a wrong name or tag, no access) is reported at once with the runtime's message, the others carry on. Both lists are sorted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL