sidecarhttp

package
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Used to join service name and port. Must not occur in service names
	ServiceNameSeparator = ":"
)

Variables

This section is empty.

Functions

func ServeHttp

func ServeHttp(list *memberlist.Memberlist, state *catalog.ServicesState, config *HttpConfig)

func SvcName

func SvcName(name string, port int64) string

Format an Envoy service name from our service name and port

func SvcNameSplit

func SvcNameSplit(name string) (string, int64, error)

Split an Enovy service name into our service name and port

Types

type ApiServer

type ApiServer struct {
	Name         string
	LastUpdated  time.Time
	ServiceCount int
}

type ApiServices

type ApiServices struct {
	Services       map[string][]*service.Service
	ClusterMembers map[string]*ApiServer `json:",omitempty"`
	ClusterName    string
}

type EnvoyApi

type EnvoyApi struct {
	// contains filtered or unexported fields
}

func (*EnvoyApi) EnvoyClustersFromState

func (s *EnvoyApi) EnvoyClustersFromState() []*EnvoyCluster

EnvoyClustersFromState genenerates a set of Envoy API cluster definitions from Sidecar state

func (*EnvoyApi) EnvoyListenerFromService

func (s *EnvoyApi) EnvoyListenerFromService(svc *service.Service, port int64) *EnvoyListener

EnvoyListenerFromService takes a Sidecar service and formats it into the API format for an Envoy proxy listener (LDS API v1)

func (*EnvoyApi) EnvoyListenersFromState

func (s *EnvoyApi) EnvoyListenersFromState() []*EnvoyListener

EnvoyListenersFromState creates a set of Enovy API listener definitions from all the ServicePorts in the Sidecar state.

func (*EnvoyApi) EnvoyServiceFromService

func (s *EnvoyApi) EnvoyServiceFromService(svc *service.Service, svcPort int64) *EnvoyService

EnvoyServiceFromService converts a Sidecar service to an Envoy API service for reporting to the proxy

func (*EnvoyApi) HttpMux

func (s *EnvoyApi) HttpMux() http.Handler

HttpMux returns a configured Gorilla mux to handle all the endpoints for the Envoy API.

type EnvoyCluster

type EnvoyCluster struct {
	Name             string `json:"name"`
	Type             string `json:"type"`
	ConnectTimeoutMs int64  `json:"connect_timeout_ms"`
	LBType           string `json:"lb_type"`
	ServiceName      string `json:"service_name"`
}

See https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/cluster.html

type EnvoyFilter

type EnvoyFilter struct {
	Name   string                 `json:"name"`
	Config *EnvoyHttpFilterConfig `json:"config"`
}

A basic Envoy Http Route Filter

type EnvoyHttpFilterConfig

type EnvoyHttpFilterConfig struct {
	CodecType   string            `json:"codec_type,omitempty"`
	StatPrefix  string            `json:"stat_prefix,omitempty"`
	RouteConfig *EnvoyRouteConfig `json:"route_config,omitempty"`
	Filters     []*EnvoyFilter    `json:"filters,omitempty"`
}

type EnvoyListener

type EnvoyListener struct {
	Name    string         `json:"name"`
	Address string         `json:"address"`
	Filters []*EnvoyFilter `json:"filters"` // TODO support filters?

}

https://www.envoyproxy.io/docs/envoy/latest/api-v1/listeners/listeners.html

type EnvoyRoute

type EnvoyRoute struct {
	TimeoutMs   int    `json:"timeout_ms"`
	Prefix      string `json:"prefix"`
	HostRewrite string `json:"host_rewrite"`
	Cluster     string `json:"cluster"`
}

type EnvoyRouteConfig

type EnvoyRouteConfig struct {
	VirtualHosts []*EnvoyVirtualHost `json:"virtual_hosts"`
}

type EnvoyService

type EnvoyService struct {
	IPAddress       string            `json:"ip_address"`
	LastCheckIn     string            `json:"last_check_in"`
	Port            int64             `json:"port"`
	Revision        string            `json:"revision"`
	Service         string            `json:"service"`
	ServiceRepoName string            `json:"service_repo_name"`
	Tags            map[string]string `json:"tags"`
}

See https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/sds.html

type EnvoyVirtualHost

type EnvoyVirtualHost struct {
	Name    string        `json:"name"`
	Domains []string      `json:"domains"`
	Routes  []*EnvoyRoute `json:"routes"`
}

type HttpConfig

type HttpConfig struct {
	BindIP       string
	UseHostnames bool
}

type HttpListener

type HttpListener struct {
	// contains filtered or unexported fields
}

A ServicesState.Listener that we use for the /watch endpoint

func NewHttpListener

func NewHttpListener() *HttpListener

func (*HttpListener) Chan

func (h *HttpListener) Chan() chan catalog.ChangeEvent

func (*HttpListener) Managed

func (h *HttpListener) Managed() bool

func (*HttpListener) Name

func (h *HttpListener) Name() string

type Member

type Member struct {
	Node    *memberlist.Node
	Updated time.Time
}

type SidecarApi

type SidecarApi struct {
	// contains filtered or unexported fields
}

func (*SidecarApi) HttpMux

func (s *SidecarApi) HttpMux() http.Handler

Jump to

Keyboard shortcuts

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