Documentation ¶
Overview ¶
Package contour implements a REST API server for Envoy's RDS/SDS/CDS v1 JSON API and a gRPC API server for the xDS vs gRPC API.
Index ¶
- Constants
- func EndpointsToSDSHosts(e *v1.Endpoints, port int) ([]*envoy.SDSHost, error)
- func IngressToVirtualHosts(i *v1beta1.Ingress) ([]*envoy.VirtualHost, error)
- func NewGRPCAPI(l log.Logger, cc ClusterCache, ec ClusterLoadAssignmentCache, ...) *grpc.Server
- func NewJSONAPI(l log.Logger, ds *DataSource) http.Handler
- func ServiceToClusters(s *v1.Service) ([]envoy.Cluster, error)
- type CDS
- type ClusterCache
- type ClusterLoadAssignmentCache
- type DataSource
- type EDS
- type EndpointsCache
- type IngressCache
- type LDS
- type ListenerCache
- type RDS
- type ServiceCache
- type VirtualHostCache
Constants ¶
const ( EndpointType = typePrefix + "ClusterLoadAssignment" ClusterType = typePrefix + "Cluster" RouteType = typePrefix + "RouteConfiguration" ListenerType = typePrefix + "Listener" )
Resource types in xDS v2.
Variables ¶
This section is empty.
Functions ¶
func EndpointsToSDSHosts ¶
EndpointsToSDSHosts translates a *v1.Endpoints document to []*envoy.SDSHost.
func IngressToVirtualHosts ¶
func IngressToVirtualHosts(i *v1beta1.Ingress) ([]*envoy.VirtualHost, error)
IngressToVirtualHosts translates an Ingress to a slice of *envoy.VirtualHost.
func NewGRPCAPI ¶
func NewGRPCAPI(l log.Logger, cc ClusterCache, ec ClusterLoadAssignmentCache, rc VirtualHostCache) *grpc.Server
NewGPRCAPI returns a *grpc.Server which responds to the Envoy v2 xDS gRPC API.
func NewJSONAPI ¶
func NewJSONAPI(l log.Logger, ds *DataSource) http.Handler
NewJSONAPI returns a http.Handler which responds to the Envoy CDS, RDS, and SDS v1 REST API calls.
Types ¶
type CDS ¶
type CDS struct { log.Logger ClusterCache }
CDS implements the CDS v2 gRPC API.
func (*CDS) FetchClusters ¶
func (c *CDS) FetchClusters(_ context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error)
func (*CDS) StreamClusters ¶
func (c *CDS) StreamClusters(srv v2.ClusterDiscoveryService_StreamClustersServer) error
type ClusterCache ¶
type ClusterCache interface { // Values returns a copy of the contents of the cache. // The slice and its contents should be treated as read-only. Values() []*v2.Cluster }
ClusterCache holds a set of computed v2.Cluster resources.
type ClusterLoadAssignmentCache ¶
type ClusterLoadAssignmentCache interface { // Values returns a copy of the contents of the cache. // The slice and its contents should be treated as read-only. Values() []*v2.ClusterLoadAssignment }
ClusterLoadAssignmentCache holds a set of computed v2.ClusterLoadAssignment resources.
type DataSource ¶
type DataSource struct { log.Logger ServiceCache EndpointsCache IngressCache }
DataSource provides Service, Ingress, and Endpoints caches.
func (*DataSource) OnAdd ¶
func (ds *DataSource) OnAdd(obj interface{})
func (*DataSource) OnDelete ¶
func (ds *DataSource) OnDelete(obj interface{})
func (*DataSource) OnUpdate ¶
func (ds *DataSource) OnUpdate(_, newObj interface{})
type EDS ¶
type EDS struct { log.Logger ClusterLoadAssignmentCache }
EDS implements the EDS v2 gRPC API.
func (*EDS) FetchEndpoints ¶
func (e *EDS) FetchEndpoints(_ context.Context, req *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error)
func (*EDS) StreamEndpoints ¶
func (e *EDS) StreamEndpoints(srv v2.EndpointDiscoveryService_StreamEndpointsServer) error
func (*EDS) StreamLoadStats ¶
func (e *EDS) StreamLoadStats(srv v2.EndpointDiscoveryService_StreamLoadStatsServer) error
type EndpointsCache ¶
type EndpointsCache struct {
// contains filtered or unexported fields
}
EndpointsCache is a goroutine safe cache of v1.Endpoints objects.
func (*EndpointsCache) AddEndpoints ¶
func (ec *EndpointsCache) AddEndpoints(e *v1.Endpoints)
AddEndpoints adds the Endpoints to the EndpointsCache. If the Endpoints is already present in the EndpointsCache it is replaced unconditionally.
func (*EndpointsCache) Each ¶
func (ec *EndpointsCache) Each(fn func(*v1.Endpoints))
Each calls fn for every v1.Endpoints in the cache. The iteration order is not stable.
func (*EndpointsCache) RemoveEndpoints ¶
func (ec *EndpointsCache) RemoveEndpoints(e *v1.Endpoints)
RemoveEndpoints removes the Endpoints from the EndpointsCache.
type IngressCache ¶
type IngressCache struct {
// contains filtered or unexported fields
}
IngressCacche is a goroutine safe cache of extentions.Ingress objects.
func (*IngressCache) AddIngress ¶
func (ic *IngressCache) AddIngress(i *v1beta1.Ingress)
AddIngress adds the Ingress to the IngressCache. If the Ingress is already present in the IngressCache it is replaced unconditionally.
func (*IngressCache) Each ¶
func (ic *IngressCache) Each(fn func(*v1beta1.Ingress))
Each calls fn for every Ingress in the cache. The iteration order is not stable.
func (*IngressCache) RemoveIngress ¶
func (ic *IngressCache) RemoveIngress(i *v1beta1.Ingress)
RemoveIngress removes the Ingress from the IngressCache..
type LDS ¶
type LDS struct { log.Logger ListenerCache }
LDS implements the LDS v2 gRPC API.
func (*LDS) FetchListeners ¶
func (l *LDS) FetchListeners(context.Context, *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error)
func (*LDS) StreamListeners ¶
func (l *LDS) StreamListeners(srv v2.ListenerDiscoveryService_StreamListenersServer) error
type ListenerCache ¶
type ListenerCache interface { // Values returns a copy of the contents of the cache. // The slice and its contents should be treated as read-only. Values() []*v2.Listener }
ListenerCache holds a set of computed v2.Listener resources.
type RDS ¶
type RDS struct { log.Logger VirtualHostCache }
RDS implements the RDS v2 gRPC API.
func (*RDS) FetchRoutes ¶
func (r *RDS) FetchRoutes(context.Context, *v2.DiscoveryRequest) (*v2.DiscoveryResponse, error)
func (*RDS) StreamRoutes ¶
func (r *RDS) StreamRoutes(srv v2.RouteDiscoveryService_StreamRoutesServer) error
type ServiceCache ¶
type ServiceCache struct {
// contains filtered or unexported fields
}
ServiceCache is a goroutine safe cache of v1.Service objects.
func (*ServiceCache) AddService ¶
func (sc *ServiceCache) AddService(s *v1.Service)
AddService adds the Service to the ServiceCache. If the Service is already present in the ServiceCache it is replaced unconditionally.
func (*ServiceCache) Each ¶
func (sc *ServiceCache) Each(fn func(*v1.Service))
Each calls fn for every v1.Service in the cache in lexical order of the services' UID
func (*ServiceCache) RemoveService ¶
func (sc *ServiceCache) RemoveService(s *v1.Service)
RemoveService removes the Service from the ServiceCache.
type VirtualHostCache ¶
type VirtualHostCache interface { // Values returns a copy of the contents of the cache. // The slice and its contents should be treated as read-only. Values() []*v2.VirtualHost }
VirtualHostCache holds a set of computed v2.VirtualHost resources.