Documentation ¶
Index ¶
- Constants
- func AddHandler(typ string, handler TypeHandler)
- type AdsService
- func (*AdsService) ConfigUpdate(bool)
- func (s *AdsService) DeltaAggregatedResources(stream ads.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error
- func (fx *AdsService) Send(con *Connection, rtype string, r *v1alpha1.Resources) error
- func (fx *AdsService) SendAll(r *v1alpha1.Resources)
- func (fx *AdsService) ServiceEntriesUpdate(shard, hostname string, entry []*v1alpha3.ServiceEntry) error
- func (s *AdsService) StreamAggregatedResources(stream ads.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error
- func (fx *AdsService) SvcUpdate(shard, hostname string, ports map[string]uint32, rports map[uint32]string)
- func (fx *AdsService) WorkloadUpdate(id string, labels map[string]string, annotations map[string]string)
- type Connection
- type Endpoints
- type NodeID
- type Stream
- type TypeHandler
Constants ¶
const ServiceEntriesType = "istio/networking/v1alpha3/serviceentries"
Variables ¶
This section is empty.
Functions ¶
func AddHandler ¶
func AddHandler(typ string, handler TypeHandler)
Types ¶
type AdsService ¶
type AdsService struct {
// contains filtered or unexported fields
}
AdsService implements ADS, MCP, SDS (and possibly other bi-directional streams of objects)
func NewService ¶
func NewService(addr string) *AdsService
NewService initialized the grpc services. Non-blocking, returns error if it can't listen on the address.
func (*AdsService) ConfigUpdate ¶
func (*AdsService) ConfigUpdate(bool)
func (*AdsService) DeltaAggregatedResources ¶
func (s *AdsService) DeltaAggregatedResources(stream ads.AggregatedDiscoveryService_DeltaAggregatedResourcesServer) error
IncrementalAggregatedResources is not implemented.
func (*AdsService) Send ¶
func (fx *AdsService) Send(con *Connection, rtype string, r *v1alpha1.Resources) error
func (*AdsService) SendAll ¶
func (fx *AdsService) SendAll(r *v1alpha1.Resources)
func (*AdsService) ServiceEntriesUpdate ¶
func (fx *AdsService) ServiceEntriesUpdate(shard, hostname string, entry []*v1alpha3.ServiceEntry) error
Called when a new endpoint is added to a shard.
func (*AdsService) StreamAggregatedResources ¶
func (s *AdsService) StreamAggregatedResources(stream ads.AggregatedDiscoveryService_StreamAggregatedResourcesServer) error
StreamAggregatedResources implements the Envoy variant. Can be used directly with EDS.
func (*AdsService) SvcUpdate ¶
func (fx *AdsService) SvcUpdate(shard, hostname string, ports map[string]uint32, rports map[uint32]string)
SvcUpdate is called when a service port mapping definition is updated. This interface is WIP - labels, annotations and other changes to service may be updated to force a EDS and CDS recomputation and incremental push, as it doesn't affect LDS/RDS.
func (*AdsService) WorkloadUpdate ¶
func (fx *AdsService) WorkloadUpdate(id string, labels map[string]string, annotations map[string]string)
Called on pod events.
type Connection ¶
type Connection struct { // PeerAddr is the address of the client envoy, from network layer PeerAddr string NodeID string // Time of connection, for debugging Connect time.Time // ConID is the connection identifier, used as a key in the connection table. // Currently based on the node name and a counter. ConID string // Metadata key-value pairs extending the Node identifier Metadata map[string]string // Watched resources for the connection Watched map[string][]string NonceSent map[string]string NonceAcked map[string]string // Only one can be set. Stream Stream // contains filtered or unexported fields }
Connection represents a single endpoint. An endpoint typically has 0 or 1 connections - but during restarts and drain it may have >1.
type NodeID ¶
type NodeID struct { // Type can be sidecar, ingress, router. Other names are possible. Type string // IPAddress is the declared IP. If missing, the peer address can be used IPAddress string // WorkloadID identifies the workload. In K8S it is podID.namespace WorkloadID string // Domain suffix for short hostnames. In k8s it is the namespace.svc.cluster.local Domain string }
type Stream ¶
type Stream interface { // Send will push a message. // Message can be mcp.Resources, v2.DiscoveryResponse, sds, etc. Send(proto.Message) error // Recv is used by the main stream process goroutine to get requests from the endpoint. // Can be mcp.RequestResources ,v2.DiscoveryRequest Recv() (proto.Message, error) // Context returns the context for the connection, for metadata. Context() context.Context // Process is called by the stream processing goroutine on each received message. // Should not block - no new Recv will be called while Process is in progress. Process(s *AdsService, con *Connection, message proto.Message) error }
Streams abstracts the protocol details. Generic Message is used for sending and receiving.
type TypeHandler ¶
type TypeHandler func(s *AdsService, con *Connection, rtype string, res []string) error
TypeHandler is called when a request for a type is first received. It should send the list of resources on the connection.