image

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PullTimeout       = 20 * time.Minute
	PullRetryInterval = 5 * time.Second
)

Image pull retry settings.

Variables

This section is empty.

Functions

func NewResolver

func NewResolver(reg workload.Registries) remotes.Resolver

NewResolver builds registry resolver based on Chubo configuration.

func PrepareAuth

func PrepareAuth(auth config.RegistryAuthConfig, host, expectedHost string) (string, string, error)

PrepareAuth returns authentication info in the format expected by containerd.

func Pull

func Pull(ctx context.Context, registryBuilder RegistriesBuilder, client *containerd.Client, ref string, opt ...PullOption) (img containerd.Image, err error)

Pull is a convenience function that wraps the containerd image pull func with retry functionality.

func RegistryHosts

func RegistryHosts(reg workload.Registries) docker.RegistryHosts

RegistryHosts returns host configuration per registry.

Types

type EndpointEntry

type EndpointEntry struct {
	Endpoint     string
	OverridePath bool
}

EndpointEntry represents a registry endpoint.

func RegistryEndpointEntriesFromConfig

func RegistryEndpointEntriesFromConfig(host string, reg config.RegistryMirrorConfig) ([]EndpointEntry, error)

RegistryEndpointEntriesFromConfig returns registry endpoints per host.

func RegistryEndpoints

func RegistryEndpoints(reg workload.Registries, host string) (endpoints []EndpointEntry, err error)

RegistryEndpoints returns registry endpoints per host using reg.

type NewProgressReporter

type NewProgressReporter func(imageRef string) ProgressReporter

NewProgressReporter creates a new progress reporter.

func NewSimpleProgressReporter

func NewSimpleProgressReporter(updateFn func(progress.LayerPullProgress)) NewProgressReporter

NewSimpleProgressReporter creates a simple progress reporter that just needs Update function.

type ProgressReporter

type ProgressReporter interface {
	Start()
	Stop()
	Update(progress.LayerPullProgress)
}

ProgressReporter is an interface for reporting image pull progress.

type PullOption

type PullOption func(*PullOptions)

PullOption is an option for Pull function.

func WithMaxNotFoundRetries

func WithMaxNotFoundRetries(maxRetries int) PullOption

WithMaxNotFoundRetries sets the maximum number of retries for not found errors.

func WithProgressReporter

func WithProgressReporter(newReporter NewProgressReporter) PullOption

WithProgressReporter enables reporting pull progress.

func WithSkipIfAlreadyPulled

func WithSkipIfAlreadyPulled() PullOption

WithSkipIfAlreadyPulled skips pulling if image is already pulled and unpacked.

type PullOptions

type PullOptions struct {
	SkipIfAlreadyPulled bool
	MaxNotFoundRetries  int
	NewProgressReporter NewProgressReporter
}

PullOptions configure Pull function.

func DefaultPullOptions

func DefaultPullOptions() PullOptions

DefaultPullOptions returns default options for Pull function.

type RegistriesBuilder

type RegistriesBuilder = func(context.Context) (workload.Registries, error)

RegistriesBuilder is a function that returns registries configuration.

Directories

Path Synopsis
Package console provides a console-based implementation of image pull progress reporting.
Package console provides a console-based implementation of image pull progress reporting.
Package progress provides functionality to track and report image pull progress.
Package progress provides functionality to track and report image pull progress.

Jump to

Keyboard shortcuts

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