containerd

package
v0.0.12-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Index

Constants

View Source
const (
	// DefaultSock is the default containerd socket path.
	DefaultSock = "/run/containerd/containerd.sock"

	// DefaultNamespace is the default containerd namespace for this client.
	DefaultNamespace = "k8s.io"
)

Variables

This section is empty.

Functions

func AddHostsConfiguration

func AddHostsConfiguration(ctx context.Context, fs afero.Fs, configPath string, registryURLs, mirrorURLs []url.URL, resolveTags bool) error

AddHostsConfiguration adds mirror configuration to containerd for the specified URLs. Refer to containerd registry configuration documentation for mor information about required configuration. https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration https://github.com/containerd/containerd/blob/main/docs/hosts.md#registry-configuration---examples

Types

type MockContainerdStore

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

func NewMockContainerdStore

func NewMockContainerdStore(refs []Reference) *MockContainerdStore

func (*MockContainerdStore) All

func (m *MockContainerdStore) All(ctx context.Context, ref Reference) ([]string, error)

func (*MockContainerdStore) Bytes

func (m *MockContainerdStore) Bytes(ctx context.Context, dgst digest.Digest) ([]byte, string, error)

func (*MockContainerdStore) List

func (*MockContainerdStore) Resolve

func (m *MockContainerdStore) Resolve(ctx context.Context, ref string) (digest.Digest, error)

func (*MockContainerdStore) Size

func (m *MockContainerdStore) Size(ctx context.Context, dgst digest.Digest) (int64, error)

func (*MockContainerdStore) Subscribe

func (m *MockContainerdStore) Subscribe(ctx context.Context) (<-chan Reference, <-chan error)

func (*MockContainerdStore) Verify

func (m *MockContainerdStore) Verify(ctx context.Context) error

func (*MockContainerdStore) Write

func (m *MockContainerdStore) Write(ctx context.Context, dst io.Writer, dgst digest.Digest) error

type Reference

type Reference interface {
	// Name is the name of the artifact.
	Name() string

	// Digest is the digest of the artifact.
	Digest() digest.Digest

	// Tag is the tag of the artifact.
	Tag() string

	// Repository is the repository of the artifact.
	Repository() string

	// Host is the host of the artifact.
	Host() string

	// String returns the string representation of the reference.
	// docker.io/library/ubuntu:latest
	// docker.io/library/ubuntu@sha256:abcdef
	String() string
}

Reference is a reference to an OCI artifact in the content store.

func ParseReference

func ParseReference(name string, targetDigest digest.Digest) (Reference, error)

ParseReference parses the given name into a reference. targetDigest is obtained from the containerd interface, and is used to verify the parsed digest, or to set the digest if it is not present.

type Registry

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

Registry is a handler that handles requests to this registry.

func NewRegistry

func NewRegistry(containerdStore Store) *Registry

NewRegistry creates a new registry handler.

func (*Registry) Handle

func (r *Registry) Handle(c pcontext.Context)

Handle handles a request to this registry.

type Store

type Store interface {
	// Subscribe returns a channel of artifacts and a channel of errors.
	// Artifacts are sent on the channel as they are discovered.
	Subscribe(ctx context.Context) (<-chan Reference, <-chan error)

	// List returns a list of artifacts.
	List(ctx context.Context) ([]Reference, error)

	// Resolve returns the digest for an existing artifact.
	Resolve(ctx context.Context, ref string) (digest.Digest, error)

	// Size returns the size of the artifact.
	Size(ctx context.Context, dgst digest.Digest) (int64, error)

	// Bytes returns the artifact bytes.
	Bytes(ctx context.Context, dgst digest.Digest) ([]byte, string, error)

	// Write writes the artifact bytes to the writer.
	Write(ctx context.Context, dst io.Writer, dgst digest.Digest) error

	// Verify will verify that the client status is healthy.
	Verify(ctx context.Context) error

	// All returns a list of digests of all resources referenced in ref.
	All(ctx context.Context, ref Reference) ([]string, error)
}

Store is the interface for all containerd content store artifacts.

func NewDefaultStore

func NewDefaultStore(hosts []string) (Store, error)

NewDefaultStore creates a new Store with default values for containerd socket, namespace and hosts configuration path.

func NewStore

func NewStore(sock, ns string, hosts []string) (Store, error)

NewStore creates a new Store.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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