-
Notifications
You must be signed in to change notification settings - Fork 47
docs: add circuit breaker and rate limiting user guides #233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: aicee <[email protected]>
✅ Deploy Preview for kmesh-net ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
[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.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @zrggw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces comprehensive user guides for implementing and testing circuit breaking and local rate limiting features within the kmesh environment. These new documents provide practical, step-by-step instructions for users to configure and verify these traffic management capabilities.
Highlights
- Circuit Breaker User Guide: A new guide detailing how to set up and test circuit breaking, including deploying fortio and httpbin, configuring Waypoint proxies, and applying DestinationRule for connection pooling and outlier detection.
- Local Rate Limiting User Guide: A new guide explaining the implementation and testing of local rate limiting, covering the deployment of sleep and httpbin, Waypoint configuration, and the use of EnvoyFilter to define header-based rate limits.
- Practical Examples: Both guides provide executable kubectl commands and expected output to facilitate hands-on learning and verification of the features.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds two new user guides for the circuit breaker and local rate limiting features. The guides are well-structured and provide clear step-by-step instructions. My feedback includes a few suggestions to improve the robustness and consistency of the shell commands, such as explicitly specifying namespaces in kubectl
commands and removing unnecessary flags from kubectl exec
.
First, get the name of the Waypoint pod. | ||
|
||
```sh | ||
export WAYPOINT_POD=$(kubectl get pod -l gateway.networking.k8s.io/gateway-name=httpbin-waypoint -o jsonpath='{.items[0].metadata.name}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity and robustness, it's good practice to explicitly specify the namespace when getting Kubernetes resources. Since the waypoint proxy is created in the default
namespace, please add -n default
to the command.
export WAYPOINT_POD=$(kubectl get pod -l gateway.networking.k8s.io/gateway-name=httpbin-waypoint -o jsonpath='{.items[0].metadata.name}') | |
export WAYPOINT_POD=$(kubectl get pod -n default -l gateway.networking.k8s.io/gateway-name=httpbin-waypoint -o jsonpath='{.items[0].metadata.name}') |
Now, let's use `fortio` to send a burst of traffic to `httpbin`. | ||
|
||
```sh | ||
export FORTIO_POD=$(kubectl get pods -l app=fortio -o 'jsonpath={.items[0].metadata.name}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity and robustness, it's good practice to explicitly specify the namespace. The fortio
pod is deployed in the default
namespace, so please add -n default
to this command.
export FORTIO_POD=$(kubectl get pods -l app=fortio -o 'jsonpath={.items[0].metadata.name}') | |
export FORTIO_POD=$(kubectl get pods -n default -l app=fortio -o 'jsonpath={.items[0].metadata.name}') |
To verify the configuration, first get the name of the Waypoint pod, then use `istioctl` to inspect its configuration. | ||
|
||
```sh | ||
export WAYPOINT_POD=$(kubectl get pod -l gateway.networking.k8s.io/gateway-name=httpbin-waypoint -o jsonpath='{.items[0].metadata.name}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity and robustness, it's good practice to explicitly specify the namespace when getting Kubernetes resources. Since the waypoint proxy is created in the default
namespace, please add -n default
to the command.
export WAYPOINT_POD=$(kubectl get pod -l gateway.networking.k8s.io/gateway-name=httpbin-waypoint -o jsonpath='{.items[0].metadata.name}') | |
export WAYPOINT_POD=$(kubectl get pod -n default -l gateway.networking.k8s.io/gateway-name=httpbin-waypoint -o jsonpath='{.items[0].metadata.name}') |
istioctl proxy-config all $WAYPOINT_POD -ojson | grep ratelimit -A 20 | ||
``` | ||
|
||
## Step 6. Find the following results, which means the configuration has been sent to waypoint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This heading is a bit long and reads like an instruction rather than a section title. Consider rephrasing it to be more concise and descriptive, for example: ## Step 6. Verify Envoy Filter Configuration
.
## Step 6. Find the following results, which means the configuration has been sent to waypoint | |
## Step 6. Verify Envoy Filter Configuration |
First, get the name of the `sleep` pod: | ||
|
||
```sh | ||
export SLEEP_POD=$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For clarity and robustness, it's good practice to explicitly specify the namespace. The sleep
pod is deployed in the default
namespace, so please add -n default
to this command.
export SLEEP_POD=$(kubectl get pod -l app=sleep -o jsonpath='{.items[0].metadata.name}') | |
export SLEEP_POD=$(kubectl get pod -n default -l app=sleep -o jsonpath='{.items[0].metadata.name}') |
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | ||
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | ||
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | ||
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The -it
flags are used to run a command in an interactive terminal session. Since these curl
commands are non-interactive, the flags are unnecessary. Removing them would also make the commands consistent with others in the documentation (e.g., in circuit-breaker.md
). This applies to all kubectl exec
commands in this section.
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | |
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | |
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | |
kubectl exec -it $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | |
kubectl exec $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | |
kubectl exec $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | |
kubectl exec $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers | |
kubectl exec $SLEEP_POD -- curl -H 'quota:medium' http://httpbin:8000/headers |
kubectl exec -it $SLEEP_POD -- curl -H 'quota:low' http://httpbin:8000/headers | ||
kubectl exec -it $SLEEP_POD -- curl -H 'quota:low' http://httpbin:8000/headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned previously, the -it
flags are not needed for these non-interactive curl
commands.
kubectl exec -it $SLEEP_POD -- curl -H 'quota:low' http://httpbin:8000/headers | |
kubectl exec -it $SLEEP_POD -- curl -H 'quota:low' http://httpbin:8000/headers | |
kubectl exec $SLEEP_POD -- curl -H 'quota:low' http://httpbin:8000/headers | |
kubectl exec $SLEEP_POD -- curl -H 'quota:low' http://httpbin:8000/headers |
What this PR does / why we need it:
This PR adds the user guides for the circuit breaker and rate limiting features.