Documentation ¶
Index ¶
- Constants
- Variables
- func CheckWeightSum(clusters []*route.WeightedCluster_ClusterWeight, weight uint32) uint32
- func ConverTimeDuration(second int64) *duration.Duration
- func ConversionTypeUInt32(value uint32) *types.UInt32Value
- func ConversionUInt32(value uint32) *wrappers.UInt32Value
- func CreatOutlierDetection(options RainbondPluginOptions) *cluster.OutlierDetection
- func CreateCircuitBreaker(options RainbondPluginOptions) *cluster.CircuitBreakers
- func CreateCluster(options ClusterOptions) *apiv2.Cluster
- func CreateDNSLoadAssignment(serviceAlias, namespace, domain string, service *corev1.Service) *apiv2.ClusterLoadAssignment
- func CreateEDSClusterConfig(serviceName string) *apiv2.Cluster_EdsClusterConfig
- func CreateHTTPConnectionManager(name, statPrefix string, rateOpt *RateLimitOptions, ...) *http_connection_manager.HttpConnectionManager
- func CreateHTTPListener(name, address, statPrefix string, port uint32, rateOpt *RateLimitOptions, ...) *apiv2.Listener
- func CreateHTTPRateLimit(option RateLimitOptions) *http_rate_limit.RateLimit
- func CreateHeaderMatcher(header v1.Header) *route.HeaderMatcher
- func CreateRoute(clusterName, prefix string, headers []*route.HeaderMatcher, weight uint32) *route.Route
- func CreateRouteVirtualHost(name string, domains []string, rateLimits []*route.RateLimit, ...) *route.VirtualHost
- func CreateRouteWithHostRewrite(host, clusterName, prefix string, headers []*route.HeaderMatcher, ...) *route.Route
- func CreateSocketAddress(protocol, address string, port uint32) *core.Address
- func CreateTCPListener(name, clusterName, address, statPrefix string, port uint32) *apiv2.Listener
- func CreateUDPListener(name, clusterName, address, statPrefix string, port uint32) *apiv2.Listener
- func GetServiceAliasByService(service *corev1.Service) string
- func Message2Any(msg proto.Message) *any.Any
- func MessageToStruct(msg proto.Message) *_struct.Struct
- func ParseClustersResource(resources []*any.Any) []v2.Cluster
- func ParseListenerResource(resources []*any.Any) []v2.Listener
- func ParseLocalityLbEndpointsResource(resources []*any.Any) []v2.ClusterLoadAssignment
- func ParseRouteConfigurationsResource(resources []*any.Any) []v2.RouteConfiguration
- type ClusterOptions
- type RainbondInboundPluginOptions
- type RainbondPluginOptions
- type RateLimitOptions
Constants ¶
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 ¶
var DefaultLocalhostListenerAddress = "127.0.0.1"
DefaultLocalhostListenerAddress -
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 ¶
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 ¶
CreateSocketAddress create socket address
func CreateTCPListener ¶
CreateTCPListener listener builder
func CreateUDPListener ¶
CreateUDPListener create udp listenner
func GetServiceAliasByService ¶
GetServiceAliasByService get service alias from k8s service
func Message2Any ¶
Message2Any converts from proto message to proto any
func MessageToStruct ¶
MessageToStruct converts from proto message to proto Struct
func ParseClustersResource ¶
ParseClustersResource parse envoy xds server response ParseClustersResource
func ParseListenerResource ¶
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 ¶
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