propsy

package
v0.0.0-...-bc8946d Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: BSD-2-Clause Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LocalZone string

Functions

func ClusterToEnvoy

func ClusterToEnvoy(targetName string, connectTimeout, maxRequests int, healthCheck *HealthCheckConfig, outlier *OutlierConfig) *v2.Cluster

func DurationToDuration

func DurationToDuration(duration time.Duration) *types.Duration

func GenerateEnvoyConfig

func GenerateEnvoyConfig(n *NodeConfig)

func GenerateListenerName

func GenerateListenerName(listen string, xtype ProxyType) string

func GenerateRouteName

func GenerateRouteName(pathSpec string) (string, string)

func GenerateUniqConfigName

func GenerateUniqConfigName(namespace, name string) string

func GenerateUniqueEndpointName

func GenerateUniqueEndpointName(priority int, namespace, name string) string

func GenerateVHostName

func GenerateVHostName(domains []string) string

func GetGRPCServer

func GetGRPCServer() *grpc.Server

func InitGRPCServer

func InitGRPCServer()

func RemoveFromEnvoy

func RemoveFromEnvoy(node *NodeConfig)

func UInt32FromInteger

func UInt32FromInteger(val int) *types.UInt32Value

func UInt64FromInteger

func UInt64FromInteger(val int) *types.UInt64Value

func WeightedClusterToEnvoy

func WeightedClusterToEnvoy(clusterName string, zoneWeight int) *route.WeightedCluster_ClusterWeight

Types

type ClusterConfig

type ClusterConfig struct {
	Name           string
	ConnectTimeout int
	EndpointConfig *EndpointConfig
	Weight         int
	IsCanary       bool
	MaxRequests    int
	Priority       int
	HealthCheck    *HealthCheckConfig
	Outlier        *OutlierConfig
}

func (*ClusterConfig) Free

func (C *ClusterConfig) Free()

func (*ClusterConfig) HasEndpoints

func (C *ClusterConfig) HasEndpoints() bool

func (*ClusterConfig) IsLocalCluster

func (C *ClusterConfig) IsLocalCluster() bool

func (*ClusterConfig) String

func (C *ClusterConfig) String() string

func (*ClusterConfig) ToEnvoy

func (C *ClusterConfig) ToEnvoy() *v2.Cluster

type ClusterLoadAssignment

type ClusterLoadAssignment []*endpoint.LocalityLbEndpoints

func (*ClusterLoadAssignment) ToEnvoy

func (C *ClusterLoadAssignment) ToEnvoy(clusterName string) *v2.ClusterLoadAssignment

type Endpoint

type Endpoint struct {
	Host    string
	Weight  int
	Healthy bool
}

func (*Endpoint) String

func (E *Endpoint) String() string

func (*Endpoint) ToEnvoy

func (E *Endpoint) ToEnvoy(port int) *endpoint.LbEndpoint

type EndpointConfig

type EndpointConfig struct {
	Lock        sync.Mutex
	Name        string
	ServicePort int // used only internally
	Endpoints   []*Endpoint
	Locality    *Locality
}

func (*EndpointConfig) AddEndpoint

func (E *EndpointConfig) AddEndpoint(host string, weight int, healthy bool)

func (*EndpointConfig) Clear

func (E *EndpointConfig) Clear()

func (*EndpointConfig) GetEndpoint

func (E *EndpointConfig) GetEndpoint(host string) *Endpoint

func (*EndpointConfig) RemoveEndpoint

func (E *EndpointConfig) RemoveEndpoint(host string)

func (*EndpointConfig) String

func (E *EndpointConfig) String() string

func (*EndpointConfig) ToEnvoy

func (E *EndpointConfig) ToEnvoy(priority, weight int) *endpoint.LocalityLbEndpoints

type EnvoyCertificateValidator

type EnvoyCertificateValidator struct {
	VerifyCN bool
	// contains filtered or unexported fields
}

func (*EnvoyCertificateValidator) Add

func (P *EnvoyCertificateValidator) Add(ctx context.Context, streamid int64)

func (*EnvoyCertificateValidator) VerifyCtx

func (*EnvoyCertificateValidator) VerifyStream

func (P *EnvoyCertificateValidator) VerifyStream(streamid int64, dr *api.DiscoveryRequest) error

type Hasher

type Hasher struct {
}

Hasher returns node ID as an ID

func (Hasher) ID

func (h Hasher) ID(node *core.Node) string

ID function

type HealthCheckConfig

type HealthCheckConfig struct {
	Timeout           time.Duration
	Interval          time.Duration
	UnhealthyTreshold int
	HealthyTreshold   int
	ReuseConnection   bool
	HealthChecker     HealthCheckType
	HTTPPath          string
	HTTPHost          string
}

func (*HealthCheckConfig) ToEnvoy

func (H *HealthCheckConfig) ToEnvoy() *core.HealthCheck

type HealthCheckType

type HealthCheckType int
const (
	HTTPHealthCheck HealthCheckType = iota
	HTTP2HealthCheck
	TCPHealthCheck
	GRPCHealthCheck
)

type HealthServer

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

func NewHealthServer

func NewHealthServer(listen string) *HealthServer

func (*HealthServer) SetHealthy

func (H *HealthServer) SetHealthy(healthy bool)

func (*HealthServer) SetReady

func (H *HealthServer) SetReady(ready bool)

func (*HealthServer) Start

func (H *HealthServer) Start()

type ListenerConfig

type ListenerConfig struct {
	Name            string
	Listen          string
	VirtualHosts    []*VirtualHost
	Type            ProxyType
	TrackedLocality []string
	TLSSecret       *TlsData
	// contains filtered or unexported fields
}

func (*ListenerConfig) AddTracker

func (L *ListenerConfig) AddTracker(zone string)

func (*ListenerConfig) AddVHost

func (L *ListenerConfig) AddVHost(host *VirtualHost)

func (*ListenerConfig) AddVHosts

func (L *ListenerConfig) AddVHosts(hosts []*VirtualHost)

func (*ListenerConfig) CanBeRemovedBy

func (L *ListenerConfig) CanBeRemovedBy(zone string) bool

func (*ListenerConfig) FindVHost

func (L *ListenerConfig) FindVHost(name string) *VirtualHost

func (*ListenerConfig) Free

func (L *ListenerConfig) Free()

func (*ListenerConfig) GenerateHCM

func (L *ListenerConfig) GenerateHCM(vhosts []*route.VirtualHost) *v22.HttpConnectionManager

func (*ListenerConfig) GenerateListenParts

func (L *ListenerConfig) GenerateListenParts() (host string, port int64)

func (*ListenerConfig) GenerateTCP

func (L *ListenerConfig) GenerateTCP(clusters *v23.TcpProxy_WeightedClusters) *v23.TcpProxy

func (*ListenerConfig) GenerateWeightedCluster

func (L *ListenerConfig) GenerateWeightedCluster(host *route.VirtualHost) *v23.TcpProxy_WeightedClusters

func (*ListenerConfig) GetPriorityTracker

func (L *ListenerConfig) GetPriorityTracker() string

func (*ListenerConfig) GetTrackerCount

func (L *ListenerConfig) GetTrackerCount() int

func (*ListenerConfig) IsTrackedBy

func (L *ListenerConfig) IsTrackedBy(zone string) bool

func (*ListenerConfig) RemoveTracker

func (L *ListenerConfig) RemoveTracker(zone string)

func (*ListenerConfig) RemoveVHost

func (L *ListenerConfig) RemoveVHost(name string)

func (*ListenerConfig) SafeRemove

func (L *ListenerConfig) SafeRemove(vhost, route, clusterName, zone string)

func (*ListenerConfig) String

func (L *ListenerConfig) String() string

func (*ListenerConfig) ToEnvoy

func (L *ListenerConfig) ToEnvoy(vhosts []*route.VirtualHost) (*v2.Listener, error)

type Locality

type Locality struct {
	// Region string // region is fixed, we only change zone
	Zone string
}

func (*Locality) ToEnvoy

func (L *Locality) ToEnvoy() *core.Locality

type NodeConfig

type NodeConfig struct {
	NodeName  string
	Listeners []*ListenerConfig
}

func (*NodeConfig) AddListener

func (N *NodeConfig) AddListener(l *ListenerConfig)

func (*NodeConfig) FindListener

func (N *NodeConfig) FindListener(name string) *ListenerConfig

func (*NodeConfig) Free

func (N *NodeConfig) Free()

func (*NodeConfig) RemoveListener

func (N *NodeConfig) RemoveListener(s string)

func (*NodeConfig) Update

func (N *NodeConfig) Update()

type OutlierConfig

type OutlierConfig struct {
	ConsecutiveErrors   int
	ConsecutiveGwErrors int
	Interval            time.Duration
	EjectionTime        time.Duration
	EjectionPercent     int
	MinimumHosts        int
	MinimumRequests     int
}

func (*OutlierConfig) ToEnvoy

func (O *OutlierConfig) ToEnvoy() *cluster.OutlierDetection

type ProPsyCache

type ProPsyCache struct {
	MutexEndpoints sync.Mutex

	LatestPPSAdded time.Time
	// contains filtered or unexported fields
}

func NewProPsyCache

func NewProPsyCache() *ProPsyCache

func (*ProPsyCache) AddTLSWatch

func (P *ProPsyCache) AddTLSWatch(secretNamespace, secretName string, node *NodeConfig)

func (*ProPsyCache) Cleanup

func (P *ProPsyCache) Cleanup()

func (*ProPsyCache) ClearPPS

func (P *ProPsyCache) ClearPPS(ppsName string, nodes []string, canaryName string)

func (*ProPsyCache) DumpNodes

func (P *ProPsyCache) DumpNodes()

func (*ProPsyCache) GetEndpointSetByEndpoint

func (P *ProPsyCache) GetEndpointSetByEndpoint(endpointName string) (*EndpointConfig, []*NodeConfig)

func (*ProPsyCache) GetNodes

func (P *ProPsyCache) GetNodes() map[string]*NodeConfig

func (*ProPsyCache) GetOrCreateNode

func (P *ProPsyCache) GetOrCreateNode(name string) *NodeConfig

func (*ProPsyCache) GetOrCreateTLS

func (P *ProPsyCache) GetOrCreateTLS(namespace, name string) *TlsData

func (*ProPsyCache) GetTls

func (P *ProPsyCache) GetTls(namespace, name string) *TlsData

func (*ProPsyCache) ProcessQueueOnce

func (P *ProPsyCache) ProcessQueueOnce()

processes the whole queue one time

func (*ProPsyCache) RegisterEndpointSet

func (P *ProPsyCache) RegisterEndpointSet(cfg *EndpointConfig, nodes []*NodeConfig)

func (*ProPsyCache) RemoveEndpointSet

func (P *ProPsyCache) RemoveEndpointSet(s string, nodes []*NodeConfig)

func (*ProPsyCache) RemoveTLSWatch

func (P *ProPsyCache) RemoveTLSWatch(secretNamespace, secretName string, node *NodeConfig)

func (*ProPsyCache) Run

func (P *ProPsyCache) Run()

func (*ProPsyCache) UpdateTLS

func (C *ProPsyCache) UpdateTLS(secretNamespace, secretName string, certificate, key []byte) bool

type PropsyCallbacks

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

func (PropsyCallbacks) OnFetchRequest

func (P PropsyCallbacks) OnFetchRequest(ctx context.Context, dr *api.DiscoveryRequest) error

func (PropsyCallbacks) OnFetchResponse

func (PropsyCallbacks) OnStreamClosed

func (PropsyCallbacks) OnStreamClosed(int64)

func (PropsyCallbacks) OnStreamOpen

func (P PropsyCallbacks) OnStreamOpen(ctx context.Context, streamid int64, typeurl string) error

func (PropsyCallbacks) OnStreamRequest

func (P PropsyCallbacks) OnStreamRequest(streamid int64, dr *api.DiscoveryRequest) error

func (PropsyCallbacks) OnStreamResponse

type ProxyType

type ProxyType int
const (
	HTTP ProxyType = iota
	TCP
)

type RouteConfig

type RouteConfig struct {
	Name          string
	Clusters      []*ClusterConfig
	PathPrefix    string
	PrefixRewrite string
	Timeout       time.Duration
}

func (*RouteConfig) AddCluster

func (R *RouteConfig) AddCluster(c *ClusterConfig)

func (*RouteConfig) AddClusters

func (R *RouteConfig) AddClusters(configs []*ClusterConfig)

func (*RouteConfig) CalculateWeights

func (R *RouteConfig) CalculateWeights() (
	totalWeight, localZoneWeight, otherZonesWeight, canariesWeight, connectTimeout, maxRequests int)

func (*RouteConfig) FindCluster

func (R *RouteConfig) FindCluster(name string) *ClusterConfig

func (*RouteConfig) Free

func (R *RouteConfig) Free()

func (*RouteConfig) GeneratePrioritizedEndpoints

func (R *RouteConfig) GeneratePrioritizedEndpoints(localZone string) ClusterLoadAssignment

func (*RouteConfig) GenerateUniqueRouteName

func (R *RouteConfig) GenerateUniqueRouteName() string

func (*RouteConfig) GetLocalBestCluster

func (R *RouteConfig) GetLocalBestCluster(canary bool) *ClusterConfig

func (*RouteConfig) RemoveCluster

func (R *RouteConfig) RemoveCluster(name string)

func (*RouteConfig) String

func (R *RouteConfig) String() string

func (*RouteConfig) ToEnvoy

func (R *RouteConfig) ToEnvoy(routedClusters []*route.WeightedCluster_ClusterWeight) *route.Route

type TlsData

type TlsData struct {
	Certificate []byte
	Key         []byte
}

type VirtualHost

type VirtualHost struct {
	Name    string
	Domains []string
	Routes  []*RouteConfig
}

func (*VirtualHost) AddRoute

func (V *VirtualHost) AddRoute(r *RouteConfig)

func (*VirtualHost) AddRoutes

func (V *VirtualHost) AddRoutes(configs []*RouteConfig)

func (*VirtualHost) FindRoute

func (V *VirtualHost) FindRoute(name string) *RouteConfig

func (*VirtualHost) Free

func (V *VirtualHost) Free()

func (*VirtualHost) RemoveRoute

func (V *VirtualHost) RemoveRoute(name string)

func (*VirtualHost) SafeRemoveRoute

func (V *VirtualHost) SafeRemoveRoute(route string, clusterName string)

func (*VirtualHost) String

func (V *VirtualHost) String() string

func (*VirtualHost) ToEnvoy

func (V *VirtualHost) ToEnvoy(routes []*route.Route) *route.VirtualHost

Jump to

Keyboard shortcuts

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