Documentation
¶
Overview ¶
Package controlplane wraps generic TCP loadbalancer for Kubernetes controlplane endpoint LB.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoadBalancer ¶
type LoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer provides Kubernetes control plane TCP loadbalancer with a way to update endpoints (list of control plane nodes).
func NewLoadBalancer ¶
func NewLoadBalancer(bindAddress string, bindPort int, logWriter io.Writer, options ...LoadBalancerOption) (*LoadBalancer, error)
NewLoadBalancer initializes the load balancer.
If bindPort is zero, load balancer will bind to a random available port.
func (*LoadBalancer) Endpoint ¶
func (lb *LoadBalancer) Endpoint() string
Endpoint returns loadbalancer endpoint as "host:port".
func (*LoadBalancer) Healthy ¶
func (lb *LoadBalancer) Healthy() (bool, error)
Healthy returns true if at least one upstream is available.
func (*LoadBalancer) Shutdown ¶
func (lb *LoadBalancer) Shutdown() error
Shutdown the loadbalancer listener and wait for the connections to be closed.
func (*LoadBalancer) Start ¶
func (lb *LoadBalancer) Start(upstreamCh <-chan []string) error
Start the loadbalancer providing a channel which provides endpoint list update.
Load balancer starts with an empty list of endpoints, so initial list should be provided on the channel.
type LoadBalancerOption ¶
type LoadBalancerOption func(*LoadBalancer)
LoadBalancerOption configures the load balancer settings.
func WithDialTimeout ¶
func WithDialTimeout(timeout time.Duration) LoadBalancerOption
WithDialTimeout configures the dial timeout.
func WithHealthCheckOptions ¶
func WithHealthCheckOptions(options ...upstream.ListOption) LoadBalancerOption
WithHealthCheckOptions configures the health check options.
func WithKeepAlivePeriod ¶
func WithKeepAlivePeriod(period time.Duration) LoadBalancerOption
WithKeepAlivePeriod configures the keepalive period.
func WithTCPUserTimeout ¶
func WithTCPUserTimeout(timeout time.Duration) LoadBalancerOption
WithTCPUserTimeout configures the TCP user timeout.