envoy

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package envoy contains APIs for translating between Contour objects and Envoy configuration APIs and types.

Index

Constants

View Source
const CACertificateKey = "ca.crt"

CACertificateKey stores the key for the TLS validation secret cert

Variables

View Source
var DefaultFields = []string{
	"@timestamp",
	"authority",
	"bytes_received",
	"bytes_sent",
	"downstream_local_address",
	"downstream_remote_address",
	"duration",
	"method",
	"path",
	"protocol",
	"request_id",
	"requested_server_name",
	"response_code",
	"response_flags",
	"uber_trace_id",
	"upstream_cluster",
	"upstream_host",
	"upstream_local_address",
	"upstream_service_time",
	"user_agent",
	"x_forwarded_for",
}

DefaultFields are fields that will be included by default when JSON logging is enabled.

View Source
var JSONFields = map[string]string{
	"@timestamp":                "%START_TIME%",
	"ts":                        "%START_TIME%",
	"authority":                 "%REQ(:AUTHORITY)%",
	"bytes_received":            "%BYTES_RECEIVED%",
	"bytes_sent":                "%BYTES_SENT%",
	"downstream_local_address":  "%DOWNSTREAM_LOCAL_ADDRESS%",
	"downstream_remote_address": "%DOWNSTREAM_REMOTE_ADDRESS%",
	"duration":                  "%DURATION%",
	"method":                    "%REQ(:METHOD)%",
	"path":                      "%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%",
	"protocol":                  "%PROTOCOL%",
	"request_id":                "%REQ(X-REQUEST-ID)%",
	"requested_server_name":     "%REQUESTED_SERVER_NAME%",
	"response_code":             "%RESPONSE_CODE%",
	"response_flags":            "%RESPONSE_FLAGS%",
	"uber_trace_id":             "%REQ(UBER-TRACE-ID)%",
	"upstream_cluster":          "%UPSTREAM_CLUSTER%",
	"upstream_host":             "%UPSTREAM_HOST%",
	"upstream_local_address":    "%UPSTREAM_LOCAL_ADDRESS%",
	"upstream_service_time":     "%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%",
	"user_agent":                "%REQ(USER-AGENT)%",
	"x_forwarded_for":           "%REQ(X-FORWARDED-FOR)%",
	"x_trace_id":                "%REQ(X-TRACE-ID)%",
}

JSONFields is the canonical translation table for JSON fields to Envoy log template formats, used for specifying fields for Envoy to log when JSON logging is enabled. Only fields specified in this map may be used for JSON logging.

Functions

func AppendHeader added in v1.0.0

func AppendHeader(key, value string) *envoy_api_v2_core.HeaderValueOption

func Bootstrap added in v0.10.0

func Bootstrap(c *BootstrapConfig) *bootstrap.Bootstrap

Bootstrap creates a new v2 Bootstrap configuration.

func Cluster

func Cluster(c *dag.Cluster) *v2.Cluster

Cluster creates new v2.Cluster from dag.Cluster.

func ClusterCommonLBConfig added in v0.8.0

func ClusterCommonLBConfig() *v2.Cluster_CommonLbConfig

ClusterCommonLBConfig creates a *v2.Cluster_CommonLbConfig with HealthyPanicThreshold disabled.

func ClusterDiscoveryType added in v1.0.0

func ClusterDiscoveryType(t v2.Cluster_DiscoveryType) *v2.Cluster_Type

ClusterDiscoveryType returns the type of a ClusterDiscovery as a Cluster_type.

func ClusterLoadAssignment added in v1.0.0

func ClusterLoadAssignment(name string, addrs ...*envoy_api_v2_core.Address) *v2.ClusterLoadAssignment

ClusterLoadAssignment returns a *v2.ClusterLoadAssignment with a single LocalityLbEndpoints of the supplied addresses.

func Clustername added in v0.7.0

func Clustername(cluster *dag.Cluster) string

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

func ConfigSource added in v0.7.0

func ConfigSource(cluster string) *envoy_api_v2_core.ConfigSource

ConfigSource returns a *envoy_api_v2_core.ConfigSource for cluster.

func DownstreamTLSContext added in v0.7.0

func DownstreamTLSContext(secretName string, tlsMinProtoVersion envoy_api_v2_auth.TlsParameters_TlsProtocol, alpnProtos ...string) *envoy_api_v2_auth.DownstreamTlsContext

DownstreamTLSContext creates a new DownstreamTlsContext.

func Endpoints added in v1.0.0

Endpoints returns a slice of LocalityLbEndpoints. The slice contains one entry, with one LbEndpoint per *envoy_api_v2_core.Address supplied.

func FileAccessLogEnvoy added in v1.0.0

func FileAccessLogEnvoy(path string) []*accesslog.AccessLog

FileAccessLogEnvoy returns a new file based access log filter that will output Envoy's default access logs.

func FileAccessLogJSON added in v1.0.0

func FileAccessLogJSON(path string, keys []string) []*accesslog.AccessLog

FileAccessLogJSON returns a new file based access log filter that will log in JSON format

func FilterChain added in v1.0.0

FilterChain retruns a *envoy_api_v2_listener.FilterChain for the supplied filters.

func FilterChainTLS added in v1.0.0

func FilterChainTLS(domain string, secret *dag.Secret, filters []*envoy_api_v2_listener.Filter, tlsMinProtoVersion envoy_api_v2_auth.TlsParameters_TlsProtocol, alpnProtos ...string) *envoy_api_v2_listener.FilterChain

FilterChainTLS returns a TLS enabled envoy_api_v2_listener.FilterChain,

func FilterChains added in v1.0.0

FilterChains returns a []*envoy_api_v2_listener.FilterChain for the supplied filters.

func Filters added in v1.0.0

Filters returns a []*envoy_api_v2_listener.Filter for the supplied filters.

func HTTPConnectionManager added in v0.7.0

func HTTPConnectionManager(routename string, accesslogger []*accesslog.AccessLog, requestTimeout time.Duration) *envoy_api_v2_listener.Filter

HTTPConnectionManager creates a new HTTP Connection Manager filter for the supplied route, access log, and client request timeout.

func LBEndpoint added in v0.7.0

LBEndpoint creates a new LbEndpoint.

func Listener

func Listener(name, address string, port int, lf []*envoy_api_v2_listener.ListenerFilter, filters ...*envoy_api_v2_listener.Filter) *v2.Listener

Listener returns a new v2.Listener for the supplied address, port, and filters.

func ListenerFilters added in v1.0.0

ListenerFilters returns a []*envoy_api_v2_listener.ListenerFilter for the supplied listener filters.

func ProxyProtocol added in v0.10.0

func ProxyProtocol() *envoy_api_v2_listener.ListenerFilter

ProxyProtocol returns a new Proxy Protocol listener filter.

func Route

Route returns a *envoy_api_v2_route.Route for the supplied match and action.

func RouteConfiguration added in v1.0.0

func RouteConfiguration(name string, virtualhosts ...*envoy_api_v2_route.VirtualHost) *v2.RouteConfiguration

RouteConfiguration returns a *v2.RouteConfiguration.

func RouteMatch added in v1.0.0

func RouteMatch(route *dag.Route) *envoy_api_v2_route.RouteMatch

RouteMatch creates a *envoy_api_v2_route.RouteMatch for the supplied *dag.Route.

func RoutePrefix added in v1.0.0

func RoutePrefix(prefix string, headers ...dag.HeaderCondition) *envoy_api_v2_route.RouteMatch

RoutePrefix returns a prefix matcher.

func RouteRegex added in v1.0.0

func RouteRegex(regex string) *envoy_api_v2_route.RouteMatch

RouteRegex returns a regex matcher.

func RouteRoute added in v0.7.0

func RouteRoute(r *dag.Route) *envoy_api_v2_route.Route_Route

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

func Routes added in v1.0.0

func Routes(routes ...*envoy_api_v2_route.Route) []*envoy_api_v2_route.Route

Routes returns a []*envoy_api_v2_route.Route for the supplied routes.

func Secret added in v1.0.0

func Secret(s *dag.Secret) *envoy_api_v2_auth.Secret

Secret creates new envoy_api_v2_auth.Secret from secret.

func Secretname added in v1.0.0

func Secretname(s *dag.Secret) string

Secretname returns the name of the SDS secret for this secret.

func SocketAddress added in v0.7.0

func SocketAddress(address string, port int) *envoy_api_v2_core.Address

SocketAddress creates a new TCP envoy_api_v2_core.Address.

func StaticClusterLoadAssignment added in v1.0.0

func StaticClusterLoadAssignment(service *dag.Service) *v2.ClusterLoadAssignment

StaticClusterLoadAssignment creates a *v2.ClusterLoadAssignment pointing to the external DNS address of the service

func StatsListener added in v1.0.0

func StatsListener(address string, port int) *v2.Listener

StatsListener returns a *v2.Listener configured to serve prometheus metrics on /stats.

func TCPProxy added in v0.8.0

func TCPProxy(statPrefix string, proxy *dag.TCPProxy, accesslogger []*accesslog.AccessLog) *envoy_api_v2_listener.Filter

TCPProxy creates a new TCPProxy filter.

func TLSInspector added in v0.7.0

func TLSInspector() *envoy_api_v2_listener.ListenerFilter

TLSInspector returns a new TLS inspector listener filter.

func UpgradeHTTPS added in v0.7.0

func UpgradeHTTPS() *envoy_api_v2_route.Route_Redirect

UpgradeHTTPS returns a route Action that redirects the request to HTTPS.

func UpstreamTLSContext added in v0.7.0

func UpstreamTLSContext(ca []byte, subjectName string, alpnProtocols ...string) *envoy_api_v2_auth.UpstreamTlsContext

UpstreamTLSContext creates an envoy_api_v2_auth.UpstreamTlsContext. By default UpstreamTLSContext returns a HTTP/1.1 TLS enabled context. A list of additional ALPN protocols can be provided.

func VirtualHost

func VirtualHost(hostname string, routes ...*envoy_api_v2_route.Route) *envoy_api_v2_route.VirtualHost

VirtualHost creates a new route.VirtualHost.

Types

type BootstrapConfig added in v0.10.0

type BootstrapConfig 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

	// XDSAddress is the TCP address of the gRPC XDS management server.
	// Defaults to 127.0.0.1.
	XDSAddress string

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

	// Namespace is the namespace where Contour is running
	Namespace string

	//GrpcCABundle is the filename that contains a CA certificate chain that can
	//verify the client cert.
	GrpcCABundle string

	// GrpcClientCert is the filename that contains a client certificate. May contain a full bundle if you
	// don't want to pass a CA Bundle.
	GrpcClientCert string

	// GrpcClientKey is the filename that contains a client key for secure gRPC with TLS.
	GrpcClientKey string
}

BootstrapConfig holds configuration values for a v2.Bootstrap.

Jump to

Keyboard shortcuts

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