WIP: E2E test case for Kmesh L4 authorization#641
WIP: E2E test case for Kmesh L4 authorization#641YaoZengzeng wants to merge 12 commits intokmesh-net:mainfrom
Conversation
Codecov ReportAttention: Patch coverage is
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
/test |
|
@YaoZengzeng: No presubmit jobs available for kmesh-net/kmesh@main DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/retest |
| if len(apps.ServiceWithWaypointAtServiceGranularity) == 0 { | ||
| t.Fatal(fmt.Errorf("need at least 1 instance of apps.ServiceWithWaypointAtServiceGranularity")) | ||
| } | ||
| src := apps.ServiceWithWaypointAtServiceGranularity[0] |
There was a problem hiding this comment.
why do you choose this special workload as a src client
There was a problem hiding this comment.
There is no specific choice, any workload managed by Kmesh is OK.
|
|
||
| addresses := clients.Addresses() | ||
| if len(addresses) < 2 { | ||
| t.Fatal(fmt.Errorf("need at least 2 clients")) |
There was a problem hiding this comment.
? why require at least 2 addresses
There was a problem hiding this comment.
One for allow and one for deny.
test/e2e/baseline_test.go
Outdated
| check.ErrorContains("EOF"), // TCP envoy | ||
| check.ErrorContains("read: connection reset by peer"), // TCP Kmesh | ||
| check.NoErrorAndStatus(http.StatusForbidden), // HTTP | ||
| check.NoErrorAndStatus(http.StatusServiceUnavailable), // HTTP client, TCP server |
There was a problem hiding this comment.
This is too wide, for tcp authz, can we only check reset?
| selector: | ||
| matchLabels: | ||
| app: "{{.Destination}}" | ||
| `+tc.spec+` |
There was a problem hiding this comment.
A hacky way, would prefer using fmt.Sprintf or golang template
|
authz offloading is disabled by default, the only way to enable it is |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
22a3fb4 to
88e54bf
Compare
|
/retest |
|
/test all |
|
@hzxuzhonghu: No presubmit jobs available for kmesh-net/kmesh@main DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
60d92b8 to
0f86845
Compare
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
0f86845 to
b4775df
Compare
|
/test all |
|
@YaoZengzeng: No presubmit jobs available for kmesh-net/kmesh@main DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
93b7fff to
335cb2a
Compare
|
/retest |
| int xdp_authz(struct xdp_md *ctx) | ||
| { | ||
| if (!is_authz_offload_enabled()) { | ||
| BPF_LOG(INFO, XDP, "offload authorization is DISABLED"); |
| bpf_tail_call(ctx, &map_of_xdp_tailcall, TAIL_CALL_AUTH_IN_USER_SPACE); | ||
| return XDP_PASS; | ||
| } | ||
| BPF_LOG(INFO, XDP, "offload authorization is ENABLED"); |
| }) | ||
| } | ||
|
|
||
| func TestAuthorizationL4(t *testing.T) { |
There was a problem hiding this comment.
nit: we can split test cases by the functionalities
|
|
||
| count := 0 | ||
| workloads := dst.WorkloadsOrFail(t) | ||
| for _, client := range workloads { |
There was a problem hiding this comment.
hmm, this is the server instance
| ticker := time.NewTicker(500 * time.Millisecond) | ||
| defer ticker.Stop() | ||
| InnerLoop: | ||
| for { |
There was a problem hiding this comment.
there is retry.Until that can be used
| opt.Check = chooseChecker(tc.name, client.Address()) | ||
|
|
||
| t.NewSubTestf("%v", name).Run(func(t framework.TestContext) { | ||
| src.WithWorkloads(client).CallOrFail(t, opt) |
There was a problem hiding this comment.
shoudn't you wait until the policy has been populated? I cannot understand how you make it
|
replace by #1349 |
What type of PR is this?
/kind enhancement
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #492
Special notes for your reviewer:
Does this PR introduce a user-facing change?: