manager

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Overview

Package manager provides functionality relating to the integration between Cilium and MetalLB, namely providing abstractions that help manage MetalLB from Cilium.

Package manager abstracts the BGP speaker controller from MetalLB. This package provides BGP announcements based on K8s object event handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	SetBalancer(name string, srvRo *v1.Service, eps k8s.EpsOrSlices) types.SyncState
	MarkSynced()
}

Controller provides a method set for interfacing with a BGP Controller.

This interface is heavily modeled after MetalLB's controller as it's the first BGP integration for Cilium's use cases.

If other BGP integrations are desired, consider building out custom types and a more abstracted method set.

type Manager

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

Manager represents the BGP manager. It integrates Cilium with the MetalLB logic for allocating LB IPs for service objects of type LoadBalancer.

This manager also subscribes and handles K8s services events from the watcher and pushes them into a queue. From the queue, they are processed by the reconciliation logic of MetalLB for LB IP allocation. To do this, Manager implements github.com/cilium/cilium/pkg/k8s/watchers/subscriber.Service and therefore is registered as a subscriber to the subscriber package to be called from the K8s watcher.

Note that the LB IP allocation occurs only for services of type LoadBalancer in the service.Status.LoadBalancerStatus.Ingress field.

func New

func New(ctx context.Context, indexer cache.Store) (*Manager, error)

New creates a new BGP MetalLB manager. It contains the MetalLB service IP controller, which contains the allocator.

New requires access to a cache.Store associated with the service watcher.

func (*Manager) MarkSynced

func (m *Manager) MarkSynced()

func (*Manager) OnAddService

func (m *Manager) OnAddService(obj *slim_corev1.Service) error

OnAddService handles an add event for services. It implements github.com/cilium/cilium/pkg/k8s/watchers/subscriber.ServiceHandler.

func (*Manager) OnDeleteService

func (m *Manager) OnDeleteService(obj *slim_corev1.Service) error

OnDeleteService handles a delete event for services. It implements github.com/cilium/cilium/pkg/k8s/watchers/subscriber.ServiceHandler.

func (*Manager) OnUpdateService

func (m *Manager) OnUpdateService(oldObj, newObj *slim_corev1.Service) error

OnUpdateService handles an update event for services. It implements github.com/cilium/cilium/pkg/k8s/watchers/subscriber.ServiceHandler.

Jump to

Keyboard shortcuts

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