Documentation
¶
Index ¶
- Constants
- Variables
- func BuildResourceSet(b ResourceBuilder) (*xds.ResourceSet, error)
- func ExtractGatewayListeners(proxy *core_xds.Proxy) map[uint32]GatewayListenerInfo
- func GenerateEnvoyRouteEntries(host GatewayHost) []route.Entry
- func GenerateRTDS(limits []RuntimeResoureLimitListener) *core_xds.Resource
- func GenerateRouteConfig(proxy *xds.Proxy, protocol mesh_proto.MeshGateway_Listener_Protocol, ...) *envoy_routes.RouteConfigurationBuilder
- func GenerateVirtualHost(ctx xds_context.Context, info GatewayListenerInfo, hostname string, ...) (*envoy_virtual_hosts.VirtualHostBuilder, error)
- func HandlePrefixMatchesAndPopulatePolicies(host GatewayHost, exactEntries, prefixEntries map[string][]route.Entry, ...) []route.Entry
- func MakeGatewayListener(meshContext *xds_context.MeshContext, gateway *core_mesh.MeshGatewayResource, ...) (GatewayListener, []GatewayListenerHostname)
- func NewPlugin() core_plugins.Plugin
- func NewProxyProfile(zone string) generator_core.ResourceGenerator
- func NewResource(name string, resource proto.Message) *xds.Resource
- func NewServerSecret(data []byte) (*envoy_extensions_transport_sockets_tls_v3.Secret, keyType, error)
- func PopulatePolicies(host GatewayHost, routes []route.Entry) []route.Entry
- func RouteDestinationsMutable(entries []route.Entry) []*route.Destination
- func SetGatewayListeners(proxy *core_xds.Proxy, listenerInfoPerPort map[uint32]GatewayListenerInfo)
- type ClusterGenerator
- type FilterChainGenerator
- type FilterChainGenerators
- type GatewayHost
- type GatewayHostInfo
- type GatewayListener
- type GatewayListenerHostname
- type GatewayListenerInfo
- type Generator
- type HTTPFilterChainGenerator
- type HTTPSFilterChainGenerator
- type ResourceBuilder
- type RuntimeResoureLimitListener
- type TCPFilterChainGenerator
- type TemplateResolver
Constants ¶
const ( DefaultInitialStreamWindowSize = 64 * 1024 DefaultInitialConnectionWindowSize = 1024 * 1024 )
Window size defaults.
const DefaultConcurrentStreams = 100
Concurrency defaults.
const DefaultConnectionBuffer = 32 * 1024
Buffer defaults.
Variables ¶
var ConnectionPolicyTypes = []model.ResourceType{ core_mesh.CircuitBreakerType, core_mesh.FaultInjectionType, core_mesh.HealthCheckType, core_mesh.RateLimitType, core_mesh.RetryType, core_mesh.TimeoutType, }
ConnectionPolicyTypes specifies the resource types the gateway will bind for connection policies.
var DefaultProxyTemplate = &mesh_proto.ProxyTemplate{ Conf: &mesh_proto.ProxyTemplate_Conf{ Imports: []string{ metadata.ProfileGatewayProxy, }, }, }
DefaultProxyTemplate captures the gateway proxy profile as a ProxyTemplate resource.
var RoutePolicyTypes = []model.ResourceType{ core_mesh.MeshGatewayRouteType, }
RoutePolicyTypes specifies the resource types the gateway will bind for routes.
Functions ¶
func BuildResourceSet ¶
func BuildResourceSet(b ResourceBuilder) (*xds.ResourceSet, error)
BuildResourceSet is an adaptor that triggers the resource builder, b, to build its resource. If the builder is successful, the result is wrapped in a ResourceSet.
func ExtractGatewayListeners ¶
func ExtractGatewayListeners(proxy *core_xds.Proxy) map[uint32]GatewayListenerInfo
func GenerateEnvoyRouteEntries ¶
func GenerateEnvoyRouteEntries(host GatewayHost) []route.Entry
func GenerateRTDS ¶
func GenerateRTDS(limits []RuntimeResoureLimitListener) *core_xds.Resource
func GenerateRouteConfig ¶
func GenerateRouteConfig(proxy *xds.Proxy, protocol mesh_proto.MeshGateway_Listener_Protocol, name string) *envoy_routes.RouteConfigurationBuilder
func GenerateVirtualHost ¶
func GenerateVirtualHost( ctx xds_context.Context, info GatewayListenerInfo, hostname string, routes []route.Entry, ) ( *envoy_virtual_hosts.VirtualHostBuilder, error, )
GenerateVirtualHost generates xDS resources for the current route table.
func MakeGatewayListener ¶
func MakeGatewayListener( meshContext *xds_context.MeshContext, gateway *core_mesh.MeshGatewayResource, listeners []*mesh_proto.MeshGateway_Listener, ) (GatewayListener, []GatewayListenerHostname)
MakeGatewayListener converts a collapsed set of listener configurations in to a single configuration with a matched set of route resources. The given listeners must have a consistent protocol and port. Listeners must be validated for collapsibility in terms of hostnames and protocols.
func NewPlugin ¶
func NewPlugin() core_plugins.Plugin
func NewProxyProfile ¶
func NewProxyProfile(zone string) generator_core.ResourceGenerator
NewProxyProfile returns a new resource generator profile for builtin gateway dataplanes.
func NewServerSecret ¶
func NewServerSecret(data []byte) (*envoy_extensions_transport_sockets_tls_v3.Secret, keyType, error)
NewServerSecret parses a blob that contains one or more PEM object to create a single Envoy TLS certificate secret. The resulting secret must have exactly one private key, and at least one certificate.
func PopulatePolicies ¶
func PopulatePolicies(host GatewayHost, routes []route.Entry) []route.Entry
func RouteDestinationsMutable ¶
func RouteDestinationsMutable(entries []route.Entry) []*route.Destination
func SetGatewayListeners ¶
func SetGatewayListeners(proxy *core_xds.Proxy, listenerInfoPerPort map[uint32]GatewayListenerInfo)
SetGatewayListeners assumes that exactly one plugin has authority over a single port.
Types ¶
type ClusterGenerator ¶
type ClusterGenerator struct {
Zone string
}
ClusterGenerator generates Envoy clusters and their corresponding load assignments for both mesh services and external services.
func (*ClusterGenerator) GenerateClusters ¶
func (c *ClusterGenerator) GenerateClusters(ctx context.Context, xdsCtx xds_context.Context, info GatewayListenerInfo, hostEntries []route.Entry, hostTags map[string]string) (*core_xds.ResourceSet, error)
GenerateHost generates clusters for all the services targeted in the current route table.
type FilterChainGenerator ¶
type FilterChainGenerator interface {
Generate(xds_context.Context, GatewayListenerInfo) (*core_xds.ResourceSet, []*envoy_listeners.FilterChainBuilder, error)
}
FilterChainGenerator is responsible for handling the filter chain for a specific protocol. A FilterChainGenerator can be host-specific or shared amongst hosts.
type FilterChainGenerators ¶
type FilterChainGenerators struct {
FilterChainGenerators map[mesh_proto.MeshGateway_Listener_Protocol]FilterChainGenerator
}
func (*FilterChainGenerators) For ¶
func (g *FilterChainGenerators) For(ctx xds_context.Context, info GatewayListenerInfo) FilterChainGenerator
type GatewayHost ¶
type GatewayHost struct {
Hostname string
Routes []*core_mesh.MeshGatewayRouteResource
Policies map[model.ResourceType][]match.RankedPolicy
// Contains MeshGateway, Listener and Dataplane object tags
Tags mesh_proto.TagSelector
}
func RedistributeWildcardRoutes ¶
func RedistributeWildcardRoutes( hosts []GatewayHost, ) []GatewayHost
RedistributeWildcardRoutes takes the routes from the wildcard host and redistributes them to hosts with matching names, creating new hosts if necessary.
This process is necessary because:
- We might have a listener with hostname A and some routes, but also a wildcard listener with routes for hostname A. We want all the routes for hostname A in the same virtual host.
- Routes with hostnames that are attached to a wildcard listener should implicitly create virtual hosts so that we can generate a consistent config. For example, if a wildcard listener has a route for hostname A and a route for hostname B, that doesn't mean that the routes are for hostnames A or B. We still want the routes to match the hostname that they were specified with.
type GatewayHostInfo ¶
type GatewayHostInfo struct {
Host GatewayHost
// contains filtered or unexported fields
}
func (*GatewayHostInfo) AppendEntries ¶
func (i *GatewayHostInfo) AppendEntries(entries []route.Entry)
func (GatewayHostInfo) Entries ¶
func (i GatewayHostInfo) Entries() []route.Entry
type GatewayListener ¶
type GatewayListener struct {
Port uint32
Protocol mesh_proto.MeshGateway_Listener_Protocol
EnvoyListenerName string
// CrossMesh is important because for generation we need to treat such a
// listener as if we have HTTPS with the Mesh cert for this Dataplane
CrossMesh bool
Resources *mesh_proto.MeshGateway_Listener_Resources // TODO verify these don't conflict when merging
}
type GatewayListenerHostname ¶
type GatewayListenerHostname struct {
Hostname string
Protocol mesh_proto.MeshGateway_Listener_Protocol
TLS *mesh_proto.MeshGateway_TLS_Conf
HostInfos []GatewayHostInfo
}
func (GatewayListenerHostname) EnvoyRouteName ¶
func (h GatewayListenerHostname) EnvoyRouteName(envoyListenerName string) string
type GatewayListenerInfo ¶
type GatewayListenerInfo struct {
Proxy *core_xds.Proxy
Gateway *core_mesh.MeshGatewayResource
ExternalServices *core_mesh.ExternalServiceResourceList
OutboundEndpoints core_xds.EndpointMap
Listener GatewayListener
ListenerHostnames []GatewayListenerHostname
}
GatewayListenerInfo holds everything needed to generate resources for a listener.
type Generator ¶
type Generator struct {
FilterChainGenerators FilterChainGenerators
ClusterGenerator ClusterGenerator
Zone string
}
Generator generates xDS resources for an entire Gateway.
func NewGenerator ¶
func (Generator) Generate ¶
func (g Generator) Generate(ctx context.Context, _ *core_xds.ResourceSet, xdsCtx xds_context.Context, proxy *core_xds.Proxy) (*core_xds.ResourceSet, error)
type HTTPFilterChainGenerator ¶
type HTTPFilterChainGenerator struct{}
HTTPFilterChainGenerator generates a filter chain for a HTTP listener.
func (*HTTPFilterChainGenerator) Generate ¶
func (g *HTTPFilterChainGenerator) Generate( ctx xds_context.Context, info GatewayListenerInfo, ) ( *core_xds.ResourceSet, []*envoy_listeners.FilterChainBuilder, error, )
type HTTPSFilterChainGenerator ¶
type HTTPSFilterChainGenerator struct{}
HTTPSFilterChainGenerator generates a filter chain for an HTTPS listener.
func (*HTTPSFilterChainGenerator) Generate ¶
func (g *HTTPSFilterChainGenerator) Generate( ctx xds_context.Context, info GatewayListenerInfo, ) ( *core_xds.ResourceSet, []*envoy_listeners.FilterChainBuilder, error, )
type ResourceBuilder ¶
type ResourceBuilder interface {
Build() (envoy.NamedResource, error)
}
ResourceBuilder is an interface commonly implemented by complex Envoy configuration element builders.
type RuntimeResoureLimitListener ¶
func GenerateListener ¶
func GenerateListener(info GatewayListenerInfo) (*envoy_listeners.ListenerBuilder, *RuntimeResoureLimitListener)
type TCPFilterChainGenerator ¶
type TCPFilterChainGenerator struct{}
TCPFilterChainGenerator generates a filter chain for a TCP or TLS listener.
func (*TCPFilterChainGenerator) Generate ¶
func (g *TCPFilterChainGenerator) Generate( ctx xds_context.Context, info GatewayListenerInfo, ) ( *core_xds.ResourceSet, []*envoy_listeners.FilterChainBuilder, error, )
type TemplateResolver ¶
type TemplateResolver struct{}
TemplateResolver resolved the default proxy template profile for builtin gateway dataplanes.
func (TemplateResolver) GetTemplate ¶
func (r TemplateResolver) GetTemplate(proxy *core_xds.Proxy) *mesh_proto.ProxyTemplate