Documentation
¶
Overview ¶
Package imagecache rewrites image references so the nodes pull them through the platform's in-cluster pull-through cache (zot with on-demand sync).
The cache is served on every node as localhost:<port> by the node-agent's registry forwarder. A reference REG/repo:tag becomes localhost:<port>/REG/repo:tag; the cache maps the REG prefix back to the upstream registry, so the layout needs no per-image configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistries = []string{"docker.io", "ghcr.io", "quay.io", "registry.k8s.io"}
DefaultRegistries are the upstream registries the chart configures by default.
Functions ¶
Types ¶
type DockerConfigKeychain ¶
type DockerConfigKeychain struct {
// contains filtered or unexported fields
}
DockerConfigKeychain is a keychain over dockerconfigjson documents (the data of kubernetes.io/dockerconfigjson pull Secrets).
func NewDockerConfigKeychain ¶
func NewDockerConfigKeychain(docs ...[]byte) (*DockerConfigKeychain, error)
NewDockerConfigKeychain parses dockerconfigjson documents; a malformed one is an error.
func (*DockerConfigKeychain) Resolve ¶
func (k *DockerConfigKeychain) Resolve(res authn.Resource) (authn.Authenticator, error)
Resolve implements authn.Keychain.
type RegistryResolver ¶
type RegistryResolver struct {
Keychain authn.Keychain
TTL time.Duration
// Timeout bounds one request; 15s when zero.
Timeout time.Duration
// Now is the clock; nil means time.Now.
Now func() time.Time
// Platforms lists the platforms of the nodes the images run on. With exactly
// one, a multi-platform image is pinned to the manifest of that platform, so the
// cache fetches that one image and not every architecture of the index. With
// several (or none known) the index digest is pinned.
Platforms func(ctx context.Context) []v1.Platform
// contains filtered or unexported fields
}
RegistryResolver resolves tags with a HEAD request to the upstream registry (never through the cache, which would answer with what it has stored). Answers are remembered for TTL, so labs created in the same wave, and the prepull, see one digest even when the upstream tag moves meanwhile.
type Rewriter ¶
type Rewriter struct {
// Prefix is host:port of the cache as the nodes see it, e.g. "localhost:5035".
Prefix string
// Registries are the upstream registries the cache serves (docker.io, ghcr.io, ...).
Registries []string
}
Rewriter rewrites image references for one cache.
func (Rewriter) RepoOf ¶
RepoOf returns the cache repository path of a reference that points at the cache (prefix stripped, tag or digest removed), "" if it does not.
func (Rewriter) Rewrite ¶
Rewrite returns the reference to pull through the cache. It returns ref unchanged when the rewriter is empty, the reference is malformed, it already points at the cache, or its registry is not one the cache serves (a private registry, or a snapshot image that is already local).
A reference without a registry is docker.io; one without a repository namespace gets "library/"; one without a tag gets ":latest" (Kubernetes treats the two alike). A reference with a digest keeps only the digest.
func (Rewriter) RewritePinned ¶
RewritePinned is Rewrite for a reference pinned to digest: the tag is replaced by the digest, so every pod of a lab pulls the very same image. A reference the cache does not serve is returned unchanged.