Documentation ¶
Overview ¶
Package json implements a REST API server for Envoy's RDS/SDS/CDS v1 JSON API.
Index ¶
- func EndpointsToSDSHosts(e *v1.Endpoints, port int) ([]*envoy.SDSHost, error)
- func IngressToVirtualHosts(i *v1beta1.Ingress) ([]*envoy.VirtualHost, error)
- func NewAPI(l log.Logger, ds *DataSource) http.Handler
- func ServiceToClusters(s *v1.Service) ([]envoy.Cluster, error)
- type DataSource
- type EndpointsCache
- type IngressCache
- type ServiceCache
Constants ¶
This section is empty.
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.
Types ¶
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 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 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.