statforwarder

package
v0.34.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 29 Imported by: 2

Documentation

Overview

Package statforwarder provides a forwarder which can be used to forward autoscaler statistics to the right Autoscaler pod if Autoscaler is set up with multiple pods and running in Leader Election mode.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LeaseBasedProcessor added in v0.20.0

func LeaseBasedProcessor(ctx context.Context, f *Forwarder, accept statProcessor) error

LeaseBasedProcessor tracks leases and decodes the holder's identity in order to set the appropriate "processor" on the Forwarder.

func StatefulSetBasedProcessor added in v0.20.0

func StatefulSetBasedProcessor(ctx context.Context, f *Forwarder, accept statProcessor) error

StatefulSetBasedProcessor configured "processors" for each of the statefulset ordinals.

Types

type Forwarder

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

Forwarder does the following things:

  1. Watches the change of Leases for Autoscaler buckets. Stores the Lease -> IP mapping.
  2. Creates/updates the corresponding K8S Service and Endpoints.
  3. Can be used to forward the metrics owned by a bucket based on the holder IP.

func New

func New(ctx context.Context, bs *hash.BucketSet) *Forwarder

New creates a new Forwarder. This must be configured with a mechanism for setting up its "processors", such as LeaseBasedProcessor or StatefulSetBasedProcessor, which correlates with the mechanism of leader election being used.

func (*Forwarder) Cancel

func (f *Forwarder) Cancel()

Cancel is the function to call when terminating a Forwarder.

func (*Forwarder) IsBucketOwner added in v0.19.0

func (f *Forwarder) IsBucketOwner(bkt string) bool

IsBucketOwner returns true if this Autoscaler pod is the owner of the given bucket.

func (*Forwarder) Process

func (f *Forwarder) Process(sm asmetrics.StatMessage)

Process enqueues the given Stat for processing asynchronously. It calls Forwarder.accept if the pod where this Forwarder is running is the owner of the given StatMessage. Otherwise it forwards the given StatMessage to the right owner pod. It will retry if any error happens during the processing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL