v3

package
v1.29.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENVOY_HTTP_LISTENER        = "ingress_http"
	ENVOY_HTTPS_LISTENER       = "ingress_https"
	ENVOY_FALLBACK_ROUTECONFIG = "ingress_fallbackcert"
	DEFAULT_HTTP_ACCESS_LOG    = "/dev/stdout"
	DEFAULT_HTTPS_ACCESS_LOG   = "/dev/stdout"
)

nolint:revive

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterCache

type ClusterCache struct {
	contour.Cond
	// contains filtered or unexported fields
}

ClusterCache manages the contents of the gRPC CDS cache.

func (*ClusterCache) Contents

func (c *ClusterCache) Contents() []proto.Message

Contents returns a copy of the cache's contents.

func (*ClusterCache) OnChange

func (c *ClusterCache) OnChange(root *dag.DAG)

func (*ClusterCache) Query

func (c *ClusterCache) Query(names []string) []proto.Message

func (*ClusterCache) TypeURL

func (*ClusterCache) TypeURL() string

func (*ClusterCache) Update

Update replaces the contents of the cache with the supplied map.

type ConfigurableRuntimeSettings added in v1.24.6

type ConfigurableRuntimeSettings struct {
	MaxRequestsPerIOCycle     *uint32
	MaxConnectionsPerListener *uint32
}

type CustomTag added in v1.25.0

type CustomTag struct {
	// TagName is the unique name of the custom tag.
	TagName string

	// Literal is a static custom tag value.
	Literal string

	// EnvironmentName indicates that the label value is obtained
	// from the environment variable.
	EnvironmentName string

	// RequestHeaderName indicates which request header
	// the label value is obtained from.
	RequestHeaderName string
}

type EndpointSliceCache added in v1.27.0

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

EndpointSliceCache is a cache of EndpointSlice and ServiceCluster objects.

func (*EndpointSliceCache) DeleteEndpointSlice added in v1.27.0

func (c *EndpointSliceCache) DeleteEndpointSlice(endpointSlice *discovery_v1.EndpointSlice) bool

DeleteEndpointSlice deletes endpointSlice from the cache. Any ServiceClusters that are backed by a Service that endpointSlice belongs to, become stale. Returns a boolean indicating whether any ServiceClusters use endpointSlice or not.

func (*EndpointSliceCache) Recalculate added in v1.27.0

Recalculate regenerates all the ClusterLoadAssignments from the cached EndpointSlices and stale ServiceClusters. A ClusterLoadAssignment will be generated for every stale ServerCluster, however, if there are no endpointSlices for the Services in the ServiceCluster, the ClusterLoadAssignment will be empty.

func (*EndpointSliceCache) RecalculateEndpoints added in v1.27.0

func (c *EndpointSliceCache) RecalculateEndpoints(port, healthPort core_v1.ServicePort, endpointSliceMap map[string]*discovery_v1.EndpointSlice) []*LoadBalancingEndpoint

RecalculateEndpoints generates a slice of LoadBalancingEndpoint resources by matching the given service port to the given discovery_v1.EndpointSlice. endpointSliceMap may be nil, in which case, the result is also nil.

func (*EndpointSliceCache) SetClusters added in v1.27.0

func (c *EndpointSliceCache) SetClusters(clusters []*dag.ServiceCluster) error

SetClusters replaces the cache of ServiceCluster resources. All the added clusters will be marked stale.

func (*EndpointSliceCache) UpdateEndpointSlice added in v1.27.0

func (c *EndpointSliceCache) UpdateEndpointSlice(endpointSlice *discovery_v1.EndpointSlice) bool

UpdateEndpointSlice adds endpointSlice to the cache, or replaces it if it is already cached. Any ServiceClusters that are backed by a Service that endpointSlice belongs become stale. Returns a boolean indicating whether any ServiceClusters use endpointSlice or not.

type EndpointSliceTranslator added in v1.27.0

type EndpointSliceTranslator struct {
	// Observer notifies when the endpointSlice cache has been updated.
	Observer contour.Observer

	contour.Cond
	logrus.FieldLogger
	// contains filtered or unexported fields
}

A EndpointsSliceTranslator translates Kubernetes EndpointSlice objects into Envoy ClusterLoadAssignment resources.

func NewEndpointSliceTranslator added in v1.27.0

func NewEndpointSliceTranslator(log logrus.FieldLogger) *EndpointSliceTranslator

NewEndpointSliceTranslator allocates a new endpointsSlice translator.

func (*EndpointSliceTranslator) Contents added in v1.27.0

func (e *EndpointSliceTranslator) Contents() []proto.Message

Contents returns a copy of the contents of the cache.

func (*EndpointSliceTranslator) Merge added in v1.27.0

Merge combines the given entries with the existing entries in the EndpointSliceTranslator. If the same key exists in both maps, an existing entry is replaced.

func (*EndpointSliceTranslator) OnAdd added in v1.27.0

func (e *EndpointSliceTranslator) OnAdd(obj any, _ bool)

func (*EndpointSliceTranslator) OnChange added in v1.27.0

func (e *EndpointSliceTranslator) OnChange(root *dag.DAG)

OnChange observes DAG rebuild events.

func (*EndpointSliceTranslator) OnDelete added in v1.27.0

func (e *EndpointSliceTranslator) OnDelete(obj any)

func (*EndpointSliceTranslator) OnUpdate added in v1.27.0

func (e *EndpointSliceTranslator) OnUpdate(oldObj, newObj any)

func (*EndpointSliceTranslator) Query added in v1.27.0

func (e *EndpointSliceTranslator) Query(names []string) []proto.Message

func (*EndpointSliceTranslator) SetObserver added in v1.27.0

func (e *EndpointSliceTranslator) SetObserver(observer contour.Observer)

func (*EndpointSliceTranslator) TypeURL added in v1.27.0

func (*EndpointSliceTranslator) TypeURL() string

type EndpointsCache

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

EndpointsCache is a cache of Endpoint and ServiceCluster objects.

func (*EndpointsCache) DeleteEndpoint

func (c *EndpointsCache) DeleteEndpoint(eps *core_v1.Endpoints) bool

DeleteEndpoint deletes eps from the cache. Any ServiceClusters that are backed by a Service that eps belongs become stale. Returns a boolean indicating whether any ServiceClusters use eps or not.

func (*EndpointsCache) Recalculate

Recalculate regenerates all the ClusterLoadAssignments from the cached Endpoints and stale ServiceClusters. A ClusterLoadAssignment will be generated for every stale ServerCluster, however, if there are no endpoints for the Services in the ServiceCluster, the ClusterLoadAssignment will be empty.

func (*EndpointsCache) SetClusters

func (c *EndpointsCache) SetClusters(clusters []*dag.ServiceCluster) error

SetClusters replaces the cache of ServiceCluster resources. All the added clusters will be marked stale.

func (*EndpointsCache) UpdateEndpoint

func (c *EndpointsCache) UpdateEndpoint(eps *core_v1.Endpoints) bool

UpdateEndpoint adds eps to the cache, or replaces it if it is already cached. Any ServiceClusters that are backed by a Service that eps belongs become stale. Returns a boolean indicating whether any ServiceClusters use eps or not.

type EndpointsTranslator

type EndpointsTranslator struct {
	// Observer notifies when the endpoints cache has been updated.
	Observer contour.Observer

	contour.Cond
	logrus.FieldLogger
	// contains filtered or unexported fields
}

A EndpointsTranslator translates Kubernetes Endpoints objects into Envoy ClusterLoadAssignment resources.

func NewEndpointsTranslator

func NewEndpointsTranslator(log logrus.FieldLogger) *EndpointsTranslator

NewEndpointsTranslator allocates a new endpoints translator.

func (*EndpointsTranslator) Contents

func (e *EndpointsTranslator) Contents() []proto.Message

Contents returns a copy of the contents of the cache.

func (*EndpointsTranslator) Merge

Merge combines the given entries with the existing entries in the EndpointsTranslator. If the same key exists in both maps, an existing entry is replaced.

func (*EndpointsTranslator) OnAdd

func (e *EndpointsTranslator) OnAdd(obj any, _ bool)

func (*EndpointsTranslator) OnChange

func (e *EndpointsTranslator) OnChange(root *dag.DAG)

OnChange observes DAG rebuild events.

func (*EndpointsTranslator) OnDelete

func (e *EndpointsTranslator) OnDelete(obj any)

func (*EndpointsTranslator) OnUpdate

func (e *EndpointsTranslator) OnUpdate(oldObj, newObj any)

func (*EndpointsTranslator) Query

func (e *EndpointsTranslator) Query(names []string) []proto.Message

func (*EndpointsTranslator) SetObserver added in v1.27.0

func (e *EndpointsTranslator) SetObserver(observer contour.Observer)

func (*EndpointsTranslator) TypeURL

func (*EndpointsTranslator) TypeURL() string

type ExtensionServiceConfig added in v1.26.0

type ExtensionServiceConfig struct {
	ExtensionService types.NamespacedName
	Timeout          timeout.Setting
	SNI              string
}

type GlobalExternalAuthConfig added in v1.25.0

type GlobalExternalAuthConfig struct {
	ExtensionServiceConfig
	FailOpen        bool
	Context         map[string]string
	WithRequestBody *dag.AuthorizationServerBufferSettings
}

type Listener added in v1.14.0

type Listener struct {
	Name    string
	Address string
	Port    int
}

type ListenerCache

type ListenerCache struct {
	Config ListenerConfig
	contour.Cond
	// contains filtered or unexported fields
}

ListenerCache manages the contents of the gRPC LDS cache.

func NewListenerCache

func NewListenerCache(
	listenerConfig ListenerConfig,
	metricsConfig contour_v1alpha1.MetricsConfig,
	healthConfig contour_v1alpha1.HealthConfig,
	adminPort int,
) *ListenerCache

NewListenerCache returns an instance of a ListenerCache

func (*ListenerCache) Contents

func (c *ListenerCache) Contents() []proto.Message

Contents returns a copy of the cache's contents.

func (*ListenerCache) OnChange

func (c *ListenerCache) OnChange(root *dag.DAG)

func (*ListenerCache) Query

func (c *ListenerCache) Query(names []string) []proto.Message

Query returns the proto.Messages in the ListenerCache that match a slice of strings

func (*ListenerCache) TypeURL

func (*ListenerCache) TypeURL() string

func (*ListenerCache) Update

Update replaces the contents of the cache with the supplied map.

type ListenerConfig

type ListenerConfig struct {
	// Envoy's HTTP (non TLS) access log path.
	// If not set, defaults to DEFAULT_HTTP_ACCESS_LOG.
	HTTPAccessLog string

	// Envoy's HTTPS (TLS) access log path.
	// If not set, defaults to DEFAULT_HTTPS_ACCESS_LOG.
	HTTPSAccessLog string

	// UseProxyProto configures all listeners to expect a PROXY
	// V1 or V2 preamble.
	// If not set, defaults to false.
	UseProxyProto bool

	// MinimumTLSVersion defines the minimum TLS protocol version the proxy should accept.
	MinimumTLSVersion string

	// MaximumTLSVersion defines the maximum TLS protocol version the proxy should accept.
	MaximumTLSVersion string

	// CipherSuites defines the ciphers Envoy TLS listeners will accept when
	// negotiating TLS 1.2.
	CipherSuites []string

	// DefaultHTTPVersions defines the default set of HTTP
	// versions the proxy should accept. If not specified, all
	// supported versions are accepted. This is applied to both
	// HTTP and HTTPS listeners but has practical effect only for
	// HTTPS, because we don't support h2c.
	DefaultHTTPVersions []envoy_v3.HTTPVersionType

	// AccessLogType defines if Envoy logs should be output as Envoy's default or JSON.
	// Valid values: 'envoy', 'json'
	// If not set, defaults to 'envoy'
	AccessLogType contour_v1alpha1.AccessLogType

	// AccessLogJSONFields sets the fields that should be shown in JSON logs.
	// Valid entries are the keys from internal/envoy/accesslog.go:jsonheaders
	// Defaults to a particular set of fields.
	AccessLogJSONFields contour_v1alpha1.AccessLogJSONFields

	// AccessLogFormatString sets the format string to be used for text based access logs.
	// Defaults to empty to defer to Envoy's default log format.
	AccessLogFormatString string

	// AccessLogFormatterExtensions defines the Envoy extensions to enable for access log.
	AccessLogFormatterExtensions []string

	// AccessLogLevel defines the logging level for access log.
	AccessLogLevel contour_v1alpha1.AccessLogLevel

	// Timeouts holds Listener timeout settings.
	Timeouts contourconfig.Timeouts

	// AllowChunkedLength enables setting allow_chunked_length on the HTTP1 options for all
	// listeners.
	AllowChunkedLength bool

	// MergeSlashes toggles Envoy's non-standard merge_slashes path transformation option for all listeners.
	MergeSlashes bool

	// ServerHeaderTransformation defines the action to be applied to the Server header on the response path.
	ServerHeaderTransformation contour_v1alpha1.ServerHeaderTransformationType

	// XffNumTrustedHops sets the number of additional ingress proxy hops from the
	// right side of the x-forwarded-for HTTP header to trust.
	XffNumTrustedHops uint32

	// ConnectionBalancer
	// The validated value is 'exact'.
	// If no configuration is specified, Envoy will not attempt to balance active connections between worker threads
	// If specified, the listener will use the exact connection balancer.
	ConnectionBalancer string

	// MaxRequestsPerConnection defines the max number of requests per connection before which the connection is closed.
	// if not specified there is no limit set.
	MaxRequestsPerConnection *uint32

	HTTP2MaxConcurrentStreams *uint32

	// PerConnectionBufferLimitBytes defines the soft limit on size of the listener’s new connection read and write buffers
	// If unspecified, an implementation defined default is applied (1MiB).
	PerConnectionBufferLimitBytes *uint32

	// RateLimitConfig optionally configures the global Rate Limit Service to be
	// used.
	RateLimitConfig *RateLimitConfig

	// GlobalExternalAuthConfig optionally configures the global external authorization Service to be
	// used.
	GlobalExternalAuthConfig *GlobalExternalAuthConfig

	// TracingConfig optionally configures the tracing collector Service to be
	// used.
	TracingConfig *TracingConfig

	// SocketOptions configures socket options HTTP and HTTPS listeners.
	SocketOptions *contour_v1alpha1.SocketOptions
}

ListenerConfig holds configuration parameters for building Envoy Listeners.

type LoadBalancingEndpoint

type LoadBalancingEndpoint = envoy_config_endpoint_v3.LbEndpoint

func RecalculateEndpoints

func RecalculateEndpoints(port, healthPort core_v1.ServicePort, eps *core_v1.Endpoints) []*LoadBalancingEndpoint

RecalculateEndpoints generates a slice of LoadBalancingEndpoint resources by matching the given service port to the given core_v1.Endpoints. eps may be nil, in which case, the result is also nil.

type RateLimitConfig added in v1.13.0

type RateLimitConfig struct {
	ExtensionServiceConfig
	Domain                      string
	FailOpen                    bool
	EnableXRateLimitHeaders     bool
	EnableResourceExhaustedCode bool
}

type RouteCache

type RouteCache struct {
	contour.Cond
	// contains filtered or unexported fields
}

RouteCache manages the contents of the gRPC RDS cache.

func (*RouteCache) Contents

func (c *RouteCache) Contents() []proto.Message

Contents returns a copy of the cache's contents.

func (*RouteCache) OnChange

func (c *RouteCache) OnChange(root *dag.DAG)

func (*RouteCache) Query

func (c *RouteCache) Query(names []string) []proto.Message

Query searches the RouteCache for the named RouteConfiguration entries.

func (*RouteCache) TypeURL

func (*RouteCache) TypeURL() string

TypeURL returns the string type of RouteCache Resource.

func (*RouteCache) Update

Update replaces the contents of the cache with the supplied map.

type RuntimeCache added in v1.21.0

type RuntimeCache struct {
	contour.Cond
	// contains filtered or unexported fields
}

RuntimeCache manages the contents of the gRPC RTDS cache.

func NewRuntimeCache added in v1.24.6

func NewRuntimeCache(runtimeSettings ConfigurableRuntimeSettings) *RuntimeCache

NewRuntimeCache builds a RuntimeCache with the provided runtime settings that will be set in the runtime layer configured by Contour.

func (*RuntimeCache) Contents added in v1.21.0

func (c *RuntimeCache) Contents() []proto.Message

Contents returns all Runtime layers (currently only the dynamic layer).

func (*RuntimeCache) OnChange added in v1.21.0

func (c *RuntimeCache) OnChange(root *dag.DAG)

func (*RuntimeCache) Query added in v1.21.0

func (c *RuntimeCache) Query(names []string) []proto.Message

Query returns only the "dynamic" layer if requested, otherwise empty.

func (*RuntimeCache) TypeURL added in v1.21.0

func (*RuntimeCache) TypeURL() string

func (*RuntimeCache) Update added in v1.28.0

func (c *RuntimeCache) Update(v map[string]*structpb.Value)

Update replaces the contents of the cache with the supplied map.

type SecretCache

type SecretCache struct {
	contour.Cond
	// contains filtered or unexported fields
}

SecretCache manages the contents of the gRPC SDS cache.

func NewSecretsCache added in v1.20.0

func NewSecretsCache(secrets []*envoy_transport_socket_tls_v3.Secret) *SecretCache

func (*SecretCache) Contents

func (c *SecretCache) Contents() []proto.Message

Contents returns a copy of the cache's contents.

func (*SecretCache) OnChange

func (c *SecretCache) OnChange(root *dag.DAG)

func (*SecretCache) Query

func (c *SecretCache) Query(names []string) []proto.Message

func (*SecretCache) TypeURL

func (*SecretCache) TypeURL() string

func (*SecretCache) Update

Update replaces the contents of the cache with the supplied map.

type SnapshotHandler added in v1.28.0

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

SnapshotHandler responds to DAG builds via the OnChange() event and Endpoint updates via the Refresh() event and generates and caches go-control-plane Snapshots.

func NewSnapshotHandler added in v1.28.0

func NewSnapshotHandler(resources []xdscache.ResourceCache, log logrus.FieldLogger) *SnapshotHandler

NewSnapshotHandler returns an instance of SnapshotHandler.

func (*SnapshotHandler) GetCache added in v1.29.0

func (s *SnapshotHandler) GetCache() envoy_cache_v3.Cache

GetCache returns the MuxCache, which multiplexes requests across underlying caches.

func (*SnapshotHandler) OnChange added in v1.28.0

func (s *SnapshotHandler) OnChange(*dag.DAG)

OnChange is called when the DAG is rebuilt and a new snapshot is needed. It creates and caches a new go-control-plane Snapshot based on the contents of the Contour xDS resource caches.

func (*SnapshotHandler) Refresh added in v1.28.0

func (s *SnapshotHandler) Refresh()

Refresh is called when the EndpointsTranslator updates values in its cache. It updates the EDS cache.

type TracingConfig added in v1.25.0

type TracingConfig struct {
	ExtensionServiceConfig

	ServiceName string

	OverallSampling float64

	MaxPathTagLength uint32

	CustomTags []*CustomTag
}

Jump to

Keyboard shortcuts

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