From 81d593aadc2e5d7435c5d5707b8e363527de0e8c Mon Sep 17 00:00:00 2001 From: AmaliMatharaarachchi Date: Wed, 25 Sep 2024 16:28:01 +0530 Subject: [PATCH] temp --- .../internal/oasparser/envoyconf/listener.go | 177 +++++++++--------- 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/adapter/internal/oasparser/envoyconf/listener.go b/adapter/internal/oasparser/envoyconf/listener.go index a7fba0c27..1bedea36f 100644 --- a/adapter/internal/oasparser/envoyconf/listener.go +++ b/adapter/internal/oasparser/envoyconf/listener.go @@ -99,7 +99,7 @@ func CreateListenerByGateway(gateway *gwapiv1.Gateway, resolvedListenerCerts map var filterChains []*listenerv3.FilterChain for _, listenerObj := range listeners { - if listenerObj.Name == "httpslistener" { + if listenerObj.Name == "gatewaylistener" { httpFilters = getHTTPFilters(gwLuaScript) } else { httpFilters = getHTTPFilters(` @@ -398,137 +398,136 @@ func CreateVirtualHosts(vhostToRouteArrayMap map[string][]*routev3.Route, custom return virtualHosts } - func generateSubscriptionBasedRatelimits() []*routev3.RateLimit { return []*routev3.RateLimit{&routev3.RateLimit{ - Actions: []*routev3.RateLimit_Action{ - { - ActionSpecifier: &routev3.RateLimit_Action_Metadata{ - Metadata: &routev3.RateLimit_Action_MetaData{ - DescriptorKey: DescriptorKeyForOrganization, - MetadataKey: &metadatav3.MetadataKey{ - Key: extAuthzFilterName, - Path: []*metadatav3.MetadataKey_PathSegment{ - { - Segment: &metadatav3.MetadataKey_PathSegment_Key{ - Key: descriptorMetadataKeyForOrganization, - }, + Actions: []*routev3.RateLimit_Action{ + { + ActionSpecifier: &routev3.RateLimit_Action_Metadata{ + Metadata: &routev3.RateLimit_Action_MetaData{ + DescriptorKey: DescriptorKeyForOrganization, + MetadataKey: &metadatav3.MetadataKey{ + Key: extAuthzFilterName, + Path: []*metadatav3.MetadataKey_PathSegment{ + { + Segment: &metadatav3.MetadataKey_PathSegment_Key{ + Key: descriptorMetadataKeyForOrganization, }, }, }, - Source: routev3.RateLimit_Action_MetaData_DYNAMIC, - SkipIfAbsent: true, }, + Source: routev3.RateLimit_Action_MetaData_DYNAMIC, + SkipIfAbsent: true, }, }, - { - ActionSpecifier: &routev3.RateLimit_Action_Metadata{ - Metadata: &routev3.RateLimit_Action_MetaData{ - DescriptorKey: DescriptorKeyForSubscription, - MetadataKey: &metadatav3.MetadataKey{ - Key: extAuthzFilterName, - Path: []*metadatav3.MetadataKey_PathSegment{ - { - Segment: &metadatav3.MetadataKey_PathSegment_Key{ - Key: descriptorMetadataKeyForSubscription, - }, + }, + { + ActionSpecifier: &routev3.RateLimit_Action_Metadata{ + Metadata: &routev3.RateLimit_Action_MetaData{ + DescriptorKey: DescriptorKeyForSubscription, + MetadataKey: &metadatav3.MetadataKey{ + Key: extAuthzFilterName, + Path: []*metadatav3.MetadataKey_PathSegment{ + { + Segment: &metadatav3.MetadataKey_PathSegment_Key{ + Key: descriptorMetadataKeyForSubscription, }, }, }, - Source: routev3.RateLimit_Action_MetaData_DYNAMIC, - SkipIfAbsent: true, }, + Source: routev3.RateLimit_Action_MetaData_DYNAMIC, + SkipIfAbsent: true, }, }, - { - ActionSpecifier: &routev3.RateLimit_Action_Metadata{ - Metadata: &routev3.RateLimit_Action_MetaData{ - DescriptorKey: DescriptorKeyForPolicy, - MetadataKey: &metadatav3.MetadataKey{ - Key: extAuthzFilterName, - Path: []*metadatav3.MetadataKey_PathSegment{ - { - Segment: &metadatav3.MetadataKey_PathSegment_Key{ - Key: descriptorMetadataKeyForUsagePolicy, - }, + }, + { + ActionSpecifier: &routev3.RateLimit_Action_Metadata{ + Metadata: &routev3.RateLimit_Action_MetaData{ + DescriptorKey: DescriptorKeyForPolicy, + MetadataKey: &metadatav3.MetadataKey{ + Key: extAuthzFilterName, + Path: []*metadatav3.MetadataKey_PathSegment{ + { + Segment: &metadatav3.MetadataKey_PathSegment_Key{ + Key: descriptorMetadataKeyForUsagePolicy, }, }, }, - Source: routev3.RateLimit_Action_MetaData_DYNAMIC, - SkipIfAbsent: true, }, + Source: routev3.RateLimit_Action_MetaData_DYNAMIC, + SkipIfAbsent: true, }, }, }, - }, &routev3.RateLimit{ - Actions: []*routev3.RateLimit_Action{ - { - ActionSpecifier: &routev3.RateLimit_Action_Metadata{ - Metadata: &routev3.RateLimit_Action_MetaData{ - DescriptorKey: DescriptorKeyForOrganization, - MetadataKey: &metadatav3.MetadataKey{ - Key: extAuthzFilterName, - Path: []*metadatav3.MetadataKey_PathSegment{ - { - Segment: &metadatav3.MetadataKey_PathSegment_Key{ - Key: descriptorMetadataKeyForOrganization, - }, + }, + }, &routev3.RateLimit{ + Actions: []*routev3.RateLimit_Action{ + { + ActionSpecifier: &routev3.RateLimit_Action_Metadata{ + Metadata: &routev3.RateLimit_Action_MetaData{ + DescriptorKey: DescriptorKeyForOrganization, + MetadataKey: &metadatav3.MetadataKey{ + Key: extAuthzFilterName, + Path: []*metadatav3.MetadataKey_PathSegment{ + { + Segment: &metadatav3.MetadataKey_PathSegment_Key{ + Key: descriptorMetadataKeyForOrganization, }, }, }, - Source: routev3.RateLimit_Action_MetaData_DYNAMIC, - SkipIfAbsent: true, }, + Source: routev3.RateLimit_Action_MetaData_DYNAMIC, + SkipIfAbsent: true, }, }, - { - ActionSpecifier: &routev3.RateLimit_Action_Metadata{ - Metadata: &routev3.RateLimit_Action_MetaData{ - DescriptorKey: DescriptorKeyForSubscription, - MetadataKey: &metadatav3.MetadataKey{ - Key: extAuthzFilterName, - Path: []*metadatav3.MetadataKey_PathSegment{ - { - Segment: &metadatav3.MetadataKey_PathSegment_Key{ - Key: descriptorMetadataKeyForSubscription, - }, + }, + { + ActionSpecifier: &routev3.RateLimit_Action_Metadata{ + Metadata: &routev3.RateLimit_Action_MetaData{ + DescriptorKey: DescriptorKeyForSubscription, + MetadataKey: &metadatav3.MetadataKey{ + Key: extAuthzFilterName, + Path: []*metadatav3.MetadataKey_PathSegment{ + { + Segment: &metadatav3.MetadataKey_PathSegment_Key{ + Key: descriptorMetadataKeyForSubscription, }, }, }, - Source: routev3.RateLimit_Action_MetaData_DYNAMIC, - SkipIfAbsent: true, }, + Source: routev3.RateLimit_Action_MetaData_DYNAMIC, + SkipIfAbsent: true, }, }, - { - ActionSpecifier: &routev3.RateLimit_Action_Metadata{ - Metadata: &routev3.RateLimit_Action_MetaData{ - DescriptorKey: DescriptorKeyForPolicy, - MetadataKey: &metadatav3.MetadataKey{ - Key: extAuthzFilterName, - Path: []*metadatav3.MetadataKey_PathSegment{ - { - Segment: &metadatav3.MetadataKey_PathSegment_Key{ - Key: descriptorMetadataKeyForUsagePolicy, - }, + }, + { + ActionSpecifier: &routev3.RateLimit_Action_Metadata{ + Metadata: &routev3.RateLimit_Action_MetaData{ + DescriptorKey: DescriptorKeyForPolicy, + MetadataKey: &metadatav3.MetadataKey{ + Key: extAuthzFilterName, + Path: []*metadatav3.MetadataKey_PathSegment{ + { + Segment: &metadatav3.MetadataKey_PathSegment_Key{ + Key: descriptorMetadataKeyForUsagePolicy, }, }, }, - Source: routev3.RateLimit_Action_MetaData_DYNAMIC, - SkipIfAbsent: true, }, + Source: routev3.RateLimit_Action_MetaData_DYNAMIC, + SkipIfAbsent: true, }, }, - { - ActionSpecifier: &routev3.RateLimit_Action_GenericKey_{ - GenericKey: &routev3.RateLimit_Action_GenericKey{ - DescriptorKey: "burst", - DescriptorValue: "enabled", - }, + }, + { + ActionSpecifier: &routev3.RateLimit_Action_GenericKey_{ + GenericKey: &routev3.RateLimit_Action_GenericKey{ + DescriptorKey: "burst", + DescriptorValue: "enabled", }, }, }, }, + }, } }