Skip to content

Conversation

zrggw
Copy link
Contributor

@zrggw zrggw commented Sep 9, 2025

What this PR does / why we need it:
This PR adds the user guides for the circuit breaker and rate limiting features.

Copy link

netlify bot commented Sep 9, 2025

Deploy Preview for kmesh-net ready!

Name Link
🔨 Latest commit ba38a72
🔍 Latest deploy log https://app.netlify.com/projects/kmesh-net/deploys/68bf93ef2de50f0008d85f57
😎 Deploy Preview https://deploy-preview-233--kmesh-net.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kmesh-bot kmesh-bot requested a review from nlgwcy September 9, 2025 02:41
@kmesh-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jayesh9747 for approval. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

@gemini-code-assist gemini-code-assist bot left a 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

  1. 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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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}')

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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}')

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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}')

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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

Choose a reason for hiding this comment

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

medium

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.

Suggested change
## 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}')

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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}')

Comment on lines +200 to +203
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

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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

Comment on lines +217 to +218
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

Choose a reason for hiding this comment

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

medium

As mentioned previously, the -it flags are not needed for these non-interactive curl commands.

Suggested change
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants