Documentation ¶
Index ¶
- type BackendPool
- type Backends
- func (b *Backends) Delete(name string) (err error)
- func (b *Backends) Ensure(svcPorts []utils.ServicePort, igLinks []string) error
- func (b *Backends) GC(svcPorts []utils.ServicePort) error
- func (b *Backends) Get(name string, version meta.Version) (*composite.BackendService, error)
- func (b *Backends) Init(pp ProbeProvider)
- func (b *Backends) Link(sp utils.ServicePort, zones []string) error
- func (b *Backends) List() ([]interface{}, error)
- func (b *Backends) Shutdown() error
- func (b *Backends) Status(name string) string
- type BalancingMode
- type FakeProbeProvider
- type NEGGetter
- type ProbeProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendPool ¶
type BackendPool interface { Init(p ProbeProvider) Ensure(ports []utils.ServicePort, igLinks []string) error Get(name string, version meta.Version) (*composite.BackendService, error) Delete(name string) error GC(ports []utils.ServicePort) error Shutdown() error Status(name string) string List() ([]interface{}, error) Link(port utils.ServicePort, zones []string) error }
BackendPool is an interface to manage a pool of kubernetes nodePort services as gce backendServices, and sync them through the BackendServices interface.
type Backends ¶
type Backends struct {
// contains filtered or unexported fields
}
Backends implements BackendPool.
func NewBackendPool ¶
func NewBackendPool( cloud *gce.GCECloud, negGetter NEGGetter, healthChecker healthchecks.HealthChecker, nodePool instances.NodePool, namer *utils.Namer, backendConfigEnabled, resyncWithCloud bool) *Backends
NewBackendPool returns a new backend pool. - cloud: implements BackendServices and syncs backends with a cloud provider - healthChecker: is capable of producing health checks for backends. - nodePool: implements NodePool, used to create/delete new instance groups. - namer: procudes names for backends. - ignorePorts: is a set of ports to avoid syncing/GCing. - resyncWithCloud: if true, periodically syncs with cloud resources.
func (*Backends) Ensure ¶
func (b *Backends) Ensure(svcPorts []utils.ServicePort, igLinks []string) error
Ensure will update or create Backends for the given ports.
func (*Backends) GC ¶
func (b *Backends) GC(svcPorts []utils.ServicePort) error
GC garbage collects services corresponding to ports in the given list.
func (*Backends) Init ¶
func (b *Backends) Init(pp ProbeProvider)
Init sets the probeProvider interface value
type BalancingMode ¶
type BalancingMode string
BalancingMode represents the loadbalancing configuration of an individual Backend in a BackendService. This is *effectively* a cluster wide setting since you can't mix modes across Backends pointing to the same IG, and you can't have a single node in more than 1 loadbalanced IG.
const ( // Rate balances incoming requests based on observed RPS. // As of this writing, it's the only balancing mode supported by GCE's // internal LB. This setting doesn't make sense for Kubernetes clusters // because requests can get proxied between instance groups in different // zones by kube-proxy without GCE even knowing it. Setting equal RPS on // all IGs should achieve roughly equal distribution of requests. Rate BalancingMode = "RATE" // Utilization balances incoming requests based on observed utilization. // This mode is only useful if you want to divert traffic away from IGs // running other compute intensive workloads. Utilization statistics are // aggregated per instances, not per container, and requests can get proxied // between instance groups in different zones by kube-proxy without GCE even // knowing about it. Utilization BalancingMode = "UTILIZATION" // Connections balances incoming requests based on a connection counter. // This setting currently doesn't make sense for Kubernetes clusters, // because we use NodePort Services as HTTP LB backends, so GCE's connection // counters don't accurately represent connections per container. Connections BalancingMode = "CONNECTION" )
type FakeProbeProvider ¶
type FakeProbeProvider struct {
// contains filtered or unexported fields
}
FakeProbeProvider implements the probeProvider interface for tests.
func NewFakeProbeProvider ¶
func NewFakeProbeProvider(probes map[utils.ServicePort]*api_v1.Probe) *FakeProbeProvider
NewFakeProbeProvider returns a struct which satisfies probeProvider interface
func (*FakeProbeProvider) GetProbe ¶
func (pp *FakeProbeProvider) GetProbe(port utils.ServicePort) (*api_v1.Probe, error)
GetProbe returns the probe for a given nodePort
type NEGGetter ¶
type NEGGetter interface {
GetNetworkEndpointGroup(name string, zone string) (*computebeta.NetworkEndpointGroup, error)
}
NEGGetter is an interface to retrieve NEG object
type ProbeProvider ¶
type ProbeProvider interface {
GetProbe(sp utils.ServicePort) (*api_v1.Probe, error)
}
ProbeProvider retrieves a probe struct given a nodePort