Documentation ¶
Index ¶
- Constants
- Variables
- func BuildResourceSet(b ResourceBuilder) (*xds.ResourceSet, error)
- func MakeGatewayListener(meshContext xds_context.MeshContext, gateway *core_mesh.MeshGatewayResource, ...) (GatewayListener, []GatewayHost, error)
- func NewProxyProfile(zone string, dataSourceLoader datasource.Loader) generator.ResourceGenerator
- func NewResource(name string, resource proto.Message) *xds.Resource
- type ClusterGenerator
- type ConnectionPolicyGenerator
- type GatewayHost
- type GatewayHostGenerator
- type GatewayListener
- type GatewayListenerInfo
- type GatewayRouteGenerator
- type Generator
- type HTTPFilterChainGenerator
- type HTTPSFilterChainGenerator
- type ListenerGenerator
- type ResourceAggregator
- type ResourceBuilder
- type Resources
- type RouteConfigurationGenerator
- type RouteTableGenerator
- type TemplateResolver
Constants ¶
const DefaultConcurrentStreams = 100
Concurrency defaults.
const DefaultConnectionBuffer = 32 * 1024
Buffer defaults.
const DefaultIdleTimeout = 5 * time.Minute
const DefaultInitialConnectionWindowSize = 1024 * 1024
const DefaultInitialStreamWindowSize = 64 * 1024
Window size defaults.
const DefaultRequestHeadersTimeout = 500 * time.Millisecond
Timeout defaults.
const DefaultStreamIdleTimeout = 5 * time.Second
const OriginGateway = "gateway"
OriginGateway marks xDS resources generated by this plugin.
const PluginName core_plugins.PluginName = "gateway"
const ProfileGatewayProxy = "gateway-proxy"
ProfileGatewayProxy is the name of the gateway proxy template profile.
const WildcardHostname = "*"
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{ 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 MakeGatewayListener ¶
func MakeGatewayListener( meshContext xds_context.MeshContext, gateway *core_mesh.MeshGatewayResource, listeners []*mesh_proto.MeshGateway_Listener, ) (GatewayListener, []GatewayHost, error)
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.
func NewProxyProfile ¶
func NewProxyProfile(zone string, dataSourceLoader datasource.Loader) generator.ResourceGenerator
NewProxyProfile returns a new resource generator profile for builtin gateway dataplanes.
Types ¶
type ClusterGenerator ¶
type ClusterGenerator struct { DataSourceLoader datasource.Loader Zone string }
ClusterGenerator generates Envoy clusters and their corresponding load assignments for both mesh services and external services.
func (*ClusterGenerator) GenerateHost ¶
func (c *ClusterGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, host gatewayHostInfo) (*core_xds.ResourceSet, error)
GenerateHost generates clusters for all the services targeted in the current route table.
func (*ClusterGenerator) SupportsProtocol ¶
func (*ClusterGenerator) SupportsProtocol(mesh_proto.MeshGateway_Listener_Protocol) bool
SupportsProtocol is always true for generating clusters.
type ConnectionPolicyGenerator ¶
type ConnectionPolicyGenerator struct { }
ConnectionPolicyGenerator matches connection policies for each route table entry that forwards traffic.
func (*ConnectionPolicyGenerator) GenerateHost ¶
func (g *ConnectionPolicyGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, host gatewayHostInfo) (*core_xds.ResourceSet, error)
func (*ConnectionPolicyGenerator) SupportsProtocol ¶
func (*ConnectionPolicyGenerator) SupportsProtocol(p mesh_proto.MeshGateway_Listener_Protocol) bool
type GatewayHost ¶
type GatewayHost struct { Hostname string Routes []model.Resource Policies map[model.ResourceType][]match.RankedPolicy TLS *mesh_proto.MeshGateway_TLS_Conf }
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 GatewayHostGenerator ¶
type GatewayHostGenerator interface { GenerateHost(xds_context.Context, *GatewayListenerInfo, gatewayHostInfo) (*core_xds.ResourceSet, error) SupportsProtocol(mesh_proto.MeshGateway_Listener_Protocol) bool }
GatewayHostGenerator is responsible for generating xDS resources for a single GatewayHost.
type GatewayListener ¶
type GatewayListener struct { Port uint32 Protocol mesh_proto.MeshGateway_Listener_Protocol ResourceName string }
type GatewayListenerInfo ¶
type GatewayListenerInfo struct { Proxy *core_xds.Proxy Dataplane *core_mesh.DataplaneResource Gateway *core_mesh.MeshGatewayResource ExternalServices *core_mesh.ExternalServiceResourceList Listener GatewayListener Resources Resources }
GatewayListenerInfo holds everything needed to generate resources for a listener.
type GatewayRouteGenerator ¶
type GatewayRouteGenerator struct { }
GatewayRouteGenerator generates Kuma gateway routes from GatewayRoute resources.
func (*GatewayRouteGenerator) GenerateHost ¶
func (g *GatewayRouteGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, host gatewayHostInfo) (*core_xds.ResourceSet, error)
func (*GatewayRouteGenerator) SupportsProtocol ¶
func (*GatewayRouteGenerator) SupportsProtocol(p mesh_proto.MeshGateway_Listener_Protocol) bool
type Generator ¶
type Generator struct {
Generators []GatewayHostGenerator
}
Generator generates xDS resources for an entire Gateway.
func (Generator) Generate ¶
func (g Generator) Generate(ctx 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) GenerateHost ¶
func (*HTTPFilterChainGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, host gatewayHostInfo) (*core_xds.ResourceSet, error)
func (*HTTPFilterChainGenerator) SupportsProtocol ¶
func (*HTTPFilterChainGenerator) SupportsProtocol(p mesh_proto.MeshGateway_Listener_Protocol) bool
type HTTPSFilterChainGenerator ¶
type HTTPSFilterChainGenerator struct {
DataSourceLoader datasource.Loader
}
HTTPSFilterChainGenerator generates a filter chain for an HTTPS listener.
func (*HTTPSFilterChainGenerator) GenerateHost ¶
func (g *HTTPSFilterChainGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, host gatewayHostInfo) (*core_xds.ResourceSet, error)
func (*HTTPSFilterChainGenerator) SupportsProtocol ¶
func (*HTTPSFilterChainGenerator) SupportsProtocol(p mesh_proto.MeshGateway_Listener_Protocol) bool
type ListenerGenerator ¶
type ListenerGenerator struct{}
ListenerGenerator generates Kuma gateway listeners.
func (*ListenerGenerator) GenerateHost ¶
func (*ListenerGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, _ gatewayHostInfo) (*core_xds.ResourceSet, error)
func (*ListenerGenerator) SupportsProtocol ¶
func (*ListenerGenerator) SupportsProtocol(p mesh_proto.MeshGateway_Listener_Protocol) bool
type ResourceAggregator ¶
type ResourceAggregator struct{ *xds.ResourceSet }
ResourceAggregator is a convenience wrapper over ResourceSet that simplifies code that accumulates resources from xDS generators.
func (*ResourceAggregator) Add ¶
func (r *ResourceAggregator) Add(resource *xds.Resource, err error) error
func (*ResourceAggregator) AddSet ¶
func (r *ResourceAggregator) AddSet(set *xds.ResourceSet, err error) error
func (*ResourceAggregator) Get ¶
func (r *ResourceAggregator) Get() *xds.ResourceSet
type ResourceBuilder ¶
type ResourceBuilder interface {
Build() (envoy.NamedResource, error)
}
ResourceBuilder is an interface commonly implemented by complex Envoy configuration element builders.
type Resources ¶
type Resources struct { Listener *envoy_listeners.ListenerBuilder FilterChain *envoy_listeners.FilterChainBuilder RouteConfiguration *envoy_routes.RouteConfigurationBuilder }
Resources tracks partially-built xDS resources that can be updated by multiple gateway generators.
type RouteConfigurationGenerator ¶
type RouteConfigurationGenerator struct{}
RouteConfigurationGenerator generates Kuma gateway listeners.
func (*RouteConfigurationGenerator) GenerateHost ¶
func (*RouteConfigurationGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, _ gatewayHostInfo) (*core_xds.ResourceSet, error)
func (*RouteConfigurationGenerator) SupportsProtocol ¶
func (*RouteConfigurationGenerator) SupportsProtocol(p mesh_proto.MeshGateway_Listener_Protocol) bool
type RouteTableGenerator ¶
type RouteTableGenerator struct{}
RouteTableGenerator generates Envoy xDS resources gateway routes from the current route table.
func (*RouteTableGenerator) GenerateHost ¶
func (r *RouteTableGenerator) GenerateHost(ctx xds_context.Context, info *GatewayListenerInfo, host gatewayHostInfo) (*core_xds.ResourceSet, error)
GenerateHost generates xDS resources for the current route table.
func (*RouteTableGenerator) SupportsProtocol ¶
func (*RouteTableGenerator) SupportsProtocol(mesh_proto.MeshGateway_Listener_Protocol) bool
SupportsProtocol is always true for RouteTableGenerator.
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