Documentation
¶
Overview ¶
Package envoyconf generates the envoyconfiguration for listeners, virtual hosts, routes, clusters, and endpoints.
Index ¶
- Constants
- func CreateAPIDefinitionEndpoint(adapterInternalAPI *model.AdapterInternalAPI, vHost string, methods []string, ...) *routev3.Route
- func CreateAPIDefinitionRoute(basePath string, vHost string, methods []string, isDefaultversion bool, ...) *routev3.Route
- func CreateHealthEndpoint() *routev3.Route
- func CreateListenerByGateway(gateway *gwapiv1.Gateway, resolvedListenerCerts map[string]map[string][]byte, ...) []*listenerv3.Listener
- func CreateLuaCluster(interceptorCerts map[string][]byte, endpoint model.InterceptEndpoint) ([]*clusterv3.Cluster, []*corev3.Address, error)
- func CreateRateLimitCluster() (*clusterv3.Cluster, []*corev3.Address, error)
- func CreateReadyEndpoint() *routev3.Route
- func CreateRoutesConfigForRds(vHosts []*routev3.VirtualHost, httpListeners string) *routev3.RouteConfiguration
- func CreateRoutesWithClusters(adapterInternalAPI *model.AdapterInternalAPI, ...) (routesP []*routev3.Route, clustersP []*clusterv3.Cluster, ...)
- func CreateTracingCluster(conf *config.Config) ([]*clusterv3.Cluster, []*corev3.Address, error)
- func CreateVirtualHosts(vhostToRouteArrayMap map[string][]*routev3.Route, ...) []*routev3.VirtualHost
- func GetInlineLuaScript(requestInterceptor map[string]model.InterceptEndpoint, ...) string
- func ProcessEndpoints(clusterName string, clusterDetails *model.EndpointCluster, ...) ([]*clusterv3.Cluster, []*corev3.Address, error)
- type CombinedTemplateValues
- type WireLogValues
Constants ¶
const ( APILevelInterceptor string = "api" ResourceLevelInterceptor string = "resource" OperationLevelInterceptor string = "operation" )
interceptor levels
const ( // Azure tracer's name TracerTypeAzure = "azure" TracerTypeOtlp = "otlp" )
tracing configuration constants
const ( RateLimiterDomain = "Default" RateLimitPolicyOperationLevel string = "OPERATION" RateLimitPolicyAPILevel string = "API" )
Constants relevant to the ratelimit service
const ( DescriptorKeyForSubscription = "subscription" DescriptorKeyForPolicy = "policy" DescriptorKeyForOrganization = "organization" // DescriptorKeyForAIRequestTokenCount is the descriptor key for AI request token count ratelimit DescriptorKeyForAIRequestTokenCount = "airequesttokencount" // DescriptorKeyForAIResponseTokenCount is the descriptor key for AI response token count ratelimit DescriptorKeyForAIResponseTokenCount = "airesponsetokencount" // DescriptorKeyForAITotalTokenCount is the descriptor key for AI total token count ratelimit DescriptorKeyForAITotalTokenCount = "aitotaltokencount" // DescriptorKeyForAIRequestCount is the descriptor key for AI request count ratelimit DescriptorKeyForAIRequestCount = "airequestcount" // DescriptorKeyForAIRequestTokenCountForSubscriptionBasedAIRL is the descriptor key for AI request token count ratelimit DescriptorKeyForAIRequestTokenCountForSubscriptionBasedAIRL = "airequesttokencountsubs" // DescriptorKeyForAIResponseTokenCountForSubscriptionBasedAIRL is the descriptor key for AI response token count ratelimit DescriptorKeyForAIResponseTokenCountForSubscriptionBasedAIRL = "airesponsetokencountsubs" // DescriptorKeyForAITotalTokenCountForSubscriptionBasedAIRL is the descriptor key for AI total token count ratelimit DescriptorKeyForAITotalTokenCountForSubscriptionBasedAIRL = "aitotaltokencountsubs" // DescriptorKeyForAIRequestCountForSubscriptionBasedAIRL is the descriptor key for AI request count ratelimit DescriptorKeyForAIRequestCountForSubscriptionBasedAIRL = "airequestcountsubs" DynamicMetadataKeyForOrganizationAndAIRLPolicy = "ratelimit:organization-and-rlpolicy" DynamicMetadataKeyForSubscription = "ratelimit:subscription" DescriptorKeyForAISubscription = "subscription" )
Constants for Rate Limiting
const ( DescriptorKeyForOrg = "org" OrgMetadataKey = "customorg" DescriptorKeyForEnvironment = "environment" DescriptorKeyForPath = "path" DescriptorKeyForMethod = "method" DescriptorValueForAPIMethod = "ALL" DescriptorValueForOperationMethod = ":method" MetadataNamespaceForCustomPolicies = "apk.ratelimit.metadata" MetadataNamespaceForWSO2Policies = "envoy.filters.http.ext_proc" )
Constants relevant to the route related ratelimit configurations
const EnvoyJWT = "envoy.filters.http.jwt_authn"
EnvoyJWT is the jwt filter name
const HTTPExternalProcessor = "envoy.filters.http.ext_proc"
HTTPExternalProcessor HTTP filter
const LuaGlobal = "envoy.filters.http.lua.global"
LuaGlobal is the lua filter name for global lua filter
const LuaLocal = "envoy.filters.http.lua.local"
LuaLocal is the lua filter name for local lua filter
const RatelimitFilterName = "envoy.filters.http.ratelimit"
RatelimitFilterName Ratelimit filter name
Variables ¶
This section is empty.
Functions ¶
func CreateAPIDefinitionEndpoint ¶
func CreateAPIDefinitionEndpoint(adapterInternalAPI *model.AdapterInternalAPI, vHost string, methods []string, isDefaultversion bool, organizationID string) *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 ¶
CreateHealthEndpoint generates a route for the jwt /health endpoint Replies with direct response.
func CreateListenerByGateway ¶
func CreateListenerByGateway(gateway *gwapiv1.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 ¶
CreateRateLimitCluster creates cluster relevant to the rate limit service
func CreateReadyEndpoint ¶
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 ¶
CreateTracingCluster creates a cluster definition for router's tracing server.
func CreateVirtualHosts ¶
func CreateVirtualHosts(vhostToRouteArrayMap map[string][]*routev3.Route, customRateLimitPolicies []*model.CustomRateLimitPolicy, vhostToSubscriptionAIRL map[string]bool, vhostToSubscriptionRL map[string]bool) []*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
func ProcessEndpoints ¶
func ProcessEndpoints(clusterName string, clusterDetails *model.EndpointCluster, timeout time.Duration, basePath string) ([]*clusterv3.Cluster, []*corev3.Address, error)
ProcessEndpoints creates cluster configuration. AddressConfiguration, cluster name and urlType (http or https) is required to be provided. timeout cluster timeout
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