Skip to content

Commit 724e236

Browse files
add stat prefix for WASM default RBAC filters (#57824)
* add stat prefix for wasm default http rbac filters Signed-off-by: Rama Chavali <[email protected]> * fix ut Signed-off-by: Rama Chavali <[email protected]> --------- Signed-off-by: Rama Chavali <[email protected]>
1 parent 2e18767 commit 724e236

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

pkg/istio-agent/xds_proxy_delta_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ func TestDeltaECDSWasmConversion(t *testing.T) {
198198
t.Fatalf("wasm config conversion output %v failed to unmarshal", gotResp.Resources[0])
199199
}
200200
httpDenyAll := &httprbac.RBAC{
201-
Rules: &rbacv3.RBAC{},
201+
Rules: &rbacv3.RBAC{},
202+
RulesStatPrefix: "wasm-default-deny",
202203
}
203204
wantEcdsConfig = &core.TypedExtensionConfig{
204205
Name: "extension-config",

pkg/istio-agent/xds_proxy_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,8 @@ func TestECDSWasmConversion(t *testing.T) {
538538
t.Fatalf("wasm config conversion output %v failed to unmarshal", gotResp.Resources[0])
539539
}
540540
httpDenyAll := &httprbac.RBAC{
541-
Rules: &rbacv3.RBAC{},
541+
Rules: &rbacv3.RBAC{},
542+
RulesStatPrefix: "wasm-default-deny",
542543
}
543544
wantEcdsConfig = &core.TypedExtensionConfig{
544545
Name: "extension-config",

pkg/wasm/convert.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ import (
3838
)
3939

4040
var (
41-
allowHTTPTypedConfig = &anypb.Any{
42-
TypeUrl: "type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBAC",
41+
allowHTTPTypedConfig, _ = anypb.New(&httprbac.RBAC{
4342
// no rules mean allow all.
44-
}
43+
RulesStatPrefix: "wasm-default-allow",
44+
})
45+
4546
denyHTTPTypedConfig, _ = anypb.New(&httprbac.RBAC{
4647
// empty rule means deny all.
47-
Rules: &rbacv3.RBAC{},
48+
Rules: &rbacv3.RBAC{},
49+
RulesStatPrefix: "wasm-default-deny",
4850
})
4951

5052
allowNetworkTypeConfig, _ = anypb.New(&networkrbac.RBAC{

pkg/wasm/convert_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,12 @@ var extensionConfigMap = map[string]*core.TypedExtensionConfig{
479479
FailOpen: true,
480480
},
481481
}),
482-
"remote-load-allow": buildAnyExtensionConfig("remote-load-fail", &rbac.RBAC{}),
482+
"remote-load-allow": buildAnyExtensionConfig("remote-load-fail", &rbac.RBAC{
483+
RulesStatPrefix: "wasm-default-allow",
484+
}),
483485
"remote-load-deny": buildAnyExtensionConfig("remote-load-fail", &rbac.RBAC{
484-
Rules: &rbacv3.RBAC{},
486+
Rules: &rbacv3.RBAC{},
487+
RulesStatPrefix: "wasm-default-deny",
485488
}),
486489
"remote-load-secret": buildTypedStructExtensionConfig("remote-load-success", &wasm.Wasm{
487490
Config: &v3.PluginConfig{

0 commit comments

Comments
 (0)