json

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package json implements a REST API server for Envoy's RDS/SDS/CDS v1 JSON API.

Index

Constants

This section is empty.

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 NewAPI

func NewAPI(l log.Logger, ds *DataSource) http.Handler

NewAPI 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 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.

Jump to

Keyboard shortcuts

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