v2

package
v5.2.0-release+incompa... Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: LGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//KeyPrefix request path prefix
	KeyPrefix string = "Prefix"
	//KeyHeaders request http headers
	KeyHeaders string = "Headers"
	//KeyDomains request domains
	KeyDomains string = "Domains"
	//KeyMaxConnections The maximum number of connections that Envoy will make to the upstream cluster. If not specified, the default is 1024.
	KeyMaxConnections string = "MaxConnections"
	//KeyMaxPendingRequests The maximum number of pending requests that Envoy will allow to the upstream cluster. If not specified, the default is 1024
	KeyMaxPendingRequests string = "MaxPendingRequests"
	//KeyMaxRequests The maximum number of parallel requests that Envoy will make to the upstream cluster. If not specified, the default is 1024.
	KeyMaxRequests string = "MaxRequests"
	//KeyMaxActiveRetries  The maximum number of parallel retries that Envoy will allow to the upstream cluster. If not specified, the default is 3.
	KeyMaxActiveRetries string = "MaxActiveRetries"
	//KeyUpStream upStream
	KeyUpStream string = "upStream"
	//KeyDownStream downStream
	KeyDownStream string = "downStream"
	//KeyWeight WEIGHT
	KeyWeight string = "Weight"
	//KeyWeightModel MODEL_WEIGHT
	KeyWeightModel string = "weight_model"
	//KeyPrefixModel MODEL_PREFIX
	KeyPrefixModel string = "prefix_model"
	//KeyIntervalMS IntervalMS key
	KeyIntervalMS string = "IntervalMS"
	//KeyConsecutiveErrors ConsecutiveErrors key
	KeyConsecutiveErrors string = "ConsecutiveErrors"
	//KeyBaseEjectionTimeMS BaseEjectionTimeMS key
	KeyBaseEjectionTimeMS string = "BaseEjectionTimeMS"
	//KeyMaxEjectionPercent MaxEjectionPercent key
	KeyMaxEjectionPercent string = "MaxEjectionPercent"
	// KeyMaxRequestsPerConnection Optional maximum requests for a single upstream connection. This parameter
	// is respected by both the HTTP/1.1 and HTTP/2 connection pool
	// implementations. If not specified, there is no limit. Setting this
	// parameter to 1 will effectively disable keep alive.
	KeyMaxRequestsPerConnection string = "MaxRequestsPerConnection"
	// KeyHealthyPanicThreshold default 50,More than 50% of hosts are ejected and go into panic mode
	// Panic mode will send traffic back to the failed host
	KeyHealthyPanicThreshold string = "HealthyPanicThreshold"
)

Variables

View Source
var DefaultLocalhostListenerAddress = "127.0.0.1"

DefaultLocalhostListenerAddress -

View Source
var DefaultRateLimitServerClusterName = "rate_limit_service_cluster"

DefaultRateLimitServerClusterName default rate limit server cluster name

Functions

func CheckWeightSum

func CheckWeightSum(clusters []*route.WeightedCluster_ClusterWeight, weight uint32) uint32

CheckWeightSum check all cluster weight sum

func ConverTimeDuration

func ConverTimeDuration(second int64) *duration.Duration

ConverTimeDuration second

func ConversionTypeUInt32

func ConversionTypeUInt32(value uint32) *types.UInt32Value

ConversionTypeUInt32 conversion uint32 to proto uint32

func ConversionUInt32

func ConversionUInt32(value uint32) *wrappers.UInt32Value

ConversionUInt32 conversion uint32 to wrappers uint32

func CreatOutlierDetection

func CreatOutlierDetection(options RainbondPluginOptions) *cluster.OutlierDetection

CreatOutlierDetection create up cluster OutlierDetection

func CreateCircuitBreaker

func CreateCircuitBreaker(options RainbondPluginOptions) *cluster.CircuitBreakers

CreateCircuitBreaker create down cluster circuitbreaker

func CreateCluster

func CreateCluster(options ClusterOptions) *apiv2.Cluster

CreateCluster create cluster config

func CreateDNSLoadAssignment

func CreateDNSLoadAssignment(serviceAlias, namespace, domain string, service *corev1.Service) *apiv2.ClusterLoadAssignment

CreateDNSLoadAssignment create dns loadAssignment

func CreateEDSClusterConfig

func CreateEDSClusterConfig(serviceName string) *apiv2.Cluster_EdsClusterConfig

CreateEDSClusterConfig create grpc eds cluster config

func CreateHTTPConnectionManager

func CreateHTTPConnectionManager(name, statPrefix string, rateOpt *RateLimitOptions, routes ...*route.VirtualHost) *http_connection_manager.HttpConnectionManager

CreateHTTPConnectionManager create http connection manager

func CreateHTTPListener

func CreateHTTPListener(name, address, statPrefix string, port uint32, rateOpt *RateLimitOptions, routes ...*route.VirtualHost) *apiv2.Listener

CreateHTTPListener create http manager listener

func CreateHTTPRateLimit

func CreateHTTPRateLimit(option RateLimitOptions) *http_rate_limit.RateLimit

CreateHTTPRateLimit create http rate limit

func CreateHeaderMatcher

func CreateHeaderMatcher(header v1.Header) *route.HeaderMatcher

CreateHeaderMatcher create http route config header matcher

func CreateRoute

func CreateRoute(clusterName, prefix string, headers []*route.HeaderMatcher, weight uint32) *route.Route

CreateRoute create http route

func CreateRouteVirtualHost

func CreateRouteVirtualHost(name string, domains []string, rateLimits []*route.RateLimit, routes ...*route.Route) *route.VirtualHost

CreateRouteVirtualHost create route virtual host

func CreateRouteWithHostRewrite

func CreateRouteWithHostRewrite(host, clusterName, prefix string, headers []*route.HeaderMatcher, weight uint32) *route.Route

CreateRouteWithHostRewrite create route with hostRewrite

func CreateSocketAddress

func CreateSocketAddress(protocol, address string, port uint32) *core.Address

CreateSocketAddress create socket address

func CreateTCPListener

func CreateTCPListener(name, clusterName, address, statPrefix string, port uint32) *apiv2.Listener

CreateTCPListener listener builder

func CreateUDPListener

func CreateUDPListener(name, clusterName, address, statPrefix string, port uint32) *apiv2.Listener

CreateUDPListener create udp listenner

func GetServiceAliasByService

func GetServiceAliasByService(service *corev1.Service) string

GetServiceAliasByService get service alias from k8s service

func Message2Any

func Message2Any(msg proto.Message) *any.Any

Message2Any converts from proto message to proto any

func MessageToStruct

func MessageToStruct(msg proto.Message) *_struct.Struct

MessageToStruct converts from proto message to proto Struct

func ParseClustersResource

func ParseClustersResource(resources []*any.Any) []v2.Cluster

ParseClustersResource parse envoy xds server response ParseClustersResource

func ParseListenerResource

func ParseListenerResource(resources []*any.Any) []v2.Listener

ParseListenerResource parse envoy xds server response ListenersResource

func ParseLocalityLbEndpointsResource

func ParseLocalityLbEndpointsResource(resources []*any.Any) []v2.ClusterLoadAssignment

ParseLocalityLbEndpointsResource parse envoy xds server response ParseLocalityLbEndpointsResource

func ParseRouteConfigurationsResource

func ParseRouteConfigurationsResource(resources []*any.Any) []v2.RouteConfiguration

ParseRouteConfigurationsResource parse envoy xds server response RouteConfigurationsResource

Types

type ClusterOptions

type ClusterOptions struct {
	Name                     string
	ServiceName              string
	ConnectionTimeout        *duration.Duration
	ClusterType              apiv2.Cluster_DiscoveryType
	MaxRequestsPerConnection *uint32
	OutlierDetection         *cluster.OutlierDetection
	CircuitBreakers          *cluster.CircuitBreakers
	Hosts                    []*core.Address
	HealthyPanicThreshold    int64
	TLSContext               *auth.UpstreamTlsContext
	LoadAssignment           *apiv2.ClusterLoadAssignment
}

ClusterOptions cluster options

type RainbondInboundPluginOptions

type RainbondInboundPluginOptions struct {
	OpenLimit   bool
	LimitDomain string
}

RainbondInboundPluginOptions rainbond inbound plugin options

func GetRainbondInboundPluginOptions

func GetRainbondInboundPluginOptions(sr map[string]interface{}) (r RainbondInboundPluginOptions)

GetRainbondInboundPluginOptions get rainbond inbound plugin options

type RainbondPluginOptions

type RainbondPluginOptions struct {
	Prefix                   string
	MaxConnections           int
	MaxRequests              int
	MaxPendingRequests       int
	MaxActiveRetries         int
	Headers                  v1.Headers
	Domains                  []string
	Weight                   uint32
	Interval                 int64
	ConsecutiveErrors        int
	BaseEjectionTimeMS       int64
	MaxEjectionPercent       int
	MaxRequestsPerConnection *uint32
	HealthyPanicThreshold    int64
}

RainbondPluginOptions rainbond plugin config struct

func GetOptionValues

func GetOptionValues(sr map[string]interface{}) RainbondPluginOptions

GetOptionValues get value from options if not exist,return default value

func (RainbondPluginOptions) RouteBasicHash

func (r RainbondPluginOptions) RouteBasicHash() string

RouteBasicHash get basic hash for weight

type RateLimitOptions

type RateLimitOptions struct {
	Enable                bool
	Domain                string
	RateServerClusterName string
	Stage                 uint32
}

RateLimitOptions rate limit options

Jump to

Keyboard shortcuts

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