provider

package
v0.0.0-...-6fe41a3 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// AnnotationHealthCheckPath specifies the HTTP Path for health-checks
	AnnotationHealthCheckPath = "healthcheck.path"
	// AnnotationHealthInterval specifies the health check interval in milliseconds
	AnnotationHealthInterval = "healthcheck.interval"
	// AnnotationHealthCacheDuration specifies the health check cache duration in milliseconds
	AnnotationHealthCacheDuration = "healthcheck.cache"
	// AnnotationHealthTimeout specifies the timeout of a health-check in milliseconds
	AnnotationHealthTimeout = "healthcheck.timeout"
	// AnnotationHealthPort specifies the tcp port for the health-check
	AnnotationHealthPort = "healthcheck.port"
	// AnnotationHealthExpectedStatus specifies the accepted status codes
	AnnotationHealthExpectedStatus = "healthcheck.expected-status"

	// AnnotaionCBMaxConn sets the maximum number of connections that Envoy will make to the upstream
	AnnotaionCBMaxConn = "circuit-breaker.max-connections"
	// AnnotaionCBMaxPending sets the maximum number of pending requests that Envoy will
	// allow to the upstream cluster
	AnnotaionCBMaxPending = "circuit-breaker.max-pending"
	// AnnotaionCBMaxRequests sets the maximum number of parallel requests
	AnnotaionCBMaxRequests = "circuit-breaker.max-requests"
	// AnnotaionCBMaxRetries sets maximum number of parallel retries that Envoy
	// will allow to the upstream cluster
	AnnotaionCBMaxRetries = "circuit-breaker.max-retries"

	// AnnotaionEndpointWeight specifies the loadbalancer weight of the endpoint
	AnnotaionEndpointWeight = "endpoint.weight"

	// AnnotaionFaultInject enables fault injection
	AnnotaionFaultInject = "fault.inject"
	// AnnotaionFaultDelayPercent int value, specifies the delay injection percentage
	AnnotaionFaultDelayPercent = "fault.delay.percent"
	// AnnotaionFaultDelayDuration in milliseconds
	AnnotaionFaultDelayDuration = "fault.delay.duration"
	// AnnotaionFaultAbortPercent int value, specifies the abort injection percentage
	AnnotaionFaultAbortPercent = "fault.abort.percent"
	// AnnotaionFaultAbortCode specify the response status code
	AnnotaionFaultAbortCode = "fault.abort.code"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthzConfig

type AuthzConfig struct {
	Cluster string
}

AuthzConfig defines the behavior of the Authz HTTP Filter

type Cluster

type Cluster struct {
	Name      string     `yaml:"name"`
	Endpoints []Endpoint `yaml:"endpoints"`
}

Cluster represents a group of endpoints

func (Cluster) Config

func (c Cluster) Config() ClusterConfig

Config parses the annotations of the cluster and return a cluster config

type ClusterCircuitBreakerConfig

type ClusterCircuitBreakerConfig struct {
	MaxConnections     uint32
	MaxPendingRequests uint32
	MaxRequests        uint32
	MaxRetries         uint32
}

ClusterCircuitBreakerConfig defines the circuit-breaker behavior of a cluster

type ClusterConfig

type ClusterConfig struct {
	HealthCheck    ClusterHealthCheckConfig
	CircuitBreaker ClusterCircuitBreakerConfig
	// for now, the cluster specifies the fault configuration
	// of the INGRESS traffic
	FaultConfig FaultConfig
}

ClusterConfig defines the cluster behavior this config is filled by annotations

type ClusterHealthCheckConfig

type ClusterHealthCheckConfig struct {
	Path                string
	Timeout             time.Duration
	Interval            time.Duration
	CacheDuration       time.Duration
	Port                uint32
	ExpectedStatusLower int64
	ExpectedStatusUpper int64
}

ClusterHealthCheckConfig defines the health-checking behavior of a cluster

type Endpoint

type Endpoint struct {
	Address     string            `yaml:"address"`
	Annotations map[string]string `yaml:"annotations"`
	Port        uint32            `yaml:"port"`
}

Endpoint represents a address/port combination

func (Endpoint) Config

func (e Endpoint) Config() EndpointConfig

Config parses the endpoints annotations and returns the endpoint config

type EndpointConfig

type EndpointConfig struct {
	Weight uint32
}

EndpointConfig defines the behavior of a endpoint

type FaultConfig

type FaultConfig struct {
	Enabled       bool
	DelayDuration time.Duration
	DelayChance   uint32
	AbortCode     uint32
	AbortChance   uint32
}

FaultConfig defines the behavior of the fault HTTP filter

type Listener

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

Listener is a builder type for an envoy v2.Listener

func NewListener

func NewListener(cfg ListenerConfig) *Listener

NewListener constructs a new Listener

func (Listener) InjectAuthz

func (l Listener) InjectAuthz(cfg AuthzConfig)

InjectAuthz prepends the authz filter to the http filter chain order matters!

func (Listener) InjectFault

func (l Listener) InjectFault(cfg FaultConfig)

InjectFault prepends the fault injection filter into the http filter chain order matters!

func (Listener) InjectHealthCheckCache

func (l Listener) InjectHealthCheckCache(cluster Cluster)

InjectHealthCheckCache prependas a http health check cache into the http filter chain order matters!

func (Listener) Resource

func (l Listener) Resource() *v2.Listener

Resource builds and returns the envoy v2.listener

type ListenerConfig

type ListenerConfig struct {
	// Name specifies the name of the listener
	Name string
	// TracingOperation specifies the traffic direction
	TracingOperation hcm.HttpConnectionManager_Tracing_OperationName
	// TargetRoute specifies the route which is associated with this listener
	TargetRoute string
	// Address specifies the IP address the listener listens on
	Address string
	// Port specifies the port the listener listens on
	Port uint32
}

ListenerConfig defines the listener behavior

type Node

type Node struct {
	Name string
	// contains filtered or unexported fields
}

Node holds the actual envoy-related data and acts only as a proxy type

func NewNode

func NewNode(name string) *Node

NewNode constructs a new node

func (*Node) AddCluster

func (n *Node) AddCluster(clusters ...Cluster)

AddCluster initializes a cluster and calls AddEndpoints

func (*Node) AddEndpoints

func (n *Node) AddEndpoints(cluster string, eps ...Endpoint)

AddEndpoints initializes a ClusterLoadAssigment and appends a bunch of endpoints to it

func (*Node) AddListener

func (n *Node) AddListener(lis ...*v2.Listener)

AddListener adds a bunch of listeners

func (*Node) AddRoute

func (n *Node) AddRoute(routeName string, vhosts ...route.VirtualHost)

AddRoute initializes a route config and appends a bunch of vhosts to it a vhost is unique per route and must not be duplicated this function takes care of it

func (*Node) Clusters

func (n *Node) Clusters() (cls []cache.Resource)

Clusters returns the clusters as cache.Resources

func (*Node) Endpoints

func (n *Node) Endpoints() (eps []cache.Resource)

Endpoints returns the endpoints as cache.Resources

func (*Node) Listeners

func (n *Node) Listeners() (ls []cache.Resource)

Listeners returns the listeners as cache.Resources

func (*Node) Routes

func (n *Node) Routes() (rs []cache.Resource)

Routes returns the routes as cache.Resources

type ServiceProvider

type ServiceProvider interface {
	// GetClusters provides a list of endpoints per node
	GetClusters() (map[string][]Cluster, error)
}

ServiceProvider abstracts the provider from the mesh implementation

type Updater

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

Updater is the glue between the provider-specific implementation and the snapshot cache The updater requests the services, endpoints and nodes from the provider, transforms them into the envoy typespace and puts them into the cache

func NewUpdater

func NewUpdater(config cache.SnapshotCache, provider ServiceProvider) *Updater

NewUpdater returns a new Updater

func (Updater) Run

func (a Updater) Run()

Run continuously polls the provider for changes and updates the cache accordingly every node has its own configuration

type VHostConfig

type VHostConfig struct {
	Hostname string
	Cluster  string
}

VHostConfig defines the VHost target cluster

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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