siderolink

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package siderolink provides server-side implementation of the SideroLink API.

Index

Constants

View Source
const EventsSinkPort = 4002

EventsSinkPort is the port of the events sink container.

EventsSinkPort is working only over wireguard.

View Source
const LogReceiverPort = 4001

LogReceiverPort is the port of the log receiver container.

LogReceiverPort is working only over Wireguard.

View Source
const SecretName = "siderolink"

SecretName is the name of the Secret Sidero stores information about siderolink installation.

Secret holds private Sidero Wireguard key and installation ID.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	ServerUUID       string
	Namespace        string
	MetalMachineName string
	MachineName      string
	ClusterName      string
}

Annotation describes the source server by SideroLink IP address.

type Annotator

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

Annotator keeps a cache of annotations per SideroLink IP address.

func NewAnnotator

func NewAnnotator(metalClient runtimeclient.Client, kubeconfig *rest.Config, logger *zap.Logger) *Annotator

NewAnnotator initializes new server.

func (*Annotator) Get

func (a *Annotator) Get(addr string) (Annotation, bool)

func (*Annotator) Run

func (a *Annotator) Run(ctx context.Context) error

Run the watch loop on ServerBindings to build the annotation database.

type Config

type Config struct {
	InstallationID    string
	PrivateKey        wgtypes.Key
	PublicKey         wgtypes.Key
	WireguardEndpoint string
	Subnet            netip.Prefix
	ServerAddress     netip.Prefix
}

Config is the internal SideroLink configuration.

var Cfg Config

Cfg is a default global instance of the SideroLink configuration.

Cfg should be initialized first with `LoadOrCreate`.

func (*Config) LoadOrCreate

func (cfg *Config) LoadOrCreate(ctx context.Context, metalClient runtimeclient.Client) error

type PeerState

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

PeerState syncs data from Kubernetes ServerBinding as peer state.

func NewPeerState

func NewPeerState(kubeconfig *rest.Config, logger *zap.Logger) *PeerState

NewPeerState initializes PeerState.

func (*PeerState) EventCh

func (peers *PeerState) EventCh() <-chan wireguard.PeerEvent

EventCh implements the wireguard.PeerSource interface.

func (*PeerState) Run

func (peers *PeerState) Run(ctx context.Context) error

Run the watch loop reporting peer state changes.

type Server

type Server struct {
	pb.UnimplementedProvisionServiceServer
	// contains filtered or unexported fields
}

Server implements gRPC API.

func NewServer

func NewServer(cfg *Config, metalClient runtimeclient.Client) *Server

NewServer initializes new server.

func (*Server) Provision

func (srv *Server) Provision(ctx context.Context, req *pb.ProvisionRequest) (*pb.ProvisionResponse, error)

Provision the SideroLink for the server by UUID.

Jump to

Keyboard shortcuts

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