Documentation ¶
Index ¶
- Constants
- type Backends
- func (b *Backends) AddSignedUrlKey(be *composite.BackendService, signedurlkey *composite.SignedUrlKey, ...) error
- func (b *Backends) Create(sp utils.ServicePort, hcLink string, beLogger klog.Logger) (*composite.BackendService, error)
- func (b *Backends) Delete(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) error
- func (b *Backends) DeleteSignedUrlKey(be *composite.BackendService, keyName string, urlKeyLogger klog.Logger) error
- func (b *Backends) EnsureL4BackendService(name, hcLink, protocol, sessionAffinity, scheme string, ...) (*composite.BackendService, error)
- func (b *Backends) Get(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (*composite.BackendService, error)
- func (b *Backends) Health(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (string, error)
- func (b *Backends) List(key *meta.Key, version meta.Version, beLogger klog.Logger) ([]*composite.BackendService, error)
- func (b *Backends) Update(be *composite.BackendService, beLogger klog.Logger) error
- type BalancingMode
- type FakeProbeProvider
- type GroupKey
- type Linker
- type NEGGetter
- type Pool
- type ProbeProvider
- type RegionalInstanceGroupLinker
- type Syncer
Constants ¶
const ( DefaultConnectionDrainingTimeoutSeconds = 30 PerSessionTrackingMode = "PER_SESSION" // the only one supported with strong session affinity )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backends ¶
type Backends struct {
// contains filtered or unexported fields
}
Backends handles CRUD operations for backends.
func NewPool ¶ added in v1.4.0
func NewPool(cloud *gce.Cloud, namer namer.BackendNamer) *Backends
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) *Backends
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 (*Backends) AddSignedUrlKey ¶ added in v1.15.0
func (b *Backends) AddSignedUrlKey(be *composite.BackendService, signedurlkey *composite.SignedUrlKey, urlKeyLogger klog.Logger) error
AddSignedUrlKey adds a SignedUrlKey to a BackendService
func (*Backends) Create ¶ added in v1.4.0
func (b *Backends) Create(sp utils.ServicePort, hcLink string, beLogger klog.Logger) (*composite.BackendService, error)
Create implements Pool.
func (*Backends) Delete ¶
func (b *Backends) Delete(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) error
Delete implements Pool.
func (*Backends) DeleteSignedUrlKey ¶ added in v1.15.0
func (b *Backends) DeleteSignedUrlKey(be *composite.BackendService, keyName string, urlKeyLogger klog.Logger) error
DeleteSignedUrlKey deletes a SignedUrlKey from BackendService
func (*Backends) EnsureL4BackendService ¶ added in v1.9.0
func (b *Backends) EnsureL4BackendService(name, hcLink, protocol, sessionAffinity, scheme string, namespacedName types.NamespacedName, network network.NetworkInfo, connectionTrackingPolicy *composite.BackendServiceConnectionTrackingPolicy, beLogger klog.Logger) (*composite.BackendService, error)
EnsureL4BackendService creates or updates the backend service with the given name. TODO(code-elinka): refactor the list of arguments (there are too many now)
func (*Backends) Get ¶
func (b *Backends) Get(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (*composite.BackendService, error)
Get implements Pool.
func (*Backends) Health ¶ added in v1.4.0
func (b *Backends) Health(name string, version meta.Version, scope meta.KeyType, beLogger klog.Logger) (string, error)
Health implements Pool.
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 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
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 interface { // Get a composite BackendService given a required version. Get(name string, version meta.Version, scope meta.KeyType, logger klog.Logger) (*composite.BackendService, error) // Create a composite BackendService and returns it. Create(sp utils.ServicePort, hcLink string, logger klog.Logger) (*composite.BackendService, error) // Update a BackendService given the composite type. Update(be *composite.BackendService, logger klog.Logger) error // Delete a BackendService given its name. Delete(name string, version meta.Version, scope meta.KeyType, logger klog.Logger) error // Get the health of a BackendService given its name. Health(name string, version meta.Version, scope meta.KeyType, logger klog.Logger) (string, error) // Get a list of BackendService names that are managed by this pool. List(key *meta.Key, version meta.Version, logger klog.Logger) ([]*composite.BackendService, error) // Add a SignedUrlKey to a BackendService AddSignedUrlKey(be *composite.BackendService, signedurlkey *composite.SignedUrlKey, logger klog.Logger) error // Deletes a SignedUrlKey from BackendService DeleteSignedUrlKey(be *composite.BackendService, keyName string, logger klog.Logger) error }
Pool is an interface to perform CRUD operations on a pool of GCE Backend Services.
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
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 interface { // Init an implementation of ProbeProvider. Init(p ProbeProvider) // Sync a BackendService. Implementations should only create the BackendService // but not its groups. Sync(svcPorts []utils.ServicePort, logger klog.Logger) error // GC garbage collects unused BackendService's GC(svcPorts []utils.ServicePort, logger klog.Logger) error // Status returns the status of a BackendService given its name. Status(name string, version meta.Version, scope meta.KeyType, logger klog.Logger) (string, error) // Shutdown cleans up all BackendService's previously synced. Shutdown() error }
Syncer is an interface to sync Kubernetes services to GCE BackendServices.
func NewBackendSyncer ¶ added in v1.4.0
func NewBackendSyncer( backendPool Pool, healthChecker healthchecks.HealthChecker, cloud *gce.Cloud) Syncer