controller

package
v0.0.0-...-9a9a1f8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package controller implements logic for following MetalLB announce events and passing them to configured platform-specific Floating IP assigners.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assigner

type Assigner interface {
	EnsureAssigned(ctx context.Context, nodeAnnouncingByIP map[string]string) error
}

Assigner describes an interface which must be implemented by cloud platform specific implementation to assign Floating IP addresses to cluster nodes.

type Klogger

type Klogger struct{}

Klogger is a default Logger interface implementation using klog.

func (Klogger) Debugf

func (k Klogger) Debugf(format string, a ...interface{})

Debugf implements Logger interface using klog.Infof with log level defined by klogLevelDebug constant.

func (Klogger) Errorf

func (k Klogger) Errorf(format string, a ...interface{})

Errorf implements Logger interface using klog.Errorf.

func (Klogger) Infof

func (k Klogger) Infof(format string, a ...interface{})

Infof implements Logger interface using klog.Infof.

func (Klogger) Write

func (k Klogger) Write(p []byte) (int, error)

Write implements Logger interface using klog.Infof with log level defined by klogLevelDebug constant.

type Logger

type Logger interface {
	// Logger should implement writer interface for writing debug logs.
	io.Writer

	// Errorf should be used for logging non-critical (operational) failures.
	Errorf(format string, a ...interface{})

	// Infof should be used to log details about activity happening.
	Infof(format string, a ...interface{})

	// Debugf should be used to log as much details as possible.
	Debugf(format string, a ...interface{})
}

Logger is an logging interface used by this controller. Default implementation is provided by Klogger struct, however other implementations can be configured and used.

type MetalLBHCloudControllerConfig

type MetalLBHCloudControllerConfig struct {
	// Path to kubeconfig file to use. If empty, either in-cluster kubeconfig file will
	// be used or will fallback to use ~/.kube/config file.
	KubeconfigPath string

	// Logger implementation to use. If omitted, Klogger will be used.
	Logger Logger

	// Map of assigner implementations, where alternative assigner implementations can
	// be added.
	Assigners map[string]Assigner

	// Channel on which controller will look for shutdown signal. If nil, channel will be
	// initialized and it is up to the caller to close it.
	StopCh <-chan struct{}

	// Optional Prometheus Registerer to register controller metrics.
	PrometheusRegistrer prometheus.Registerer
}

MetalLBHCloudControllerConfig is used to configure and run MetalLB Hetzner Cloud controller.

func (MetalLBHCloudControllerConfig) New

func (cc MetalLBHCloudControllerConfig) New() (*metalLBHCloudController, error)

New Validates controller configuration and starts the controller.

Jump to

Keyboard shortcuts

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