contour

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2017 License: Apache-2.0 Imports: 27 Imported by: 0

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

View Source
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

func EndpointsToSDSHosts(e *v1.Endpoints, port int) ([]*envoy.SDSHost, error)

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

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.

func ServiceToClusters

func ServiceToClusters(s *v1.Service) ([]envoy.Cluster, error)

ServiceToClusters translates a *v1.Service document to a []envoy.Cluster.

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

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 (*EDS) StreamLoadStats

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

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 (*RDS) StreamRoutes

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.

Jump to

Keyboard shortcuts

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