Skip to content

feat: data plane & envoyproxy resilience test suite#4862

Merged
guydc merged 54 commits intoenvoyproxy:mainfrom
alexwo:resilience_test_suite
Dec 14, 2024
Merged

feat: data plane & envoyproxy resilience test suite#4862
guydc merged 54 commits intoenvoyproxy:mainfrom
alexwo:resilience_test_suite

Conversation

@alexwo
Copy link
Copy Markdown
Contributor

@alexwo alexwo commented Dec 6, 2024

What type of PR is this?
This pr adds a resilience test suite to cover the expected behavior of the data plane for both existing and new proxy instances during specific edge conditions.

Why do we use Cilium?
The default network plugin in Kubernetes-in-Docker (Kind) does not support enforcing network policies that restrict connectivity to local services, such as the Kubernetes API server. However, by disabling the default CNI and deploying Cilium as the CNI plugin, we can implement network policies that effectively control access to the API server. This approach allows for precise management of network traffic within the cluster, including the ability to block connectivity to the Kubernetes API server as needed.

New test suite
Having a new resilience test suite can be helpful due to the unique network setup and tests involved in resilience testing, which differ significantly from those of existing test suites.

For instance, we need a custom CNI only for this test case, other tests can still use the default.

Fault Injection: Resilience testing involves deliberately introducing failures to assess the system’s response and recovery capabilities. This approach is not typically encompassed by standard functional or performance test suites.

By maintaining a separate resilience test suite, we can effectively simulate and manage system stressors, and separate this concern from the other test cases we have.

Test suite is expected to pass once #4767 is merged.

Issue:
#4861

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo alexwo requested a review from a team as a code owner December 6, 2024 22:27
@alexwo alexwo changed the title [Fadding resilience test suite [feat] add resilience test suite Dec 6, 2024
@alexwo alexwo changed the title [feat] add resilience test suite [feat] data plane / envoy proxy resilience test suite Dec 6, 2024
@alexwo alexwo changed the title [feat] data plane / envoy proxy resilience test suite feat: data plane / envoy proxy resilience test suite Dec 6, 2024
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.28%. Comparing base (d33b617) to head (50ca751).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4862   +/-   ##
=======================================
  Coverage   66.28%   66.28%           
=======================================
  Files         209      209           
  Lines       31942    31942           
=======================================
+ Hits        21172    21174    +2     
+ Misses       9517     9516    -1     
+ Partials     1253     1252    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo alexwo changed the title feat: data plane / envoy proxy resilience test suite feat: data planeYenvoy proxy resilience test suite Dec 6, 2024
@alexwo alexwo changed the title feat: data planeYenvoy proxy resilience test suite feat: data plane & envoy proxy resilience test suite Dec 6, 2024
@alexwo alexwo changed the title feat: data plane & envoy proxy resilience test suite feat: data plane & envoyproxy resilience test suite Dec 6, 2024
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Dec 7, 2024

/retest

1 similar comment
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Dec 7, 2024

/retest

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Comment thread test/resilience/tests/envoyproxy.go Outdated
TIMEOUT=120 # seconds
ELAPSED_TIME=0

if [ "$CUSTOM_CNI" = "true" ]; then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you share more details about why we need cilium?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default network plugin in Kubernetes-in-Docker (Kind) does not support enforcing network policies that restrict connectivity to local services, such as the Kubernetes API server. However, by disabling the default CNI and deploying Cilium as the CNI plugin, we can implement network policies that effectively control access to the API server. This approach allows for precise management of network traffic within the cluster, including the ability to block connectivity to the Kubernetes API server as needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall kind support network policy as kubernetes-sigs/kind#842 closed.

Copy link
Copy Markdown
Contributor Author

@alexwo alexwo Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zirain That’s correct, network policies are supported now. However, even the new local kind network adapter is currently not enforcing network policies that restrict connectivity to local services like the API server. As a result, the default kind adapter isn’t suitable for this specific use case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

@alexwo alexwo Dec 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will give it a try, maybe it can do the work 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zirain I tested with kube-network-policies, but it was unable to block connectivity to the API server. In fact, I tried all the other available options as well. Currently, it seems this functionality is only achievable with the Cilium CNI.

@zirain
Copy link
Copy Markdown
Member

zirain commented Dec 7, 2024

why we need a new test suite instead of reuse existing one?

@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Dec 7, 2024

Contributor

why we need a new test suite instead of reuse existing one?

Having a dedicated resilience test suite can be helpful due to the unique network setup and tests involved in resilience testing, which differ significantly from those of existing test suites.

For instance, we need a custom CNI only for this test case, other tests can still use the default.

Fault Injection: Resilience testing involves deliberately introducing failures to assess the system’s response and recovery capabilities. This approach is not typically encompassed by standard functional or performance test suites.

By maintaining a separate resilience test suite, we can effectively simulate and manage system stressors, and separate this concern from the other test cases we have.

Running this suite in parallel will keep us at good execution time.

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Dec 7, 2024

/retest

Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
zhaohuabing
zhaohuabing previously approved these changes Dec 11, 2024
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Dec 11, 2024

/retest

t.Log("Marking the identified pod as leader")
suite.Kube().MarkAsLeader(namespace, name)

t.Log("Simulating API server connection failure for all pods")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If all pods loose connectivity, don't we expect that they would all fail eventually once becoming leaders?

Copy link
Copy Markdown
Contributor Author

@alexwo alexwo Dec 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pods rely on connectivity to the API server to participate in leader election processes. Without this connectivity, they cannot become leaders, in this test we won't bring it back. The secondary pods will continue to operate using their last known good configuration (xDS) and share it with envoy proxies accordingly.

@zhaohuabing
Copy link
Copy Markdown
Member

zhaohuabing commented Dec 12, 2024

@alexwo Could you please add a few lines of the comments for each test? (Like you explained in the comments of this PR) This will help other contributors understand why we need the test and how the test works. Thanks!

@zhaohuabing zhaohuabing self-requested a review December 12, 2024 03:18
zhaohuabing
zhaohuabing previously approved these changes Dec 12, 2024
Comment thread test/resilience/tests/envoygateway.go Outdated
@zhaohuabing zhaohuabing self-requested a review December 12, 2024 10:59
alexwo and others added 2 commits December 12, 2024 13:52
Co-authored-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Alex Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
Signed-off-by: Alexander Volchok <alex.volchok@sap.com>
@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Dec 12, 2024

#4767 has been merged, that should unblock this PR now ?

zhaohuabing
zhaohuabing previously approved these changes Dec 13, 2024
@zhaohuabing
Copy link
Copy Markdown
Member

#4767 has been merged, that should unblock this PR now ?

@arkodg I believe this PR is ready to be merged.

Should we also cherry-pick this to v1.2.4?

@alexwo
Copy link
Copy Markdown
Contributor Author

alexwo commented Dec 13, 2024

/retest

Signed-off-by: Alex Volchok <alex.volchok@sap.com>
@guydc guydc merged commit 469de2f into envoyproxy:main Dec 14, 2024
@alexwo alexwo deleted the resilience_test_suite branch December 14, 2024 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants