Documentation
¶
Index ¶
- Constants
- func GetProtocol(svcPorts []api_v1.ServicePort) string
- type BalancingMode
- type FakeProbeProvider
- type GroupKey
- type L4BackendServiceParams
- type Linker
- type LocalityLBPolicyType
- type NEGGetter
- type Pool
- func (p *Pool) AddSignedURLKey(be *composite.BackendService, signedurlkey *composite.SignedUrlKey, ...) error
- func (p *Pool) Create(sp utils.ServicePort, hcLink string, beLogger klog.Logger) (*composite.BackendService, error)
- func (p *Pool) Delete(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) error
- func (p *Pool) DeleteSignedURLKey(be *composite.BackendService, keyName string, urlKeyLogger klog.Logger) error
- func (p *Pool) EnsureL4BackendService(params L4BackendServiceParams, beLogger klog.Logger) (*composite.BackendService, utils.ResourceSyncStatus, error)
- func (p *Pool) Get(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (*composite.BackendService, error)
- func (p *Pool) Health(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (string, error)
- func (p *Pool) List(key *meta.Key, version meta.Version, beLogger klog.Logger) ([]*composite.BackendService, error)
- func (p *Pool) Update(be *composite.BackendService, beLogger klog.Logger) error
- type ProbeProvider
- type RegionalInstanceGroupLinker
- type Syncer
- func (s *Syncer) GC(svcPorts []utils.ServicePort, ingLogger klog.Logger) error
- func (s *Syncer) Shutdown() error
- func (s *Syncer) Status(name string, version meta.Version, scope meta.KeyType, ingLogger klog.Logger) (string, error)
- func (s *Syncer) Sync(svcPorts []utils.ServicePort, ingLogger klog.Logger) error
Constants ¶
const ( DefaultConnectionDrainingTimeoutSeconds = 30 PerSessionTrackingMode = "PER_SESSION" // the only one supported with strong session affinity )
const ( // ProtocolL3 is the value used for Protocol when creating L3 Backend Service ProtocolL3 = "UNSPECIFIED" // ProtocolTCP is the value used for Protocol when creating TCP Backend Service ProtocolTCP = "TCP" // ProtocolUDP is the value used for Protocol when creating UDP Backend Service ProtocolUDP = "UDP" )
Variables ¶
This section is empty.
Functions ¶
func GetProtocol ¶ added in v1.34.0
func GetProtocol(svcPorts []api_v1.ServicePort) string
GetProtocol returns the protocol for the BackendService based on Kubernetes Service port definitions.
Types ¶
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 GroupKey ¶ added in v1.4.0
GroupKey represents a single group for a backend. The implementation of this Group could be InstanceGroup or NEG.
type L4BackendServiceParams ¶ added in v1.30.0
type L4BackendServiceParams struct { Name string HealthCheckLink string Protocol string SessionAffinity string Scheme string NamespacedName types.NamespacedName NetworkInfo *network.NetworkInfo ConnectionTrackingPolicy *composite.BackendServiceConnectionTrackingPolicy LocalityLbPolicy LocalityLBPolicyType }
L4BackendServiceParams encapsulates parameters for ensuring an L4 BackendService.
type Linker ¶ added in v1.4.0
type Linker interface { // Link a BackendService to its groups. Link(sp utils.ServicePort, groups []GroupKey) error }
Linker is an interface to link backends with their associated groups.
func NewInstanceGroupLinker ¶ added in v1.4.0
func NewInstanceGroupLinker(instancePool instancegroups.Manager, backendPool *Pool, logger klog.Logger) Linker
NewInstanceGroupLinker creates a new instance of Linker
type LocalityLBPolicyType ¶ added in v1.31.0
type LocalityLBPolicyType string
LocalityLBPolicyType is the type of locality lb policy the backend service should use.
const ( // LocalityLBPolicyDefault is the default locality lb policy for a backend service. LocalityLBPolicyDefault LocalityLBPolicyType = "" // LocalityLBPolicyWeightedMaglev is the locality lb policy for weighted load balancing by pods-per-node. LocalityLBPolicyWeightedMaglev LocalityLBPolicyType = "WEIGHTED_MAGLEV" // LocalityLBPolicyMaglev is the locality lb policy when weighted load balancing by pods-per-node is disabled. LocalityLBPolicyMaglev LocalityLBPolicyType = "MAGLEV" )
type NEGGetter ¶
type NEGGetter interface {
GetNetworkEndpointGroup(name string, zone string, version meta.Version, logger klog.Logger) (*composite.NetworkEndpointGroup, error)
}
NEGGetter is an interface to retrieve NEG object
type Pool ¶ added in v1.4.0
type Pool struct {
// contains filtered or unexported fields
}
Pool handles CRUD operations on a pool of GCE Backend Services.
func NewPool ¶ added in v1.4.0
func NewPool(cloud *gce.Cloud, namer namer.BackendNamer) *Pool
NewPool returns a new backend pool. - cloud: implements BackendServices - namer: produces names for backends.
func NewPoolWithConnectionTrackingPolicy ¶ added in v1.26.0
func NewPoolWithConnectionTrackingPolicy(cloud *gce.Cloud, namer namer.BackendNamer, useConnectionTrackingPolicy bool) *Pool
NewPoolWithConnectionTrackingPolicy returns a new backend pool. It is similar to NewPool() but has a field for ConnectionTrackingPolicy flag - cloud: implements BackendServices - namer: produces names for backends. - useConnectionTrackingPolicy: specifies the need in Connection Tracking Policy configuration
func (*Pool) AddSignedURLKey ¶ added in v1.34.0
func (p *Pool) AddSignedURLKey(be *composite.BackendService, signedurlkey *composite.SignedUrlKey, urlKeyLogger klog.Logger) error
AddSignedURLKey adds a SignedUrlKey to a BackendService
func (*Pool) Create ¶ added in v1.4.0
func (p *Pool) Create(sp utils.ServicePort, hcLink string, beLogger klog.Logger) (*composite.BackendService, error)
Create a composite BackendService and returns it.
func (*Pool) Delete ¶ added in v1.4.0
func (p *Pool) Delete(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) error
Delete a BackendService given its name.
func (*Pool) DeleteSignedURLKey ¶ added in v1.34.0
func (p *Pool) DeleteSignedURLKey(be *composite.BackendService, keyName string, urlKeyLogger klog.Logger) error
DeleteSignedURLKey deletes a SignedUrlKey from BackendService
func (*Pool) EnsureL4BackendService ¶ added in v1.34.0
func (p *Pool) EnsureL4BackendService(params L4BackendServiceParams, beLogger klog.Logger) (*composite.BackendService, utils.ResourceSyncStatus, error)
EnsureL4BackendService creates or updates the backend service with the given name.
func (*Pool) Get ¶ added in v1.4.0
func (p *Pool) Get(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (*composite.BackendService, error)
Get a composite BackendService given a required version.
func (*Pool) Health ¶ added in v1.4.0
func (p *Pool) Health(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (string, error)
Health checks the health of a BackendService given its name. Returns ("HEALTHY", nil) if healthy, otherwise ("Unknown", err)
type ProbeProvider ¶
type ProbeProvider interface {
GetProbe(sp utils.ServicePort) (*api_v1.Probe, error)
}
ProbeProvider retrieves a probe struct given a nodePort
type RegionalInstanceGroupLinker ¶ added in v1.15.0
type RegionalInstanceGroupLinker struct {
// contains filtered or unexported fields
}
RegionalInstanceGroupLinker handles linking backends to InstanceGroups.
func NewRegionalInstanceGroupLinker ¶ added in v1.15.0
func NewRegionalInstanceGroupLinker(instancePool instancegroups.Manager, backendPool *Pool, logger klog.Logger) *RegionalInstanceGroupLinker
NewRegionalInstanceGroupLinker creates an instance of RegionalInstanceGroupLinker
func (*RegionalInstanceGroupLinker) Link ¶ added in v1.15.0
func (linker *RegionalInstanceGroupLinker) Link(sp utils.ServicePort, projectID string, zones []string) error
Link performs linking instance groups to regional backend service
type Syncer ¶ added in v1.4.0
type Syncer struct {
// contains filtered or unexported fields
}
Syncer manages the lifecycle of GCE BackendServices based on Kubernetes services.
func NewBackendSyncer ¶ added in v1.4.0
func NewBackendSyncer( backendPool *Pool, healthChecker healthchecks.HealthChecker, cloud *gce.Cloud, prober ProbeProvider, ) *Syncer
func (*Syncer) GC ¶ added in v1.4.0
func (s *Syncer) GC(svcPorts []utils.ServicePort, ingLogger klog.Logger) error
GC garbage collects unused BackendService's
func (*Syncer) Shutdown ¶ added in v1.4.0
Shutdown cleans up all BackendService's previously synced. TODO(cheungdavid): Shutdown() should be deprecated after the removal of delateAll option.