Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AmaliMatharaarachchi committed Sep 23, 2024
1 parent a67d321 commit 55adc48
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 31 deletions.
2 changes: 1 addition & 1 deletion adapter/internal/operator/gateway-api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func buildExtAuth() *ir.ExtAuth {
}
flag := true
extAuth := &ir.ExtAuth{
Name: ExtAuthName,
Name: "",
GRPC: &grpcExtAuthService,
UseBootstrapCluster: &flag,
}
Expand Down
4 changes: 3 additions & 1 deletion adapter/internal/operator/gateway-api/translator/extauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,11 @@ func buildHCMExtAuthFilter(extAuth *ir.ExtAuth) (*hcmv3.HttpFilter, error) {
return nil, err
}

disabled := extAuth == nil || (extAuth.GRPC == nil && extAuth.HTTP == nil)

return &hcmv3.HttpFilter{
Name: extAuthFilterName(extAuth),
Disabled: false,
Disabled: disabled,
ConfigType: &hcmv3.HttpFilter_TypedConfig{
TypedConfig: extAuthAny,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
initialStreamWindowSize: 65536
maxConcurrentStreams: 100
httpFilters:
- disabled: true
name: envoy.filters.http.ext_authz_httproute/default/httproute-1/rule/0/match/0/www_example_com
- name: envoy.filters.http.ext_authz_
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
httpService:
Expand All @@ -30,20 +29,6 @@
timeout: 10s
uri: http://http-backend.envoy-gateway:80/auth
transportApiVersion: V3
- disabled: true
name: envoy.filters.http.ext_authz_httproute/default/httproute-2/rule/0/match/0/www_example_com
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
allowedHeaders:
patterns:
- exact: header1
- exact: header2
grpcService:
envoyGrpc:
authority: grpc-backend.default:9000
clusterName: securitypolicy/default/policy-for-second-route/grpc-backend
timeout: 10s
transportApiVersion: V3
- name: envoy.filters.http.router
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.ext_authz_httproute/default/httproute-1/rule/0/match/0/www_example_com:
'@type': type.googleapis.com/envoy.config.route.v3.FilterConfig
config: {}
envoy.filters.http.ext_authz_:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
checkSettings:
contextExtensions:
route-name: httproute/default/httproute-1/rule/0/match/0/www_example_com
- match:
path: bar
name: httproute/default/httproute-2/rule/0/match/0/www_example_com
Expand All @@ -24,6 +26,8 @@
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.ext_authz_httproute/default/httproute-2/rule/0/match/0/www_example_com:
'@type': type.googleapis.com/envoy.config.route.v3.FilterConfig
config: {}
envoy.filters.http.ext_authz_:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
checkSettings:
contextExtensions:
route-name: httproute/default/httproute-2/rule/0/match/0/www_example_com
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
maxConcurrentStreams: 100
http3ProtocolOptions: {}
httpFilters:
- disabled: true
name: envoy.filters.http.ext_authz_httproute/default/httproute-2/rule/0/match/0/www_foo_com
- name: envoy.filters.http.ext_authz_securitypolicy/default/policy-for-http-route-2
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
httpService:
Expand Down Expand Up @@ -74,8 +73,7 @@
initialStreamWindowSize: 65536
maxConcurrentStreams: 100
httpFilters:
- disabled: true
name: envoy.filters.http.ext_authz_httproute/default/httproute-2/rule/0/match/0/www_foo_com
- name: envoy.filters.http.ext_authz_securitypolicy/default/policy-for-http-route-2
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
httpService:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
upgradeConfigs:
- upgradeType: websocket
typedPerFilterConfig:
envoy.filters.http.ext_authz_httproute/default/httproute-2/rule/0/match/0/www_foo_com:
'@type': type.googleapis.com/envoy.config.route.v3.FilterConfig
config: {}
envoy.filters.http.ext_authz_securitypolicy/default/policy-for-http-route-2:
'@type': type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
checkSettings:
contextExtensions:
route-name: httproute/default/httproute-2/rule/0/match/0/www_foo_com
- domains:
- www.bar.com
name: default/gateway-2/http/www_bar_com
Expand Down

0 comments on commit 55adc48

Please sign in to comment.