loadbalancer

package
Version: v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeAddress added in v0.7.1

func NodeAddress(node v1.Node) (string, error)

Types

type AddressPool

type AddressPool struct {
	Name       string   `json:"name" yaml:"name"`
	Protocol   string   `json:"protocol" yaml:"protocol"`
	AutoAssign *bool    `json:"auto-assign" yaml:"auto-assign,omitempty"`
	CIDRs      []string `json:"addresses,omitempty" yaml:"addresses,omitempty"` // It is assumed that only /32 addresses are used.
}

func NewBGPAddressPool

func NewBGPAddressPool(name string, autoAssign bool) *AddressPool

func (*AddressPool) String

func (pool *AddressPool) String() string

type LoadBalancerController

type LoadBalancerController struct {
	K8sClient clientset.Interface
	// contains filtered or unexported fields
}

func New

func New(client metalgo.Client, partitionID, projectID, clusterID, defaultExternalNetworkID string, additionalNetworks []string) *LoadBalancerController

New returns a new load balancer controller that satisfies the kubernetes cloud provider load balancer interface

func (*LoadBalancerController) EnsureLoadBalancer

func (l *LoadBalancerController) EnsureLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) (*v1.LoadBalancerStatus, error)

EnsureLoadBalancer ensures that the cluster is running a load balancer for service. It creates a new load balancer or updates the existing one. Returns the status of the balancer. Neither 'service' nor 'nodes' are modified. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.

func (*LoadBalancerController) EnsureLoadBalancerDeleted

func (l *LoadBalancerController) EnsureLoadBalancerDeleted(ctx context.Context, clusterName string, service *v1.Service) error

EnsureLoadBalancerDeleted deletes the cluster load balancer if it exists, returning nil if the load balancer specified either didn't exist or was successfully deleted. This construction is useful because many cloud providers' load balancers have multiple underlying components, meaning a Get could say that the LB doesn't exist even if some part of it is still laying around. Parameter 'service' is not modified. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager

func (*LoadBalancerController) GetLoadBalancer

func (l *LoadBalancerController) GetLoadBalancer(ctx context.Context, clusterName string, service *v1.Service) (status *v1.LoadBalancerStatus, exists bool, err error)

GetLoadBalancer returns whether the specified load balancer exists, and if so, what its status is. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.

func (*LoadBalancerController) GetLoadBalancerName

func (l *LoadBalancerController) GetLoadBalancerName(ctx context.Context, clusterName string, service *v1.Service) string

GetLoadBalancerName returns the name of the load balancer.

func (*LoadBalancerController) UpdateLoadBalancer

func (l *LoadBalancerController) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error

UpdateLoadBalancer updates hosts under the specified load balancer. Neither 'service' nor 'nodes' are modified. Parameter 'clusterName' is the name of the cluster as presented to kube-controller-manager.

func (*LoadBalancerController) UpdateMetalLBConfig

func (l *LoadBalancerController) UpdateMetalLBConfig(ctx context.Context, nodes []v1.Node) error

UpdateMetalLBConfig the metallb config for given nodes

type MatchExpression

type MatchExpression struct {
	Key      string   `json:"key" yaml:"key"`
	Operator string   `json:"operator" yaml:"operator"`
	Values   []string `json:"values,omitempty" yaml:"values,omitempty"`
}

type MetalLBConfig

type MetalLBConfig struct {
	Peers        []*Peer        `json:"peers,omitempty" yaml:"peers,omitempty"`
	AddressPools []*AddressPool `json:"address-pools,omitempty" yaml:"address-pools,omitempty"`
	// contains filtered or unexported fields
}

MetalLBConfig is a struct containing a config for metallb

func (*MetalLBConfig) CalculateConfig

func (cfg *MetalLBConfig) CalculateConfig(ips []*models.V1IPResponse, nws sets.String, nodes []v1.Node) error

CalculateConfig computes the metallb config from given parameter input.

func (*MetalLBConfig) ToYAML

func (cfg *MetalLBConfig) ToYAML() (string, error)

ToYAML returns this config in YAML format.

func (*MetalLBConfig) Write

func (cfg *MetalLBConfig) Write(ctx context.Context, client clientset.Interface) error

Write inserts or updates the Metal-LB config.

type NodeSelector

type NodeSelector struct {
	MatchExpressions []*MatchExpression `json:"match-expressions,omitempty" yaml:"match-expressions,omitempty"`
}

type Peer

type Peer struct {
	MyASN         int64           `json:"my-asn" yaml:"my-asn"`
	ASN           int64           `json:"peer-asn" yaml:"peer-asn"`
	Address       string          `json:"peer-address" yaml:"peer-address"`
	NodeSelectors []*NodeSelector `json:"node-selectors,omitempty" yaml:"node-selectors,omitempty"`
}

Jump to

Keyboard shortcuts

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