spegel

package
v0.0.0-...-f4dfa5d Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	P2pAddressAnnotation = "p2p." + version.Program + ".cattle.io/node-address"
	P2pEnabledLabel      = "p2p." + version.Program + ".cattle.io/enabled"
	P2pPortEnv           = version.ProgramUpper + "_P2P_PORT"
)
View Source
var DefaultRegistry = &Config{
	Bootstrapper: NewSelfBootstrapper(),
	HandlerFunc: func(_ *Config, _ *mux.Router) error {
		return errors.New("not implemented")
	},
	AuthFunc: func() authenticator.Request {
		return union.New(nil)
	},
}

DefaultRegistry is the default instance of a Spegel distributed registry

Functions

func NewAgentBootstrapper

func NewAgentBootstrapper(server, token, dataDir string) routing.Bootstrapper

NewAgentBootstrapper returns a p2p bootstrapper that retrieves a peer address from its server

func NewChainingBootstrapper

func NewChainingBootstrapper(bootstrappers ...routing.Bootstrapper) routing.Bootstrapper

NewChainingBootstrapper returns a p2p bootstrapper that passes through to a list of bootstrappers.

func NewSelfBootstrapper

func NewSelfBootstrapper() routing.Bootstrapper

NewSelfBootstrapper returns a stub p2p bootstrapper that just returns its own ID

func NewServerBootstrapper

func NewServerBootstrapper(controlConfig *config.Control) routing.Bootstrapper

NewServerBootstrapper returns a p2p bootstrapper that returns an address from a random other cluster member.

Types

type Config

type Config struct {
	ClientCAFile   string
	ClientCertFile string
	ClientKeyFile  string

	ServerCAFile   string
	ServerCertFile string
	ServerKeyFile  string

	// ExternalAddress is the address for other nodes to connect to the registry API.
	ExternalAddress string

	// InternalAddress is the address for the local containerd instance to connect to the registry API.
	InternalAddress string

	// RegistryPort is the port for the registry API.
	RegistryPort string

	// PSK is the preshared key required to join the p2p network.
	PSK []byte

	// Bootstrapper is the bootstrapper that will be used to discover p2p peers.
	Bootstrapper routing.Bootstrapper

	// HandlerFunc will be called to add the registry API handler to an existing router.
	HandlerFunc handlerFunc

	// Authenticator will be called to retrieve an authenticator used to validate the request to the registry API.
	AuthFunc authFunc
}

Config holds fields for a distributed registry

func (*Config) InjectMirror

func (c *Config) InjectMirror(nodeConfig *config.Node) error

InjectMirror configures TLS for the registry mirror client, and adds the mirror address as an endpoint to all configured registries.

func (*Config) Start

func (c *Config) Start(ctx context.Context, nodeConfig *config.Node) error

Start starts the embedded p2p router, and binds the registry API to an existing HTTP router.

Jump to

Keyboard shortcuts

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