host

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: Apache-2.0 Imports: 29 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"`
	// PodCIDR is a comma separated list of CIDRs to use for the pod network.
	// If no IPv6 CIDR is provided, one will be generated.
	PodCIDR string `koanf:"pod-cidr,omitempty"`
	// ServiceCIDR is a comma-separated list of CIDRs to use for the service network.
	ServiceCIDR string `koanf:"service-cidr,omitempty"`
	// ClusterDomain is the cluster domain to use for the network.
	ClusterDomain string `koanf:"cluster-domain,omitempty"`
	// Routes to allow for container and other connected node traffic.
	Routes []string `koanf:"routes,omitempty"`
	// WriteResolvConf will add any MeshDNS servers to the system resolv.conf.
	WriteResolvConf bool `koanf:"write-resolv-conf,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"`
	// DisableRBAC disables RBAC controls on the webmesh network.
	// This only takes during initial cluster bootstrap.
	DisableRBAC bool `koanf:"disable-rbac,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) CIDRs added in v0.0.18

func (n *NetworkConfig) CIDRs() endpoints.PrefixList

CIDRs returns all CIDRs.

func (*NetworkConfig) CIDRsContain added in v0.0.18

func (n *NetworkConfig) CIDRsContain(prefix netip.Prefix) bool

CIDRsContain checks if the local CIDRs contain the given prefix.

func (*NetworkConfig) PodCIDRs added in v0.0.18

func (n *NetworkConfig) PodCIDRs() endpoints.PrefixList

PodCIDRs returns the pod CIDRs.

func (*NetworkConfig) ServiceCIDRs added in v0.0.18

func (n *NetworkConfig) ServiceCIDRs() endpoints.PrefixList

ServiceCIDRs returns the service CIDRs.

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
	// NodeContext returns a context with the node's logger.
	NodeContext(context.Context) context.Context
}

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