config

package
v0.14.8 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Protocols = []Proto{
	BGP, Layer2,
}

Functions

func DiscardFRROnly added in v0.12.0

func DiscardFRROnly(c ClusterResources) error

DiscardFRROnly returns an error if the current configFile contains any options that are available only in the FRR implementation.

func DiscardNativeOnly added in v0.12.0

func DiscardNativeOnly(c ClusterResources) error

DiscardNativeOnly returns an error if the current configFile contains any options that are available only in the native implementation.

func DontValidate added in v0.12.0

func DontValidate(c ClusterResources) error

DontValidate is a Validate function that always returns success.

func NewValidator added in v0.13.0

func NewValidator(validate Validate) apivalidate.ClusterObjects

func ParseCIDR added in v0.11.0

func ParseCIDR(cidr string) ([]*net.IPNet, error)

Types

type BFDProfile added in v0.12.0

type BFDProfile struct {
	Name             string
	ReceiveInterval  *uint32
	TransmitInterval *uint32
	DetectMultiplier *uint32
	EchoInterval     *uint32
	EchoMode         bool
	PassiveMode      bool
	MinimumTTL       *uint32
}

BFDProfile describes a BFD profile to be applied to a set of peers.

type BGPAdvertisement added in v0.3.0

type BGPAdvertisement struct {
	// The name of the advertisement
	Name string
	// Roll up the IP address into a CIDR prefix of this
	// length. Optional, defaults to 32 (i.e. no aggregation) if not
	// specified.
	AggregationLength int
	// Optional, defaults to 128 (i.e. no aggregation) if not
	// specified.
	AggregationLengthV6 int
	// Value of the LOCAL_PREF BGP path attribute. Used only when
	// advertising to IBGP peers (i.e. Peer.MyASN == Peer.ASN).
	LocalPref uint32
	// Value of the COMMUNITIES path attribute.
	Communities map[community.BGPCommunity]bool
	// The map of nodes allowed for this advertisement
	Nodes map[string]bool
	// Used to declare the intent of announcing IPs
	// only to the BGPPeers in this list.
	Peers []string
}

BGPAdvertisement describes one translation from an IP address to a BGP advertisement.

type ClusterResources added in v0.13.0

type ClusterResources struct {
	Pools           []metallbv1beta1.IPAddressPool    `json:"ipaddresspools"`
	Peers           []metallbv1beta2.BGPPeer          `json:"bgppeers"`
	BFDProfiles     []metallbv1beta1.BFDProfile       `json:"bfdprofiles"`
	BGPAdvs         []metallbv1beta1.BGPAdvertisement `json:"bgpadvertisements"`
	L2Advs          []metallbv1beta1.L2Advertisement  `json:"l2advertisements"`
	Communities     []metallbv1beta1.Community        `json:"communities"`
	PasswordSecrets map[string]corev1.Secret          `json:"passwordsecrets"`
	Nodes           []corev1.Node                     `json:"nodes"`
	Namespaces      []corev1.Namespace                `json:"namespaces"`
	BGPExtras       corev1.ConfigMap                  `json:"bgpextras"`
}

type Config

type Config struct {
	// Routers that MetalLB should peer with.
	Peers map[string]*Peer
	// Address pools from which to allocate load balancer IPs.
	Pools *Pools
	// BFD profiles that can be used by peers.
	BFDProfiles map[string]*BFDProfile
	// Protocol dependent extra config. Currently used only by FRR
	BGPExtras string
}

Config is a parsed MetalLB configuration.

func For added in v0.13.0

func For(resources ClusterResources, validate Validate) (*Config, error)

Parse loads and validates a Config from bs.

type L2Advertisement added in v0.13.0

type L2Advertisement struct {
	// The map of nodes allowed for this advertisement
	Nodes map[string]bool
	// The interfaces in Nodes allowed for this advertisement
	Interfaces []string
	// AllInterfaces tells if all the interfaces are allowed for this advertisement
	AllInterfaces bool
}

type Peer

type Peer struct {
	// Peer name.
	Name string
	// AS number to use for the local end of the session.
	MyASN uint32
	// AS number to expect from the remote end of the session.
	ASN uint32
	// Address to dial when establishing the session.
	Addr net.IP
	// Source address to use when establishing the session.
	SrcAddr net.IP
	// Port to dial when establishing the session.
	Port uint16
	// Requested BGP hold time, per RFC4271.
	HoldTime time.Duration
	// Requested BGP keepalive time, per RFC4271.
	KeepaliveTime time.Duration
	// Requested BGP connect time, controls how long BGP waits between connection attempts to a neighbor.
	ConnectTime *time.Duration
	// BGP router ID to advertise to the peer
	RouterID net.IP
	// Only connect to this peer on nodes that match one of these
	// selectors.
	NodeSelectors []labels.Selector
	// Authentication password for routers enforcing TCP MD5 authenticated sessions
	Password string
	// The password set in the secret referenced by the secret reference, in clear text
	SecretPassword string
	// Optional reference to the secret that holds the password.
	PasswordRef corev1.SecretReference
	// The optional BFD profile to be used for this BGP session
	BFDProfile string
	// Optional EnableGracefulRestart enable BGP graceful restart functionality at the peer level.
	EnableGracefulRestart bool
	// Optional ebgp peer is multi-hops away.
	EBGPMultiHop bool
	// Optional name of the vrf to establish the session from
	VRF string
	// Option to disable MP BGP that will result in separation of IPv4 and IPv6 route exchanges into distinct BGP sessions.
	DisableMP bool
}

Peer is the configuration of a BGP peering session.

type Pool

type Pool struct {
	// Pool Name
	Name string
	// The addresses that are part of this pool, expressed as CIDR
	// prefixes. config.Parse guarantees that these are
	// non-overlapping, both within and between pools.
	CIDR []*net.IPNet
	// Some buggy consumer devices mistakenly drop IPv4 traffic for IP
	// addresses ending in .0 or .255, due to poor implementations of
	// smurf protection. This setting marks such addresses as
	// unusable, for maximum compatibility with ancient parts of the
	// internet.
	AvoidBuggyIPs bool
	// If false, prevents IP addresses to be automatically assigned
	// from this pool.
	AutoAssign bool

	// The list of BGPAdvertisements associated with this address pool.
	BGPAdvertisements []*BGPAdvertisement

	// The list of L2Advertisements associated with this address pool.
	L2Advertisements []*L2Advertisement

	ServiceAllocations *ServiceAllocation
	// contains filtered or unexported fields
}

Pool is the configuration of an IP address pool.

type Pools added in v0.13.8

type Pools struct {
	// ByName a map containing all configured pools.
	ByName map[string]*Pool
	// ByNamespace contains pool names pinned to specific namespace.
	ByNamespace map[string][]string
	// ByServiceSelector contains pool names which has service selection labels.
	ByServiceSelector []string
}

Pools contains address pools and its namespace/service specific allocations.

func (*Pools) IsEmpty added in v0.13.8

func (p *Pools) IsEmpty(pool string) bool

type Proto added in v0.3.0

type Proto string

Proto holds the protocol we are speaking.

const (
	BGP    Proto = "bgp"
	Layer2 Proto = "layer2"
)

MetalLB supported protocols.

type ServiceAllocation added in v0.13.8

type ServiceAllocation struct {
	// The priority of ip pool for a given service allocation.
	Priority int
	// Set of namespaces on which ip pool can be attached.
	Namespaces sets.Set[string]
	// Service selectors to select service for which ip pool can be used
	// for ip allocation.
	ServiceSelectors []labels.Selector
}

ServiceAllocation makes ip pool allocation to specific namespace and/or service.

type TransientError added in v0.13.0

type TransientError struct {
	Message string
}

TransientError is an error that happens due to interdependencies between crds, such as referencing non-existing bfd profile.

func (TransientError) Error added in v0.13.0

func (e TransientError) Error() string

type Validate added in v0.12.0

type Validate func(ClusterResources) error

func ValidationFor added in v0.13.0

func ValidationFor(bgpImpl string) Validate

Jump to

Keyboard shortcuts

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