kubernetes.v0: gopkg.in/kubernetes/kubernetes.v0/pkg/proxy Index | Files | Directories

package proxy

import "gopkg.in/kubernetes/kubernetes.v0/pkg/proxy"

Package proxy implements the layer-3 network proxy.

Index

Package Files

doc.go loadbalancer.go port_allocator.go proxier.go proxysocket.go roundrobin.go udp_server.go

Variables

var (
    ErrMissingServiceEntry = errors.New("missing service entry")
    ErrMissingEndpoints    = errors.New("missing endpoints")
)
var (
    // ErrProxyOnLocalhost is returned by NewProxier if the user requests a proxier on
    // the loopback address. May be checked for by callers of NewProxier to know whether
    // the caller provided invalid input.
    ErrProxyOnLocalhost = fmt.Errorf("cannot proxy on localhost")
)

func IsProxyLocked Uses

func IsProxyLocked(err error) bool

IsProxyLocked returns true if the proxy could not acquire the lock on iptables.

type LoadBalancer Uses

type LoadBalancer interface {
    // NextEndpoint returns the endpoint to handle a request for the given
    // service-port and source address.
    NextEndpoint(service ServicePortName, srcAddr net.Addr) (string, error)
    NewService(service ServicePortName, sessionAffinityType api.ServiceAffinity, stickyMaxAgeMinutes int) error
    CleanupStaleStickySessions(service ServicePortName)
}

LoadBalancer is an interface for distributing incoming requests to service endpoints.

type LoadBalancerRR Uses

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

LoadBalancerRR is a round-robin load balancer.

func NewLoadBalancerRR Uses

func NewLoadBalancerRR() *LoadBalancerRR

NewLoadBalancerRR returns a new LoadBalancerRR.

func (*LoadBalancerRR) CleanupStaleStickySessions Uses

func (lb *LoadBalancerRR) CleanupStaleStickySessions(svcPort ServicePortName)

func (*LoadBalancerRR) NewService Uses

func (lb *LoadBalancerRR) NewService(svcPort ServicePortName, affinityType api.ServiceAffinity, ttlMinutes int) error

func (*LoadBalancerRR) NextEndpoint Uses

func (lb *LoadBalancerRR) NextEndpoint(svcPort ServicePortName, srcAddr net.Addr) (string, error)

NextEndpoint returns a service endpoint. The service endpoint is chosen using the round-robin algorithm.

func (*LoadBalancerRR) OnUpdate Uses

func (lb *LoadBalancerRR) OnUpdate(allEndpoints []api.Endpoints)

OnUpdate manages the registered service endpoints. Registered endpoints are updated if found in the update set or unregistered if missing from the update set.

type PortAllocator Uses

type PortAllocator interface {
    AllocateNext() (int, error)
    Release(int)
}

type Proxier Uses

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

Proxier is a simple proxy for TCP connections between a localhost:lport and services that provide the actual implementations.

func NewProxier Uses

func NewProxier(loadBalancer LoadBalancer, listenIP net.IP, iptables iptables.Interface, pr util.PortRange) (*Proxier, error)

NewProxier returns a new Proxier given a LoadBalancer and an address on which to listen. Because of the iptables logic, It is assumed that there is only a single Proxier active on a machine. An error will be returned if the proxier cannot be started due to an invalid ListenIP (loopback) or if iptables fails to update or acquire the initial lock. Once a proxier is created, it will keep iptables up to date in the background and will not terminate if a particular iptables call fails.

func (*Proxier) OnUpdate Uses

func (proxier *Proxier) OnUpdate(services []api.Service)

OnUpdate manages the active set of service proxies. Active service proxies are reinitialized if found in the update set or shutdown if missing from the update set.

func (*Proxier) SyncLoop Uses

func (proxier *Proxier) SyncLoop()

SyncLoop runs periodic work. This is expected to run as a goroutine or as the main loop of the app. It does not return.

type ServicePortName Uses

type ServicePortName struct {
    types.NamespacedName
    Port string
}

ServicePortName carries a namespace + name + portname. This is the unique identfier for a load-balanced service.

func (ServicePortName) String Uses

func (spn ServicePortName) String() string

Directories

PathSynopsis
configPackage config provides decoupling between various configuration sources (etcd, files,...) and the pieces that actually care about them (loadbalancer, proxy).

Package proxy imports 19 packages (graph). Updated 2016-07-25. Refresh now. Tools for package owners.