Skip to content

Commit

Permalink
add xds translator test
Browse files Browse the repository at this point in the history
Signed-off-by: Aurélien Pillevesse <[email protected]>
  • Loading branch information
AurelienPillevesse committed Nov 12, 2024
1 parent 3bd62e3 commit 336be74
Show file tree
Hide file tree
Showing 5 changed files with 391 additions and 0 deletions.
124 changes: 124 additions & 0 deletions internal/xds/translator/testdata/in/xds-ir/ext-auth-body.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
http:
- address: 0.0.0.0
hostnames:
- '*'
isHTTP2: false
name: default/gateway-1/http
path:
escapedSlashesAction: UnescapeAndRedirect
mergeSlashes: true
port: 10080
routes:
- name: httproute/default/httproute-1/rule/0/match/0/www_foo_com
hostname: www.foo.com
isHTTP2: false
pathMatch:
distinct: false
name: ""
prefix: /foo1
backendWeights:
invalid: 0
valid: 0
destination:
name: httproute/default/httproute-1/rule/0
settings:
- addressType: IP
endpoints:
- host: 7.7.7.7
port: 8080
protocol: HTTP
weight: 1
security:
extAuth:
name: securitypolicy/default/policy-for-http-route-1
failOpen: false
grpc:
authority: primary.foo.com
destination:
name: securitypolicy/default/policy-for-http-route-1/default/grpc-backend
settings:
- addressType: FQDN
endpoints:
- host: primary.foo.com
port: 9000
protocol: GRPC
weight: 1
headersToExtAuth:
- header1
- header2
- name: httproute/default/httproute-1/rule/1/match/0/www_foo_com
hostname: www.foo.com
isHTTP2: false
pathMatch:
distinct: false
name: ""
prefix: /foo2
backendWeights:
invalid: 0
valid: 0
destination:
name: httproute/default/httproute-1/rule/1
settings:
- addressType: IP
endpoints:
- host: 7.7.7.7
port: 8080
protocol: HTTP
weight: 1
security:
extAuth:
name: securitypolicy/default/policy-for-http-route-1
failOpen: false
grpc:
authority: primary.foo.com
destination:
name: securitypolicy/default/policy-for-http-route-1/default/grpc-backend
settings:
- addressType: IP
endpoints:
- host: primary.foo.com
port: 3000
protocol: GRPC
weight: 1
headersToExtAuth:
- header1
- header2
- name: httproute/default/httproute-2/rule/0/match/0/www_bar_com
hostname: www.bar.com
isHTTP2: false
pathMatch:
distinct: false
name: ""
prefix: /bar
backendWeights:
invalid: 0
valid: 0
destination:
name: httproute/default/httproute-2/rule/0
settings:
- addressType: IP
endpoints:
- host: 7.7.7.7
port: 8080
protocol: HTTP
weight: 1
security:
extAuth:
name: securitypolicy/default/policy-for-gateway-1
failOpen: true
bodyToExtAuth: true
http:
authority: primary.foo.com
destination:
name: securitypolicy/default/policy-for-gateway-1/envoy-gateway/http-backend
settings:
- addressType: FQDN
endpoints:
- host: primary.foo.com
port: 80
protocol: HTTP
weight: 1
headersToBackend:
- header1
- header2
path: /auth
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: httproute/default/httproute-1/rule/0
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/default/httproute-1/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: httproute/default/httproute-1/rule/1
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/default/httproute-1/rule/1
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
edsClusterConfig:
edsConfig:
ads: {}
resourceApiVersion: V3
serviceName: httproute/default/httproute-2/rule/0
ignoreHealthOnHostRemoval: true
lbPolicy: LEAST_REQUEST
name: httproute/default/httproute-2/rule/0
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
type: EDS
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: securitypolicy/default/policy-for-http-route-1/default/grpc-backend
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: primary.foo.com
portValue: 9000
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: securitypolicy/default/policy-for-http-route-1/default/grpc-backend/backend/0
name: securitypolicy/default/policy-for-http-route-1/default/grpc-backend
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
respectDnsTtl: true
type: STRICT_DNS
typedExtensionProtocolOptions:
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
explicitHttpConfig:
http2ProtocolOptions:
initialConnectionWindowSize: 1048576
initialStreamWindowSize: 65536
- circuitBreakers:
thresholds:
- maxRetries: 1024
commonLbConfig:
localityWeightedLbConfig: {}
connectTimeout: 10s
dnsLookupFamily: V4_ONLY
dnsRefreshRate: 30s
lbPolicy: LEAST_REQUEST
loadAssignment:
clusterName: securitypolicy/default/policy-for-gateway-1/envoy-gateway/http-backend
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: primary.foo.com
portValue: 80
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: securitypolicy/default/policy-for-gateway-1/envoy-gateway/http-backend/backend/0
name: securitypolicy/default/policy-for-gateway-1/envoy-gateway/http-backend
outlierDetection: {}
perConnectionBufferLimitBytes: 32768
respectDnsTtl: true
type: STRICT_DNS
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
- clusterName: httproute/default/httproute-1/rule/0
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 7.7.7.7
portValue: 8080
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: httproute/default/httproute-1/rule/0/backend/0
- clusterName: httproute/default/httproute-1/rule/1
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 7.7.7.7
portValue: 8080
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: httproute/default/httproute-1/rule/1/backend/0
- clusterName: httproute/default/httproute-2/rule/0
endpoints:
- lbEndpoints:
- endpoint:
address:
socketAddress:
address: 7.7.7.7
portValue: 8080
loadBalancingWeight: 1
loadBalancingWeight: 1
locality:
region: httproute/default/httproute-2/rule/0/backend/0
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
- address:
socketAddress:
address: 0.0.0.0
portValue: 10080
defaultFilterChain:
filters:
- name: envoy.filters.network.http_connection_manager
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
commonHttpProtocolOptions:
headersWithUnderscoresAction: REJECT_REQUEST
http2ProtocolOptions:
initialConnectionWindowSize: 1048576
initialStreamWindowSize: 65536
maxConcurrentStreams: 100
httpFilters:
- disabled: true
name: envoy.filters.http.ext_authz/securitypolicy/default/policy-for-http-route-1
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
allowedHeaders:
patterns:
- exact: header1
ignoreCase: true
- exact: header2
ignoreCase: true
grpcService:
envoyGrpc:
authority: primary.foo.com
clusterName: securitypolicy/default/policy-for-http-route-1/default/grpc-backend
timeout: 10s
transportApiVersion: V3
- disabled: true
name: envoy.filters.http.ext_authz/securitypolicy/default/policy-for-gateway-1
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
withRequestBody:
allowPartialMessage: false
packAsBytes: false
failureModeAllow: true
httpService:
authorizationResponse:
allowedUpstreamHeaders:
patterns:
- exact: header1
ignoreCase: true
- exact: header2
ignoreCase: true
pathPrefix: /auth
serverUri:
cluster: securitypolicy/default/policy-for-gateway-1/envoy-gateway/http-backend
timeout: 10s
uri: http://primary.foo.com/auth
transportApiVersion: V3
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
suppressEnvoyHeaders: true
mergeSlashes: true
normalizePath: true
pathWithEscapedSlashesAction: UNESCAPE_AND_REDIRECT
rds:
configSource:
ads: {}
resourceApiVersion: V3
routeConfigName: default/gateway-1/http
serverHeaderTransformation: PASS_THROUGH
statPrefix: http-10080
useRemoteAddress: true
name: default/gateway-1/http
name: default/gateway-1/http
perConnectionBufferLimitBytes: 32768
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
- ignorePortInHostMatching: true
name: default/gateway-1/http
virtualHosts:
- domains:
- www.foo.com
name: default/gateway-1/http/www_foo_com
routes:
- match:
pathSeparatedPrefix: /foo1
name: httproute/default/httproute-1/rule/0/match/0/www_foo_com
route:
cluster: httproute/default/httproute-1/rule/0
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.ext_authz/securitypolicy/default/policy-for-http-route-1:
'@type': type.googleapis.com/envoy.config.route.v3.FilterConfig
config: {}
- match:
pathSeparatedPrefix: /foo2
name: httproute/default/httproute-1/rule/1/match/0/www_foo_com
route:
cluster: httproute/default/httproute-1/rule/1
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.ext_authz/securitypolicy/default/policy-for-http-route-1:
'@type': type.googleapis.com/envoy.config.route.v3.FilterConfig
config: {}
- domains:
- www.bar.com
name: default/gateway-1/http/www_bar_com
routes:
- match:
pathSeparatedPrefix: /bar
name: httproute/default/httproute-2/rule/0/match/0/www_bar_com
route:
cluster: httproute/default/httproute-2/rule/0
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.ext_authz/securitypolicy/default/policy-for-gateway-1:
'@type': type.googleapis.com/envoy.config.route.v3.FilterConfig
config: {}

0 comments on commit 336be74

Please sign in to comment.