envoyconf

package
v0.0.0-...-1ed4819 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Overview

Package envoyconf generates the envoyconfiguration for listeners, virtual hosts, routes, clusters, and endpoints.

Index

Constants

View Source
const (
	APILevelInterceptor       string = "api"
	ResourceLevelInterceptor  string = "resource"
	OperationLevelInterceptor string = "operation"
)

interceptor levels

View Source
const (

	// Azure tracer's name
	TracerTypeAzure = "azure"
	TracerTypeOtlp  = "otlp"
)

tracing configuration constants

View Source
const (
	RateLimiterDomain                    = "Default"
	RateLimitPolicyOperationLevel string = "OPERATION"
	RateLimitPolicyAPILevel       string = "API"
)

Constants relevant to the ratelimit service

View Source
const (
	DescriptorKeyForOrg                = "org"
	OrgMetadataKey                     = "customorg"
	DescriptorKeyForEnvironment        = "environment"
	DescriptorKeyForPath               = "path"
	DescriptorKeyForMethod             = "method"
	DescriptorValueForAPIMethod        = "ALL"
	DescriptorValueForOperationMethod  = ":method"
	MetadataNamespaceForCustomPolicies = "apk.ratelimit.metadata"
	MetadataNamespaceForWSO2Policies   = "envoy.filters.http.ext_authz"
)

Constants relevant to the route related ratelimit configurations

View Source
const LuaGlobal = "envoy.filters.http.lua.global"

LuaGlobal is the lua filter name for global lua filter

View Source
const LuaLocal = "envoy.filters.http.lua.local"

LuaLocal is the lua filter name for local lua filter

Variables

This section is empty.

Functions

func CreateAPIDefinitionEndpoint

func CreateAPIDefinitionEndpoint(adapterInternalAPI *model.AdapterInternalAPI, vHost string, methods []string, isDefaultversion bool) *routev3.Route

CreateAPIDefinitionEndpoint generates a route for the api defition endpoint

func CreateAPIDefinitionRoute

func CreateAPIDefinitionRoute(basePath string, vHost string, methods []string, isDefaultversion bool, version string) *routev3.Route

CreateAPIDefinitionRoute generates a route for the jwt /testkey endpoint

func CreateHealthEndpoint

func CreateHealthEndpoint() *routev3.Route

CreateHealthEndpoint generates a route for the jwt /health endpoint Replies with direct response.

func CreateListenerByGateway

func CreateListenerByGateway(gateway *gwapiv1b1.Gateway, resolvedListenerCerts map[string]map[string][]byte, gwLuaScript string) []*listenerv3.Listener

CreateListenerByGateway create listeners by provided gateway object with the Route Configuration stated as RDS. (routes are not assigned directly to the listener.) RouteConfiguration name is assigned using its default value. Route Configuration would be resolved via ADS.

If SecuredListenerPort and ListenerPort both are mentioned, two listeners would be added. If neither of the two properies are assigned with non-zero values, adapter would panic.

HTTPConnectionManager with HTTP Filters, Accesslog configuration, TransportSocket Configuration is included within the implementation.

Listener Address, ListenerPort Value, SecuredListener Address, and SecuredListenerPort Values are fetched from the configuration accordingly.

The relevant private keys and certificates (for securedListener) are fetched from the filepath mentioned in the adapter configuration. These certificate, key values are added as inline records (base64 encoded).

func CreateLuaCluster

func CreateLuaCluster(interceptorCerts map[string][]byte, endpoint model.InterceptEndpoint) (*clusterv3.Cluster, []*corev3.Address, error)

CreateLuaCluster creates lua cluster configuration.

func CreateRateLimitCluster

func CreateRateLimitCluster() (*clusterv3.Cluster, []*corev3.Address, error)

CreateRateLimitCluster creates cluster relevant to the rate limit service

func CreateReadyEndpoint

func CreateReadyEndpoint() *routev3.Route

CreateReadyEndpoint generates a route for the router /ready endpoint Replies with direct response.

func CreateRoutesConfigForRds

func CreateRoutesConfigForRds(vHosts []*routev3.VirtualHost, httpListeners string) *routev3.RouteConfiguration

CreateRoutesConfigForRds generates the default RouteConfiguration. Only the provided virtual hosts will be assigned inside the configuration. This is used to provide the configuration for RDS.

func CreateRoutesWithClusters

func CreateRoutesWithClusters(adapterInternalAPI *model.AdapterInternalAPI, interceptorCerts map[string][]byte, vHost string, organizationID string) (routesP []*routev3.Route,
	clustersP []*clusterv3.Cluster, addressesP []*corev3.Address, err error)

CreateRoutesWithClusters creates envoy routes along with clusters and endpoint instances. This creates routes for all the swagger resources and link to clusters. Create clusters for endpoints. If a resource has resource level endpoint, it create another cluster and link it. If resources doesn't has resource level endpoints, those clusters are linked to the api level clusters.

func CreateTracingCluster

func CreateTracingCluster(conf *config.Config) (*clusterv3.Cluster, []*corev3.Address, error)

CreateTracingCluster creates a cluster definition for router's tracing server.

func CreateVirtualHosts

func CreateVirtualHosts(vhostToRouteArrayMap map[string][]*routev3.Route, customRateLimitPolicies []*model.CustomRateLimitPolicy) []*routev3.VirtualHost

CreateVirtualHosts creates VirtualHost configurations for envoy which serves request from the vHost domain. The routes array will be included as the routes for the created virtual host.

func GetInlineLuaScript

func GetInlineLuaScript(requestInterceptor map[string]model.InterceptEndpoint, responseInterceptor map[string]model.InterceptEndpoint,
	requestContext *interceptor.InvocationContext) string

GetInlineLuaScript creates the inline lua script

Types

type CombinedTemplateValues

type CombinedTemplateValues struct {
	WireLogValues
	interceptor.Interceptor
}

CombinedTemplateValues holds combined values for both WireLogValues properties and Interceptor properties in the same level

type WireLogValues

type WireLogValues struct {
	LogConfig *config.WireLogConfig
}

WireLogValues holds debug logging related template values

Jump to

Keyboard shortcuts

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