envoy

package
v0.0.0-...-830b495 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: BSD-3-Clause, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package envoy contains a configuration writer for v2 YAML config. To avoid a dependncy on a YAML library, we generate the YAML using the text/template package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cluster

func Cluster(service *dag.Service) *v2.Cluster

Cluster creates new v2.Cluster from service.

func Clustername

func Clustername(service *dag.Service) string

Clustername returns the name of the CDS cluster for this service.

func ConfigSource

func ConfigSource(cluster string) *core.ConfigSource

ConfigSource returns a *core.ConfigSource for cluster.

func Hashname

func Hashname(l int, s ...string) string

Hashname takes a lenth l and a varargs of strings s and returns a string whose length which does not exceed l. Internally s is joined with strings.Join(s, "/"). If the combined length exceeds l then hashname truncates each element in s, starting from the end using a hash derived from the contents of s (not the current element). This process continues until the length of s does not exceed l, or all elements have been truncated. In which case, the entire string is replaced with a hash not exceeding the length of l.

func RouteCluster

func RouteCluster(service *dag.Service) route.Route_Route

RouteCluster returns a route.Route_Route for a single service.

func RouteRoute

func RouteRoute(services []*dag.Service) route.Route_Route

RouteRoute returns a route.Route_Route for the services supplied. If len(services) is greater than one, the route's action will be a weighted cluster.

func TLSInspector

func TLSInspector() listener.ListenerFilter

TLSInspector returns a new TLS inspector listener filter.

func UpstreamTLSContext

func UpstreamTLSContext() *auth.UpstreamTlsContext

UpstreamTLSContext creates an ALPN h2 enabled TLS Context.

func WeightedClusters

func WeightedClusters(services []*dag.Service) *route.WeightedCluster

WeightedClusters returns a route.WeightedCluster for multiple services.

Types

type ConfigWriter

type ConfigWriter struct {
	// AdminAccessLogPath is the path to write the access log for the administration server.
	// Defaults to /dev/null.
	AdminAccessLogPath string

	// AdminAddress is the TCP address that the administration server will listen on.
	// Defaults to 127.0.0.1.
	AdminAddress string

	// AdminPort is the port that the administration server will listen on.
	// Defaults to 9001.
	AdminPort int

	// StatsAddress is the address that the /stats path will listen on.
	// Defaults to 0.0.0.0 and is only enabled if StatsdEnabled is true.
	StatsAddress string

	// StatsPort is the port that the /stats path will listen on.
	// Defaults to 8002 and is only enabled if StatsdEnabled is true.
	StatsPort int

	// XDSAddress is the TCP address of the XDS management server. For JSON configurations
	// this is the address of the v1 REST API server. For YAML configurations this is the
	// address of the v2 gRPC management server.
	// Defaults to 127.0.0.1.
	XDSAddress string

	// XDSRESTPort is the management server port that provides the v1 REST API.
	// Defaults to 8000.
	XDSRESTPort int

	// XDSGRPCPort is the management server port that provides the v2 gRPC API.
	// Defaults to 8001.
	XDSGRPCPort int

	// StatsdEnabled enables metrics output via statsd
	// Defaults to false.
	StatsdEnabled bool

	// StatsdAddress is the UDP address of the statsd endpoint
	// Defaults to 127.0.0.1.
	StatsdAddress string

	// StatsdPort is port of the statsd endpoint
	// Defaults to 9125.
	StatsdPort int
}

A ConfigWriter knows how to write a bootstap Envoy configuration in YAML format.

func (*ConfigWriter) WriteYAML

func (c *ConfigWriter) WriteYAML(w io.Writer) error

WriteYAML writes the configuration to the supplied writer in YAML v2 format. If the supplied io.Writer is a file, it should end with a .yaml extension.

Jump to

Keyboard shortcuts

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