host

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewMeshNode = meshnode.NewWithLogger

NewNode is the function for creating a new mesh node. Declared as a variable for testing purposes.

Functions

This section is empty.

Types

type Config

type Config struct {
	// NodeID is the ID of the node.
	NodeID string `koanf:"node-id"`
	// Namespace is the namespace of the node.
	Namespace string `koanf:"namespace,omitempty"`
	// LockDuration is the duration to hold locks for when allocating addresses.
	LockDuration time.Duration `koanf:"lock-duration,omitempty"`
	// LockAcquireTimeout is the timeout for acquiring locks when allocating addresses.
	LockAcquireTimeout time.Duration `koanf:"lock-acquire-timeout,omitempty"`
	// ConnectTimeout is the timeout for connecting the host webmesh node to the network.
	ConnectTimeout time.Duration `koanf:"connect-timeout,omitempty"`
	// Auth are configuration options for authenticating with other nodes.
	Auth config.AuthOptions `koanf:"auth,omitempty"`
	// WireGuard are configurations for the WireGuard interface.
	WireGuard config.WireGuardOptions `koanf:"wireguard,omitempty"`
	// Services is the service options for the host webmesh node.
	Services config.ServiceOptions `koanf:"services,omitempty"`
	// Plugins is the plugin options for the host webmesh node.
	Plugins config.PluginOptions `koanf:"plugins,omitempty"`
	// Network is the network options for the host webmesh node.
	Network NetworkConfig `koanf:"network,omitempty"`
	// LogLevel is the log level for the host webmesh node.
	LogLevel string `koanf:"log-level,omitempty"`
}

Config contains the options for the host node.

func NewDefaultConfig

func NewDefaultConfig() Config

NewDefaultConfig returns a new default configuration for the host webmesh node.

func (*Config) BindFlags

func (o *Config) BindFlags(prefix string, fs *pflag.FlagSet)

func (*Config) Validate

func (o *Config) Validate() error

type NetworkConfig

type NetworkConfig struct {
	// RemoteEndpointDetection enables remote endpoint detection for wireguard endpoints.
	RemoteEndpointDetection bool `koanf:"remote-endpoint-detection,omitempty"`
	// IPv4CIDR is the IPv4 CIDR to use for the network.
	IPv4CIDR string `koanf:"ipv4-cidr,omitempty"`
	// ClusterDomain is the cluster domain to use for the network.
	ClusterDomain string `koanf:"cluster-domain,omitempty"`
	// DisableIPv4 disables IPv4 on the host webmesh node.
	DisableIPv4 bool `koanf:"disable-ipv4,omitempty"`
	// DisableIPv6 disables IPv6 on the host webmesh node.
	DisableIPv6 bool `koanf:"disable-ipv6,omitempty"`
}

NetworkConfig contains the options for the network.

func NewNetworkConfig

func NewNetworkConfig() NetworkConfig

func (*NetworkConfig) BindFlags

func (n *NetworkConfig) BindFlags(prefix string, fs *pflag.FlagSet)

func (*NetworkConfig) Validate

func (n *NetworkConfig) Validate() error

type Node

type Node interface {
	// ID returns the ID of the host node.
	ID() meshtypes.NodeID
	// Start starts the host node.
	Start(ctx context.Context, cfg *rest.Config) error
	// Started returns true if the host node has been started.
	Started() bool
	// Stop stops the host node. This is also closes the underlying
	// storage provider.
	Stop(ctx context.Context) error
	// IPAM returns the IPv4 address allocator. This will be nil until
	// Start is called.
	IPAM() ipam.Allocator
	// Node returns the underlying mesh node. This will be nil until
	// Start is called.
	Node() meshnode.Node
	// NodeLogger returns the node's logger.
	NodeLogger() *slog.Logger
}

Node is a representation of the host node running the CNI plugin and allocating addresses for containers. This is the node that all containers on the system peer with for access to the rest of the cluster and/or the internet.

func NewNode

func NewNode(storage meshstorage.Provider, opts Config) Node

NewNode creates a new host node.

Jump to

Keyboard shortcuts

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