Documentation ¶
Overview ¶
Package server provides an implementation of a streaming xDS server.
Index ¶
- Constants
- Variables
- func GetResourceName(res cache.ResourceProto) string
- func GetResourceReferences(resources map[string]cache.Resource) map[string]bool
- func NewSnapshotFromResources(endpoints cache.Resources, clusters cache.Resources, routes cache.Resources, ...) cache.Snapshot
- func SetEdsOnCluster(out *envoyapi.Cluster)
- func SetupEnvoyXds(grpcServer *grpc.Server, xdsServer envoyserver.Server, ...)
- func SnapshotKey(proxy *v1.Proxy) string
- type EnvoyResource
- type EnvoyServer
- type EnvoySnapshot
- type ProxyKeyHasher
Constants ¶
const ( EndpointType = typePrefix + "ClusterLoadAssignment" ClusterType = typePrefix + "Cluster" RouteType = typePrefix + "RouteConfiguration" ListenerType = typePrefix + "Listener" )
Resource types in xDS v2.
Variables ¶
var ( // ResponseTypes are supported response types. ResponseTypes = []string{ EndpointType, ClusterType, RouteType, ListenerType, } )
Functions ¶
func GetResourceName ¶
func GetResourceName(res cache.ResourceProto) string
GetResourceName returns the resource name for a valid xDS response type.
func GetResourceReferences ¶
GetResourceReferences returns the names for dependent resources (EDS cluster names for CDS, RDS routes names for LDS).
func SetEdsOnCluster ¶ added in v0.13.16
func SetupEnvoyXds ¶
func SetupEnvoyXds(grpcServer *grpc.Server, xdsServer envoyserver.Server, envoyCache envoycache.SnapshotCache)
func SnapshotKey ¶
Types ¶
type EnvoyResource ¶
type EnvoyResource struct {
ProtoMessage cache.ResourceProto
}
func NewEnvoyResource ¶
func NewEnvoyResource(r cache.ResourceProto) *EnvoyResource
func (*EnvoyResource) Name ¶
func (e *EnvoyResource) Name() string
GetResourceName returns the resource name for a valid xDS response type.
func (*EnvoyResource) References ¶
func (e *EnvoyResource) References() []cache.XdsResourceReference
func (*EnvoyResource) ResourceProto ¶
func (e *EnvoyResource) ResourceProto() cache.ResourceProto
func (*EnvoyResource) Self ¶
func (e *EnvoyResource) Self() cache.XdsResourceReference
func (*EnvoyResource) Type ¶
func (e *EnvoyResource) Type() string
type EnvoyServer ¶
type EnvoyServer interface { v2.EndpointDiscoveryServiceServer v2.ClusterDiscoveryServiceServer v2.RouteDiscoveryServiceServer v2.ListenerDiscoveryServiceServer }
Server is a collection of handlers for streaming discovery requests.
func NewEnvoyServer ¶
func NewEnvoyServer(genericServer server.Server) EnvoyServer
NewServer creates handlers from a config watcher and an optional logger.
type EnvoySnapshot ¶
type EnvoySnapshot struct { // Endpoints are items in the EDS response payload. Endpoints cache.Resources // Clusters are items in the CDS response payload. Clusters cache.Resources // Routes are items in the RDS response payload. Routes cache.Resources // Listeners are items in the LDS response payload. Listeners cache.Resources }
Snapshot is an internally consistent snapshot of xDS resources. Consistently is important for the convergence as different resource types from the snapshot may be delivered to the proxy in arbitrary order.
func NewSnapshot ¶
func NewSnapshot(version string, endpoints []cache.Resource, clusters []cache.Resource, routes []cache.Resource, listeners []cache.Resource) *EnvoySnapshot
NewSnapshot creates a snapshot from response types and a version.
func (*EnvoySnapshot) Clone ¶ added in v0.15.0
func (s *EnvoySnapshot) Clone() cache.Snapshot
func (*EnvoySnapshot) Consistent ¶
func (s *EnvoySnapshot) Consistent() error
Consistent check verifies that the dependent resources are exactly listed in the snapshot: - all EDS resources are listed by name in CDS resources - all RDS resources are listed by name in LDS resources
Note that clusters and listeners are requested without name references, so Envoy will accept the snapshot list of clusters as-is even if it does not match all references found in xDS.
func (*EnvoySnapshot) GetResources ¶
func (s *EnvoySnapshot) GetResources(typ string) cache.Resources
GetResources selects snapshot resources by type.
type ProxyKeyHasher ¶
type ProxyKeyHasher struct {
// contains filtered or unexported fields
}
func NewNodeHasher ¶ added in v0.19.0
func NewNodeHasher() *ProxyKeyHasher
func (*ProxyKeyHasher) SetKeysFromProxies ¶
func (h *ProxyKeyHasher) SetKeysFromProxies(proxies v1.ProxyList)
Called in Syncer when a new set of proxies arrive