containerd

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package containerd provides support for containerd CRI plugin

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCRIConfig

func GenerateCRIConfig(r config.Registries) ([]byte, error)

GenerateCRIConfig returns a part of CRI config for registry auth.

Once containerd supports different way of supplying auth info, this should be updated.

Types

type AuthConfig

type AuthConfig struct {
	Username      string `toml:"username"`
	Password      string `toml:"password"`
	Auth          string `toml:"auth"`
	IdentityToken string `toml:"identitytoken"`
}

AuthConfig represents the registry auth options.

type CRIConfig

type CRIConfig struct {
	Registry Registry `toml:"registry"`
}

CRIConfig represents the CRI config.

type Config

type Config struct {
	Plugins PluginsConfig `toml:"plugins"`
}

Config represnts the containerd config.

type HostEntry added in v1.9.0

type HostEntry struct {
	Host string
	HostToml
}

HostEntry describes the configuration for a single host.

type HostToml

type HostToml struct {
	Capabilities []string    `toml:"capabilities,omitempty"`
	OverridePath bool        `toml:"override_path,omitempty"`
	CACert       string      `toml:"ca,omitempty"`
	Client       [][2]string `toml:"client,omitempty"`
	SkipVerify   bool        `toml:"skip_verify,omitempty"`
}

HostToml is a single entry in `hosts.toml`.

type HostsConfig

type HostsConfig struct {
	Directories map[string]*HostsDirectory
}

HostsConfig describes layout of registry configuration in "hosts" format.

See: https://github.com/containerd/containerd/blob/main/docs/hosts.md

func GenerateHosts

func GenerateHosts(cfg config.Registries, basePath string) (*HostsConfig, error)

GenerateHosts generates a structure describing contents of the containerd hosts configuration.

type HostsConfiguration added in v1.9.0

type HostsConfiguration struct {
	RootEntry optional.Optional[HostEntry] // might be missing

	HostEntries []HostEntry
}

HostsConfiguration describes the configuration of `hosts.toml` file in the format not compatible with TOML.

The hosts entries should come in order, and go-toml only supports map[string]any, so we need to do some tricks.

func (*HostsConfiguration) DisableFallback added in v1.9.0

func (hc *HostsConfiguration) DisableFallback()

DisableFallback disables the fallback to the default host.

func (*HostsConfiguration) RenderTOML added in v1.9.0

func (hc *HostsConfiguration) RenderTOML() ([]byte, error)

RenderTOML renders the configuration to TOML format.

type HostsDirectory

type HostsDirectory struct {
	Files []*HostsFile
}

HostsDirectory describes a single directory for a specific registry.

type HostsFile

type HostsFile struct {
	Name     string
	Contents []byte
	Mode     os.FileMode
}

HostsFile describes a single file configuring registry.

This might be `hosts.toml` or a specific certificate.

type HostsTomlHost added in v1.9.0

type HostsTomlHost struct {
	// Note: this doesn't match the TOML format, but allows use to keep endpoints ordered properly.
	HostConfigs map[string]HostToml `toml:"host"`
}

HostsTomlHost describes the `hosts.toml` file entry for hosts.

It is supposed to be marshaled as a single-entry map to keep the order correct.

type HostsTomlServer added in v1.9.0

type HostsTomlServer struct {
	// top-level entry is used as the last one in the fallback chain.
	Server   string `toml:"server,omitempty"`
	HostToml        // embedded, matches the server
}

HostsTomlServer describes only 'server' part of the `hosts.toml` file.

type PluginsConfig

type PluginsConfig struct {
	CRI CRIConfig `toml:"io.containerd.cri.v1.images"`
}

PluginsConfig represents the CRI plugins config.

type Registry

type Registry struct {
	ConfigPath string                    `toml:"config_path"`
	Configs    map[string]RegistryConfig `toml:"configs"`
}

Registry represents the registry configuration.

type RegistryConfig

type RegistryConfig struct {
	Auth *AuthConfig `toml:"auth"`
}

RegistryConfig represents a registry.

Jump to

Keyboard shortcuts

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