Skip to content

Conversation

@AkarshSahlot
Copy link
Contributor

This PR contributes documentation for Issue #600, expanding the official Kmesh developer documentation with an example of Layer 7 (L7) request routing.
Included in this PR:
• A new file: docs/l7/request-routing.md
• Introduction and overview of L7 request routing in Kmesh
• Step-by-step example using Gateway API and httpbin-v1/httpbin-v2 services
• YAML config for HTTPRoute with multiple match rules
• Verification steps using curl from the sleep pod
• Notes on prerequisites and known limitations
• Related references for Kmesh and Istio documentation
The goal is to help users understand and experiment with L7 routing based on path prefixes, and to build a foundation for future docs on additional L7 features (timeouts, traffic shifting, etc.).
Please let me know if the structure or example should be adjusted. Happy to follow up with more L7 feature docs in subsequent PRs.
Fixes #600

)

Signed-off-by: AkarshSahlot <122122123+AkarshSahlot@users.noreply.github.com>
@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 lizhencheng9527 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 @AkarshSahlot, 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!

I've added comprehensive documentation for Layer 7 (L7) request routing in Kmesh. This new guide focuses on path-based routing, providing a clear, step-by-step example using Gateway API and httpbin services. The goal is to help users understand and implement L7 routing, laying the groundwork for future documentation on advanced L7 features.

Highlights

  • New Documentation File: A new file, docs/l7/request-routing.md, has been added to the Kmesh developer documentation.
  • L7 Request Routing Overview: The document provides an introduction and overview of Layer 7 (L7) request routing in Kmesh.
  • Detailed Example for Path-Based Routing: A step-by-step example demonstrates path-based routing, showing how to direct traffic to different httpbin service versions based on URL path prefixes (/v1 and /v2).
  • Gateway API Configuration Example: The documentation includes the YAML configuration for an HTTPRoute resource, illustrating how to set up multiple match rules for path-based routing using Gateway API.
  • Verification Steps: Clear instructions are provided for verifying the routing configuration, including curl commands to be executed from a sleep pod.
  • Prerequisites and Limitations: The document outlines necessary prerequisites for setting up L7 routing and notes known limitations, such as header-based and regex path matching requiring further validation.
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 or fill out our survey to provide feedback.

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.


Paths diverge and meet,Traffic flows, a guided stream,Docs light the way home.

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 valuable documentation for L7 request routing in Kmesh. The example is clear and helpful. I've found a critical issue in the provided YAML configuration that would prevent it from working, and I've also suggested some changes to make the example self-contained and easier for users to follow. My feedback focuses on ensuring the documentation is accurate and immediately usable.

```yaml
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
meta

Choose a reason for hiding this comment

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

critical

The YAML for the HTTPRoute is invalid. The field meta should be metadata:. With the current configuration, kubectl apply -f http-route.yaml will fail because the resource specification is malformed.

Suggested change
meta
metadata:

Comment on lines +43 to +44
parentRefs:
- name: example-gateway

Choose a reason for hiding this comment

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

high

The example relies on an example-gateway which is not defined in this document. This makes the example incomplete and hard for users to follow. For demonstrating mesh request routing, it's more common and clearer to attach the HTTPRoute to a Service.

I suggest the following changes to make the example self-contained:

  1. In Step 1, create a virtual httpbin service that will act as the parent for the route. You can add instructions to create a file (e.g., httpbin-service.yaml) with the following content and apply it:

    apiVersion: v1
    kind: Service
    metadata:
      name: httpbin
      namespace: example
    spec:
      ports:
      - port: 8000
        name: http
      selector:
        # This service has no pods, it's just a handle for the HTTPRoute.
        app: non-existent
  2. In Step 2, update the HTTPRoute to reference this new service as its parent, as suggested below.

Suggested change
parentRefs:
- name: example-gateway
parentRefs:
- name: httpbin
kind: Service
port: 8000


## Notes and Limitations

Header-based and regex path matching may require further validation. These instructions assume the example-gateway resource is present and working as expected.

Choose a reason for hiding this comment

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

high

Following the suggestion to use a Service as the parentRef for the HTTPRoute, this line assuming an example-gateway is no longer necessary and could cause confusion. It should be removed.

@@ -0,0 +1,93 @@

# Request Routing in Kmesh
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we already have this doc, ref: https://kmesh.net/docs/application-layer/try-request-routing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for pointing that out! Yes, I noticed the existing documentation and my PR focuses on testing or demonstrating the process specifically on the macOS platform. I wanted to share my experience to help macOS users better follow the steps.

Copy link
Member

Choose a reason for hiding this comment

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

@AkarshSahlot If this is for macos, i am not sure kmesh works. If it can work on mac os. Can you please update the install guide rather than for each task

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.

Doc to show the capabilities of Kmesh L7

4 participants