envoy

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDiscoveryPort    = 6500
	DefaultAdminPort        = 8001
	DefaultHTTPListenerPort = 6379
	DefaultWorkingDir       = "/etc/envoy/"
	DefaultLoggingDir       = "/var/log/"
	DefaultEnvoyBinary      = "envoy"
)

Envoy config related files

Variables

This section is empty.

Functions

func AddDefaultRouteRules

func AddDefaultRouteRules(ruleList []api.Rule, instances []*api.ServiceInstance) []api.Rule

AddDefaultRouteRules adds a route rule for a service that currently does not have one

func BuildServiceKey

func BuildServiceKey(service string, tags []string) string

BuildServiceKey builds a service key given a service name and tags in the form "serviceName:tag1=value1,tag2=value2,tag3=value3" where ':' is the service delimiter and ',' is the tag delimiter. We assume that the service name and the tags do not contain either delimiter.

func BuildWeightKey

func BuildWeightKey(service string, tags []string) string

BuildWeightKey builds filesystem key for Route Runtime weight keys

func ParseServiceKey

func ParseServiceKey(s string) (string, []string)

ParseServiceKey parses service key into service name and tags. We do not check for the correctness of the service key.

func SanitizeRules

func SanitizeRules(ruleList []api.Rule)

SanitizeRules performs sorts on rule backends and rules. Also calculates remaining weights

Types

type AbortFilter

type AbortFilter struct {
	Percent    int `json:"abort_percent,omitempty"`
	HTTPStatus int `json:"http_status,omitempty"`
}

AbortFilter definition.

type AccessLog

type AccessLog struct {
	Path   string `json:"path"`
	Format string `json:"format,omitempty"`
	Filter string `json:"filter,omitempty"`
}

AccessLog definition.

type Admin

type Admin struct {
	AccessLogPath string `json:"access_log_path"`
	Port          int    `json:"port"`
}

Admin definition. See: https://lyft.github.io/envoy/docs/configuration/overview/admin.html#config-admin

type ByPriority

type ByPriority []api.Rule

ByPriority implement sort

func (ByPriority) Len

func (s ByPriority) Len() int

Len length

func (ByPriority) Less

func (s ByPriority) Less(i, j int) bool

Less compare

func (ByPriority) Swap

func (s ByPriority) Swap(i, j int)

Swap elements

type CDS

type CDS struct {
	Cluster        Cluster `json:"cluster"`
	RefreshDelayMs int     `json:"refresh_delay_ms"`
}

CDS definition See: https://lyft.github.io/envoy/docs/configuration/cluster_manager/cds.html#config-cluster-manager-cds

type CircuitBreakers

type CircuitBreakers struct {
	Default DefaultCB `json:"default,omitempty"`
}

CircuitBreakers definition See: https://lyft.github.io/envoy/docs/configuration/cluster_manager/cluster_circuit_breakers.html#circuit-breakers

type Cluster

type Cluster struct {
	Name                     string            `json:"name"`
	ServiceName              string            `json:"service_name,omitempty"`
	ConnectTimeoutMs         int               `json:"connect_timeout_ms"`
	Type                     string            `json:"type"`
	LbType                   string            `json:"lb_type"`
	MaxRequestsPerConnection int               `json:"max_requests_per_connection,omitempty"`
	Hosts                    []Host            `json:"hosts,omitempty"`
	CircuitBreakers          *CircuitBreakers  `json:"circuit_breakers,omitempty"`
	OutlierDetection         *OutlierDetection `json:"outlier_detection,omitempty"`
	SSLContext               *SSLContext       `json:"ssl_context,omitempty"`
}

Cluster definition. See: https://lyft.github.io/envoy/docs/configuration/cluster_manager/cluster.html#config-cluster-manager-cluster

func BuildClusters

func BuildClusters(instances []*api.ServiceInstance, rules []api.Rule, tlsConfig *SSLContext) []Cluster

BuildClusters builds clusters from instances applying rule backend info where necessary

type ClusterManager

type ClusterManager struct {
	Clusters []Cluster `json:"clusters"`
	SDS      SDS       `json:"sds"`
	CDS      CDS       `json:"cds"`
}

ClusterManager definition. See: https://lyft.github.io/envoy/docs/configuration/cluster_manager/cluster_manager.html#config-cluster-manager

type ClustersByName

type ClustersByName []Cluster

ClustersByName implements name based sort for clusters.

func (ClustersByName) Len

func (s ClustersByName) Len() int

Len length.

func (ClustersByName) Less

func (s ClustersByName) Less(i, j int) bool

Less compare elements.

func (ClustersByName) Swap

func (s ClustersByName) Swap(i, j int)

Swap elements.

type Config

type Config struct {
	RootRuntime    RootRuntime    `json:"runtime"`
	Listeners      []Listener     `json:"listeners"`
	Admin          Admin          `json:"admin"`
	ClusterManager ClusterManager `json:"cluster_manager"`
}

Config definition. See: https://lyft.github.io/envoy/docs/configuration/overview/overview.html

type DefaultCB

type DefaultCB struct {
	MaxConnections    int `json:"max_connections,omitempty"`
	MaxPendingRequest int `json:"max_pending_requests,omitempty"`
	MaxRequests       int `json:"max_requests,omitempty"`
	MaxRetries        int `json:"max_retries,omitempty"`
}

DefaultCB definition See: https://lyft.github.io/envoy/docs/configuration/cluster_manager/cluster_circuit_breakers.html#config-cluster-manager-cluster-circuit-breakers

type DelayFilter

type DelayFilter struct {
	Type     string `json:"type,omitempty"`
	Percent  int    `json:"fixed_delay_percent,omitempty"`
	Duration int    `json:"fixed_duration_ms,omitempty"`
}

DelayFilter definition.

type Filter

type Filter struct {
	Type   string      `json:"type"`
	Name   string      `json:"name"`
	Config interface{} `json:"config"`
}

Filter definition.

type FilterFaultConfig

type FilterFaultConfig struct {
	Abort   *AbortFilter `json:"abort,omitempty"`
	Delay   *DelayFilter `json:"delay,omitempty"`
	Headers []Header     `json:"headers,omitempty"`
}

FilterFaultConfig definition. See: https://lyft.github.io/envoy/docs/configuration/http_filters/fault_filter.html

type FilterRouterConfig

type FilterRouterConfig struct {
	DynamicStats bool `json:"dynamic_stats"`
}

FilterRouterConfig definition.

type GRPCHTTP1BridgeFilter

type GRPCHTTP1BridgeFilter struct{}

GRPCHTTP1BridgeFilter definition

type HTTPFilterConfig added in v1.1.0

type HTTPFilterConfig struct {
	CodecType         string           `json:"codec_type"`
	StatPrefix        string           `json:"stat_prefix"`
	GenerateRequestID bool             `json:"generate_request_id"`
	UserAgent         bool             `json:"add_user_agent"`
	RouteConfig       *HTTPRouteConfig `json:"route_config,omitempty"`
	RDS               *RDS             `json:"rds,omitempty"`
	Filters           []Filter         `json:"filters"`
	AccessLog         []AccessLog      `json:"access_log"`
}

HTTPFilterConfig definition.

type HTTPRouteConfig added in v1.1.0

type HTTPRouteConfig struct {
	VirtualHosts []VirtualHost `json:"virtual_hosts"`
}

HTTPRouteConfig definition. See: https://lyft.github.io/envoy/docs/configuration/http_conn_man/route_config/route_config.html#config-http-conn-man-route-table

type Header struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Regex bool   `json:"regex"`
}

Header definition. See: https://lyft.github.io/envoy/docs/configuration/http_filters/fault_filter.html#config-http-filters-fault-injection-headers

type Host

type Host struct {
	URL string `json:"url"`
}

Host definition.

type Listener

type Listener struct {
	Port       int             `json:"port"`
	Filters    []NetworkFilter `json:"filters"`
	SSLContext *SSLContext     `json:"ssl_context,omitempty"`
}

Listener definition. See: https://lyft.github.io/envoy/docs/configuration/listeners/listeners.html#config-listeners

type Manager

type Manager interface {
	Update(instances []api.ServiceInstance, rules []api.Rule) error
}

Manager for updating envoy proxy configuration.

func NewManager

func NewManager(identity identity.Provider, conf *config.Config, tlsConfig *SSLContext) (Manager, error)

NewManager creates new instance

type NetworkFilter

type NetworkFilter struct {
	Type   string      `json:"type"`
	Name   string      `json:"name"`
	Config interface{} `json:"config"`
}

NetworkFilter definition. See: https://lyft.github.io/envoy/docs/configuration/listeners/filters.html#config-listener-filters

type OutlierDetection

type OutlierDetection struct {
	ConsecutiveError   int `json:"consecutive_5xx,omitempty"`
	IntervalMS         int `json:"interval_ms,omitempty"`
	BaseEjectionTimeMS int `json:"base_ejection_time_ms,omitempty"`
	MaxEjectionPercent int `json:"max_ejection_percent,omitempty"`
}

OutlierDetection definition See: https://lyft.github.io/envoy/docs/configuration/cluster_manager/cluster_runtime.html#outlier-detection

type RDS

type RDS struct {
	Cluster         string `json:"cluster"`
	RefreshDelayMS  int    `json:"refresh_delay_ms"`
	RouteConfigName string `json:"route_config_name"`
}

RDS definition See: https://lyft.github.io/envoy/docs/configuration/http_conn_man/rds.html#config-http-conn-man-rds

type RetryPolicy

type RetryPolicy struct {
	Policy     string `json:"retry_on"` //5xx,connect-failure,refused-stream
	NumRetries int    `json:"num_retries,omitempty"`
}

RetryPolicy definition See: https://lyft.github.io/envoy/docs/configuration/http_conn_man/route_config/route.html#retry-policy

type RootRuntime

type RootRuntime struct {
	SymlinkRoot          string `json:"symlink_root"`
	Subdirectory         string `json:"subdirectory"`
	OverrideSubdirectory string `json:"override_subdirectory,omitempty"`
}

RootRuntime definition. See: https://lyft.github.io/envoy/docs/configuration/overview/overview.html

type Route

type Route struct {
	Runtime          *Runtime         `json:"runtime,omitempty"`
	Path             string           `json:"path,omitempty"`
	Prefix           string           `json:"prefix,omitempty"`
	PrefixRewrite    string           `json:"prefix_rewrite,omitempty"`
	WeightedClusters WeightedClusters `json:"weighted_clusters,omitempty"`
	Cluster          string           `json:"cluster,omitempty"`
	Headers          []Header         `json:"headers,omitempty"`
	TimeoutMS        int              `json:"timeout_ms,omitempty"`
	RetryPolicy      RetryPolicy      `json:"retry_policy"`
	AutoHostRewrite  bool             `json:"auto_host_rewrite,omitempty"`
}

Route definition. See: https://lyft.github.io/envoy/docs/configuration/http_conn_man/route_config/route.html#config-http-conn-man-route-table-route

func BuildRoutes

func BuildRoutes(ruleList []api.Rule, instances []*api.ServiceInstance) []Route

BuildRoutes builds routes based on rules. Assumes at least one route for each service

type Runtime

type Runtime struct {
	Key     string `json:"key"`
	Default int    `json:"default"`
}

Runtime definition.

type SDS

type SDS struct {
	Cluster        Cluster `json:"cluster"`
	RefreshDelayMs int     `json:"refresh_delay_ms"`
}

SDS definition. See: https://lyft.github.io/envoy/docs/configuration/cluster_manager/sds.html#config-cluster-manager-sds

type SSLContext

type SSLContext struct {
	CertChainFile  string  `json:"cert_chain_file"`
	PrivateKeyFile string  `json:"private_key_file"`
	CACertFile     *string `json:"ca_cert_file,omitempty"`
}

SSLContext defintion See: https://lyft.github.io/envoy/docs/configuration/listeners/ssl.html#config-listener-ssl-context

type Service

type Service interface {
	Reload() error
}

Service manages a proxy service.

func NewService

func NewService(config ServiceConfig) Service

NewService creates new instance.

type ServiceConfig

type ServiceConfig struct {
	EnvoyBinary               string
	EnvoyConfig               string
	DrainTimeSeconds          int
	ParentShutdownTimeSeconds int
}

ServiceConfig config for Service

type TCPFilterConfig added in v1.1.0

type TCPFilterConfig struct {
	StatPrefix  string          `json:"stat_prefix"`
	RouteConfig *TCPRouteConfig `json:"route_config"`
}

TCPFilterConfig definition

type TCPRoute added in v1.1.0

type TCPRoute struct {
	Cluster           string   `json:"cluster"`
	DestinationIPList []string `json:"destination_ip_list,omitempty"`
	DestinationPorts  string   `json:"destination_ports,omitempty"`
	SourceIPList      []string `json:"source_ip_list,omitempty"`
	SourcePorts       string   `json:"source_ports,omitempty"`
}

TCPRoute definition

type TCPRouteConfig added in v1.1.0

type TCPRouteConfig struct {
	Routes []TCPRoute `json:"routes"`
}

TCPRouteConfig definition

type VirtualHost

type VirtualHost struct {
	Name    string   `json:"name"`
	Domains []string `json:"domains"`
	Routes  []Route  `json:"routes"`
}

VirtualHost definition. See: https://lyft.github.io/envoy/docs/configuration/http_conn_man/route_config/vhost.html#config-http-conn-man-route-table-vhost

type WeightedCluster

type WeightedCluster struct {
	Name   string `json:"name"`
	Weight int    `json:"weight"`
}

WeightedCluster definition See: https://lyft.github.io/envoy/docs/configuration/http_conn_man/route_config/route.html#weighted-clusters

type WeightedClusters

type WeightedClusters struct {
	Clusters         []WeightedCluster `json:"clusters"`
	RunTimeKeyPrefix string            `json:"runtime_key_prefix,omitempty"`
}

WeightedClusters definition See: https://lyft.github.io/envoy/docs/configuration/http_conn_man/route_config/route.html#weighted-clusters

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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