sidecarhttp

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: MIT Imports: 17 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 CDSResult

type CDSResult struct {
	Clusters []*EnvoyCluster `json:"clusters"`
}

func (*CDSResult) MarshalJSON

func (j *CDSResult) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*CDSResult) MarshalJSONBuf

func (j *CDSResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*CDSResult) UnmarshalJSON

func (j *CDSResult) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*CDSResult) UnmarshalJSONFFLexer

func (j *CDSResult) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

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.

func (*EnvoyApi) MarshalJSON

func (j *EnvoyApi) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyApi) MarshalJSONBuf

func (j *EnvoyApi) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyApi) UnmarshalJSON

func (j *EnvoyApi) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyApi) UnmarshalJSONFFLexer

func (j *EnvoyApi) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

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

func (*EnvoyCluster) MarshalJSON

func (j *EnvoyCluster) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyCluster) MarshalJSONBuf

func (j *EnvoyCluster) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyCluster) UnmarshalJSON

func (j *EnvoyCluster) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyCluster) UnmarshalJSONFFLexer

func (j *EnvoyCluster) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type EnvoyFilter

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

A basic Envoy Route Filter

func (*EnvoyFilter) MarshalJSON

func (j *EnvoyFilter) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyFilter) MarshalJSONBuf

func (j *EnvoyFilter) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyFilter) UnmarshalJSON

func (j *EnvoyFilter) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyFilter) UnmarshalJSONFFLexer

func (j *EnvoyFilter) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type EnvoyFilterConfig

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

func (*EnvoyFilterConfig) MarshalJSON

func (j *EnvoyFilterConfig) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyFilterConfig) MarshalJSONBuf

func (j *EnvoyFilterConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyFilterConfig) UnmarshalJSON

func (j *EnvoyFilterConfig) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyFilterConfig) UnmarshalJSONFFLexer

func (j *EnvoyFilterConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type EnvoyHTTPVirtualHost

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

func (*EnvoyHTTPVirtualHost) MarshalJSON

func (j *EnvoyHTTPVirtualHost) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyHTTPVirtualHost) MarshalJSONBuf

func (j *EnvoyHTTPVirtualHost) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyHTTPVirtualHost) UnmarshalJSON

func (j *EnvoyHTTPVirtualHost) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyHTTPVirtualHost) UnmarshalJSONFFLexer

func (j *EnvoyHTTPVirtualHost) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

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

func (*EnvoyListener) MarshalJSON

func (j *EnvoyListener) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyListener) MarshalJSONBuf

func (j *EnvoyListener) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyListener) UnmarshalJSON

func (j *EnvoyListener) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyListener) UnmarshalJSONFFLexer

func (j *EnvoyListener) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type EnvoyRoute

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

func (*EnvoyRoute) MarshalJSON

func (j *EnvoyRoute) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyRoute) MarshalJSONBuf

func (j *EnvoyRoute) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyRoute) UnmarshalJSON

func (j *EnvoyRoute) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyRoute) UnmarshalJSONFFLexer

func (j *EnvoyRoute) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type EnvoyRouteConfig

type EnvoyRouteConfig struct {
	VirtualHosts []*EnvoyHTTPVirtualHost `json:"virtual_hosts,omitempty"` // Used for HTTP
	Routes       []*EnvoyTCPRoute        `json:"routes,omitempty"`        // Use for TCP
}

func (*EnvoyRouteConfig) MarshalJSON

func (j *EnvoyRouteConfig) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyRouteConfig) MarshalJSONBuf

func (j *EnvoyRouteConfig) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyRouteConfig) UnmarshalJSON

func (j *EnvoyRouteConfig) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyRouteConfig) UnmarshalJSONFFLexer

func (j *EnvoyRouteConfig) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

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

func (*EnvoyService) MarshalJSON

func (j *EnvoyService) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyService) MarshalJSONBuf

func (j *EnvoyService) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyService) UnmarshalJSON

func (j *EnvoyService) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyService) UnmarshalJSONFFLexer

func (j *EnvoyService) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type EnvoyTCPRoute

type EnvoyTCPRoute struct {
	Cluster           string   `json:"cluster"`
	DestinationIPList []string `json:"destination_ip_list,omitempty"`
	DestinationPorts  string   `json:"destination_ports,omitempty"`
	SourceIPList      []string `json:"source_ip_list,omitempty"`
	SourcePorts       []string `json:"source_ports,omitempty"`
}

func (*EnvoyTCPRoute) MarshalJSON

func (j *EnvoyTCPRoute) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*EnvoyTCPRoute) MarshalJSONBuf

func (j *EnvoyTCPRoute) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*EnvoyTCPRoute) UnmarshalJSON

func (j *EnvoyTCPRoute) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*EnvoyTCPRoute) UnmarshalJSONFFLexer

func (j *EnvoyTCPRoute) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

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 LDSResult

type LDSResult struct {
	Listeners []*EnvoyListener `json:"listeners"`
}

func (*LDSResult) MarshalJSON

func (j *LDSResult) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*LDSResult) MarshalJSONBuf

func (j *LDSResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*LDSResult) UnmarshalJSON

func (j *LDSResult) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*LDSResult) UnmarshalJSONFFLexer

func (j *LDSResult) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type Member

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

type SDSResult

type SDSResult struct {
	Env     string          `json:"env"`
	Hosts   []*EnvoyService `json:"hosts"`
	Service string          `json:"service"`
}

func (*SDSResult) MarshalJSON

func (j *SDSResult) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*SDSResult) MarshalJSONBuf

func (j *SDSResult) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*SDSResult) UnmarshalJSON

func (j *SDSResult) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*SDSResult) UnmarshalJSONFFLexer

func (j *SDSResult) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

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