Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteImage(ctx *fiber.Ctx) error
- func DeleteRegistryMirror(ctx *fiber.Ctx) error
- func EnsureRegistryMirror(ctx context.Context, registry, endpoint string) (bool, error)
- func GetRegistryMirrors(ctx *fiber.Ctx) (map[string]Mirror, error)
- func ListImages(ctx *fiber.Ctx, registry string) ([]*criruntimev1.Image, error)
- func NewCRIImageService() (criapi.ImageManagerService, error)
- func NewCRIRuntimeService() (criapi.RuntimeService, error)
- func NewClient() (*containerd.Client, error)
- func ReconcileMirrorEndpoint(ctx context.Context, registry, endpoint string, present bool) (bool, error)
- type Mirror
- type PruneImageResult
- type Registry
Constants ¶
const ( // CertsDDir is containerd's registry config_path (config v3). Each subdir is a // registry namespace (e.g. docker.io) holding a hosts.toml with its mirror // hosts. This replaces the deprecated inline registry.mirrors in config.toml, // which containerd 2.x ignores once config_path is set. CertsDDir = "/etc/containerd/certs.d" ParamRegistryName = "registry" DefaultRegistryName = "docker.io" )
const DefaultContainerdRootPath = "/var/lib/containerd"
DefaultContainerdRootPath is containerd's default data root, used by the upgrade disk-space precheck.
const (
DefaultNamespace = "k8s.io"
)
Variables ¶
var (
ParamImageName = "image"
)
Functions ¶
func DeleteImage ¶
func DeleteRegistryMirror ¶
DeleteRegistryMirror removes a registry's mirror config (its certs.d subdir).
func EnsureRegistryMirror ¶
EnsureRegistryMirror ensures endpoint is configured as a mirror host for registry: if it is already present (in any position) the list is left unchanged; otherwise it is prepended as the highest-priority host. Returns updated=true if it changed.
func GetRegistryMirrors ¶
GetRegistryMirrors returns all configured registry mirrors keyed by registry namespace (from every certs.d/<registry>/hosts.toml).
func ListImages ¶
func NewCRIImageService ¶
func NewCRIImageService() (criapi.ImageManagerService, error)
func NewCRIRuntimeService ¶
func NewCRIRuntimeService() (criapi.RuntimeService, error)
func NewClient ¶
func NewClient() (*containerd.Client, error)
func ReconcileMirrorEndpoint ¶
func ReconcileMirrorEndpoint(ctx context.Context, registry, endpoint string, present bool) (bool, error)
ReconcileMirrorEndpoint reconciles a single mirror host for registry:
- present=true: if endpoint is already in the list (any position) the list is left as-is; if absent it is prepended as the highest-priority host.
- present=false: endpoint is removed, preserving the order of the rest.
Returns updated=true if the hosts.toml changed. Useful for runtime reconcilers that add/withdraw a single mirror endpoint.
Types ¶
type Mirror ¶
type Mirror struct {
Endpoints []string `json:"endpoint" toml:"endpoint"`
}
Mirror lists the pull-through mirror endpoints for a registry. The JSON shape ({"endpoint": [...]}) matches the containerd CRI Mirror type used by the previous (config v2) olaresd interface, kept for API compatibility.
func GetRegistryMirror ¶
GetRegistryMirror returns the mirror config for a single registry (defaulting to docker.io).
type PruneImageResult ¶
type PruneImageResult struct {
Images []*criruntimev1.Image `json:"images"`
Count int `json:"count"`
Size uint64 `json:"size"`
}
func PruneImages ¶
func PruneImages(ctx *fiber.Ctx) (*PruneImageResult, error)
type Registry ¶
type Registry struct {
Name string `json:"name"`
Endpoints []string `json:"endpoints"`
ImageCount int `json:"image_count"`
ImageSize uint64 `json:"image_size"`
}
Registry is a registry view merged from configured mirrors and locally cached images (used by the ListRegistries endpoint).