ingress

package
v0.0.0-...-57f4fd1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLookup

func WithLookup(lookup func(string) ([]net.IP, error)) func(*IPBalancer)

WithLookup sets the behavior of looking up IPs

func WithRetryWait

func WithRetryWait(d time.Duration) func(*ClientManager)

Types

type Balancer

type Balancer interface {
	NextHostPort() (string, error)
}

Balancer cycles through a collection of host ports. It will return an error when there is no host port available.

type ClientManager

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

ClientManager manages loggregator egress clients and connections.

func NewClientManager

func NewClientManager(
	connector ConnectionBuilder,
	connCount int,
	ttl time.Duration,
	check time.Duration,
	opts ...ClientManagerOpts,
) *ClientManager

NewClientManager returns a ClientManager after opening the specified number of connections.

func (*ClientManager) Next

Next returns the next available loggregator egress client. Next will block until a healthy client is available.

type ClientManagerOpts

type ClientManagerOpts func(*ClientManager)

type ClientPool

type ClientPool interface {
	Next() LogsProviderClient
}

type ConnectionBuilder

type ConnectionBuilder interface {
	Connect() (io.Closer, LogsProviderClient, error)
}

type Connector

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

Connector connects to loggregator egress API

func NewConnector

func NewConnector(b []Balancer, dt time.Duration, t *tls.Config) *Connector

NewConnector returns a new Connector

func (*Connector) Connect

func (c *Connector) Connect() (io.Closer, LogsProviderClient, error)

Connect connects to a loggregator egress API

type IPBalancer

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

IPBalancer provides IPs resolved from a DNS address in random order

func NewIPBalancer

func NewIPBalancer(addr string, opts ...IPBalancerOption) *IPBalancer

NewIPBalancer returns an IPBalancer

func (*IPBalancer) NextHostPort

func (b *IPBalancer) NextHostPort() (string, error)

NextHostPort returns hostport resolved from the balancer's addr. It returns error for an invalid addr or if lookup failed or doesn't resolve to anything.

type IPBalancerOption

type IPBalancerOption func(*IPBalancer)

IPBalancerOption is a type that will manipulate a config

type LogClient

type LogClient interface {
	EmitLog(message string, opts ...loggregator.EmitLogOption)
}

LogClient is used to emit logs.

type LogsProviderClient

type LogsProviderClient interface {
	BatchedReceiver(
		ctx context.Context,
		in *loggregator_v2.EgressBatchRequest,
		opts ...grpc.CallOption,
	) (loggregator_v2.Egress_BatchedReceiverClient, error)

	Valid() bool
	Invalidate()
}

LogsProviderClient describes the gRPC interface for communicating with Loggregator.

type MetricClient

type MetricClient interface {
	NewCounterMetric(string, ...pulseemitter.MetricOption) pulseemitter.CounterMetric
}

type Subscriber

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

Subscriber streams loggregator egress to the syslog drain.

func NewSubscriber

func NewSubscriber(
	ctx context.Context,
	p ClientPool,
	c SyslogConnector,
	e MetricClient,
	opts ...SubscriberOption,
) *Subscriber

NewSubscriber returns a new Subscriber.

func (*Subscriber) Start

func (s *Subscriber) Start(binding *v1.Binding) func()

Start begins to stream logs from a loggregator egress client to the syslog egress writer. Start does not block. Start returns a function that can be called to stop streaming logs.

type SubscriberOption

type SubscriberOption func(s *Subscriber)

func WithLogClient

func WithLogClient(logClient LogClient, sourceIndex string) SubscriberOption

WithLogClient returns a SubscriberOption that will set up logging for any information about a binding.

func WithMetricsToSyslogEnabled

func WithMetricsToSyslogEnabled(enabled bool) SubscriberOption

WithEnableMetricsToSyslog returns a SubscriberOption to override the default setting for writing metrics to syslog. By default this feature is disabled.

func WithStreamOpenTimeout

func WithStreamOpenTimeout(d time.Duration) SubscriberOption

type SyslogConnector

type SyslogConnector interface {
	Connect(ctx context.Context, binding *v1.Binding) (w egress.Writer, err error)
}

type ValidClient

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

func (*ValidClient) Invalidate

func (v *ValidClient) Invalidate()

func (*ValidClient) Valid

func (v *ValidClient) Valid() bool

Jump to

Keyboard shortcuts

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