app

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: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAPIBatchSize

func WithAPIBatchSize(size int) func(*Scheduler)

WithAPIBatchSize sets the batch size to request from the syslog drain binding provider. It defaults to 1000.

func WithBlacklist

func WithBlacklist(r *ingress.BlacklistRanges) func(*Scheduler)

WithBlacklist sets the blacklist for the syslog IPs.

func WithHTTPClient

func WithHTTPClient(client *http.Client) func(*Scheduler)

WithHTTPClient sets the http.Client to poll the syslog drain binding provider.

func WithHealthAddr

func WithHealthAddr(addr string) func(*Scheduler)

WithHealthAddr sets the address for the health endpoint to bind to.

func WithPollingInterval

func WithPollingInterval(interval time.Duration) func(*Scheduler)

WithPollingInterval sets the interval to poll the syslog drain binding provider.

Types

type Config

type Config struct {
	APIURL             string        `env:"API_URL,              required"`
	APICAFile          string        `env:"API_CA_FILE_PATH,     required"`
	APICertFile        string        `env:"API_CERT_FILE_PATH,   required"`
	APIKeyFile         string        `env:"API_KEY_FILE_PATH,    required"`
	APICommonName      string        `env:"API_COMMON_NAME,      required"`
	APISkipCertVerify  bool          `env:"API_SKIP_CERT_VERIFY"`
	APIPollingInterval time.Duration `env:"API_POLLING_INTERVAL"`
	APIBatchSize       int           `env:"API_BATCH_SIZE"`

	CAFile            string `env:"CA_FILE_PATH,        required"`
	CertFile          string `env:"CERT_FILE_PATH,      required"`
	KeyFile           string `env:"KEY_FILE_PATH,       required"`
	AdapterCommonName string `env:"ADAPTER_COMMON_NAME, required"`

	Blacklist *ingress.BlacklistRanges `env:"BLACKLIST"`

	AdapterPort  string   `env:"ADAPTER_PORT,  required"`
	AdapterAddrs []string `env:"ADAPTER_ADDRS, required"`

	MetricIngressAddr     string        `env:"METRIC_INGRESS_ADDR, required"`
	MetricIngressCN       string        `env:"METRIC_INGRESS_CN,   required"`
	MetricEmitterInterval time.Duration `env:"METRIC_EMITTER_INTERVAL"`
	HealthHostport        string        `env:"HEALTH_HOSTPORT"`
	PprofHostport         string        `env:"PPROF_HOSTPORT"`
}

Config stores configuration settings for the scheduler.

func LoadConfig

func LoadConfig(args []string) (*Config, error)

LoadConfig will load and validate the config from the current environment. If validation fails LoadConfig will log the error and exit the process with status code 1.

type Emitter

type Emitter interface {
	NewGaugeMetric(name, unit string, opts ...pulseemitter.MetricOption) pulseemitter.GaugeMetric
	NewCounterMetric(name string, opts ...pulseemitter.MetricOption) pulseemitter.CounterMetric
}

Emitter sends gauge metrics

type LogClient

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

LogClient is used to emit logs.

type Scheduler

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

Scheduler represents the scheduler component. It is responsible for polling and/or streaming events from the cloud controller about syslog drains and updating a pool of adapters to service those drains.

func NewScheduler

func NewScheduler(
	apiURL string,
	adapterAddrs []string,
	adapterTLSConfig *tls.Config,
	e Emitter,
	logClient LogClient,
	opts ...SchedulerOption,
) *Scheduler

NewScheduler returns a new unstarted scheduler.

func (*Scheduler) Start

func (s *Scheduler) Start() string

Start starts polling the syslog drain binding provider and serves the HTTP health endpoint.

type SchedulerOption

type SchedulerOption func(c *Scheduler)

SchedulerOption represents a function that can configure a scheduler.

Jump to

Keyboard shortcuts

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