Documentation
¶
Index ¶
- Constants
- func NewResolver(reg cri.Registries) remotes.Resolver
- func NewTagFetcher(reg cri.Registries) verify.TagFetcher
- func PrepareAuth(auth config.RegistryAuthConfig, host, expectedHost string) (string, string, error)
- func Pull(ctx context.Context, registryBuilder RegistriesBuilder, resources state.State, ...) (img containerd.Image, err error)
- func PullWithRetriesAndTimeout(ctx context.Context, registryBuilder RegistriesBuilder, resources state.State, ...) (img containerd.Image, err error)
- func RegistryHosts(reg cri.Registries) docker.RegistryHosts
- type EndpointEntry
- type NewProgressReporter
- type ProgressReporter
- type PullOption
- type PullOptions
- type RegistriesBuilder
Constants ¶
const ( PullTimeout = 20 * time.Minute PullRetryInterval = 5 * time.Second )
Image pull retry settings.
const PullConnIdleTimeout = 90 * time.Second
PullConnIdleTimeout is the maximum time a pull connection is allowed to make no progress (read no bytes) before it is considered stalled and aborted.
This guards against connections which are silently black-holed (e.g. after a network reconfiguration) and would otherwise hang until the global pull timeout. It does not penalize slow-but-progressing pulls, as the deadline is reset on every successful read.
Variables ¶
This section is empty.
Functions ¶
func NewResolver ¶
func NewResolver(reg cri.Registries) remotes.Resolver
NewResolver builds registry resolver based on Talos configuration.
func NewTagFetcher ¶ added in v1.13.3
func NewTagFetcher(reg cri.Registries) verify.TagFetcher
NewTagFetcher builds a verify.TagFetcher that fetches a manifest by its tag URL through the same RegistryHosts (auth + TLS + mirror list) used by the resolver.
It is the fallback used by signature verification when the resolver's digest-based manifest fetch returns NotFound, e.g. against registry.k8s.io's CDN where the HEAD-by-tag and GET-by-digest requests can be routed to different regional backends with inconsistent replication.
func PrepareAuth ¶
PrepareAuth returns authentication info in the format expected by containerd.
func Pull ¶
func Pull( ctx context.Context, registryBuilder RegistriesBuilder, resources state.State, client *containerd.Client, ref string, opt ...PullOption, ) (img containerd.Image, err error)
Pull performs a single attempt to pull an image from a registry.
If configured, the pull is skipped if the image is already present and unpacked in the containerd client. The ctx should have a containerd namespace on it already.
func PullWithRetriesAndTimeout ¶ added in v1.14.0
func PullWithRetriesAndTimeout( ctx context.Context, registryBuilder RegistriesBuilder, resources state.State, client *containerd.Client, ref string, opt ...PullOption, ) (img containerd.Image, err error)
PullWithRetriesAndTimeout performs a pull with retries and timeout.
It is a wrapper around Pull that adds retry logic and timeout handling. This method is used in Talos internally when performing unattended pulls of images, e.g. for the kubelet/etcd services. When pulling via the API, or under retry/backoff control, use Pull method directly instead.
func RegistryHosts ¶
func RegistryHosts(reg cri.Registries) docker.RegistryHosts
RegistryHosts returns host configuration per registry.
Types ¶
type EndpointEntry ¶ added in v1.9.0
EndpointEntry represents a registry endpoint.
func RegistryEndpointEntriesFromConfig ¶ added in v1.9.0
func RegistryEndpointEntriesFromConfig(host string, reg config.RegistryMirrorConfig) ([]EndpointEntry, error)
RegistryEndpointEntriesFromConfig returns registry endpoints per host.
func RegistryEndpoints ¶
func RegistryEndpoints(reg cri.Registries, host string) (endpoints []EndpointEntry, err error)
RegistryEndpoints returns registry endpoints per host using reg.
type NewProgressReporter ¶ added in v1.13.0
type NewProgressReporter func(imageRef string) ProgressReporter
NewProgressReporter creates a new progress reporter.
func NewSimpleProgressReporter ¶ added in v1.13.0
func NewSimpleProgressReporter(updateFn func(progress.LayerPullProgress)) NewProgressReporter
NewSimpleProgressReporter creates a simple progress reporter that just needs Update function.
type ProgressReporter ¶ added in v1.13.0
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 WithLogWriter ¶ added in v1.14.0
func WithLogWriter(logWriter io.Writer) PullOption
WithLogWriter sets the writer for internal containerd logs.
func WithMaxNotFoundRetries ¶ added in v1.10.5
func WithMaxNotFoundRetries(maxRetries int) PullOption
WithMaxNotFoundRetries sets the maximum number of retries for not found errors.
This option is only honored in the PullWithRetriesAndTimeout function, the Pull function will ignore this option and will not retry on not found errors.
func WithProgressReporter ¶ added in v1.13.0
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
LogWriter io.Writer
}
PullOptions configure Pull function.
func DefaultPullOptions ¶ added in v1.10.5
func DefaultPullOptions() PullOptions
DefaultPullOptions returns default options for Pull function.
type RegistriesBuilder ¶ added in v1.9.0
type RegistriesBuilder = func(context.Context) (cri.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 imageref provides canonical normalization of container image references.
|
Package imageref provides canonical normalization of container image references. |
|
Package progress provides functionality to track and report image pull progress.
|
Package progress provides functionality to track and report image pull progress. |
|
Package stallguard provides a net.Conn wrapper which aborts reads that make no progress for a configurable idle timeout.
|
Package stallguard provides a net.Conn wrapper which aborts reads that make no progress for a configurable idle timeout. |
|
Package verify provides functionality to verify container images against configured verification policies.
|
Package verify provides functionality to verify container images against configured verification policies. |
|
internal/cosign
Package cosign provides cosign-based image signature verification via Talos pull process.
|
Package cosign provides cosign-based image signature verification via Talos pull process. |