Skip to content

Feat/support network gateway routing#1661

Open
Tushar240503 wants to merge 5 commits intokmesh-net:mainfrom
Tushar240503:feat/support-network-gateway-routing
Open

Feat/support network gateway routing#1661
Tushar240503 wants to merge 5 commits intokmesh-net:mainfrom
Tushar240503:feat/support-network-gateway-routing

Conversation

@Tushar240503
Copy link
Copy Markdown
Contributor

Description

This PR updates the Kmesh Workload API to add support for the capacity field, enabling future multicluster and split-horizon traffic management.

Why

In multicluster setups, Istio control planes provide workload endpoints with a capacity value indicating relative traffic-handling capability.
Without this field:

Discovery responses with capacity cannot be fully unmarshaled
Weighted load balancing across clusters is not possible
What’s included
Added google.protobuf.UInt32Value capacity = 27 to workload.proto
Imported wrappers.proto for compatibility with Istio/ztunnel
Regenerated Go and C protobuf bindings
Technical notes
Field number 27 aligns with upstream Istio/ztunnel
UInt32Value allows distinguishing between 0 and unset (default = 1)
PR Type

/kind feature

Notes for reviewers

This PR only introduces the API field. Routing logic and its usage in the BPF load balancer will follow in subsequent PRs.

Release note

Enhanced Workload API with capacity metadata support for multicluster routing.

Signed-off-by: Tushar Sharma <tusharkumargzb6@gmail.com>
Signed-off-by: Tushar Sharma <tusharkumargzb6@gmail.com>
Signed-off-by: Tushar Sharma <tusharkumargzb6@gmail.com>
Signed-off-by: Tushar Sharma <tusharkumargzb6@gmail.com>
Signed-off-by: Tushar Sharma <tusharkumargzb6@gmail.com>
Copilot AI review requested due to automatic review settings April 30, 2026 05:23
@kmesh-bot
Copy link
Copy Markdown
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 bitcoffeeiux for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 enhances the Kmesh Workload API by introducing a capacity field. This addition is a critical step towards enabling sophisticated traffic management strategies in multicluster environments, allowing workloads to communicate their relative traffic-handling capabilities. The changes involve updating the core protobuf schema and subsequently regenerating the language-specific bindings for Go and C.

Highlights

  • API Enhancement: Added a new capacity field to the Workload API definition in workload.proto.
  • Code Generation: Regenerated Go and C protobuf bindings to include the newly added capacity field and its associated logic.
  • Future Capabilities: Enabled foundational support for advanced multicluster and split-horizon traffic management, including weighted load balancing.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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.


A proto field, new, Capacity, traffic's flow, Load balanced now.

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
Copy Markdown

@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 introduces a capacity field to the Workload message in the workloadapi protobuf definition, along with updates to the generated Go and C bindings. The new field uses google.protobuf.UInt32Value to define relative traffic handling capacity. Feedback focuses on a critical issue in the .gitignore file, where the exclusion of the google/ directory will lead to build failures and compilation errors because it contains necessary generated dependencies for the C bindings.

Comment thread .gitignore
test/mugen-master/

.github/copilot-instructions.md
google/
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

Excluding the google/ directory from the repository will cause build failures for the C bindings. The newly generated workload.pb-c.h and workload.pb-c.c files depend on headers and descriptors generated from google/protobuf/wrappers.proto. Since the project follows the practice of committing generated protobuf bindings, the generated code for these dependencies must also be committed rather than ignored.

# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif

#include "google/protobuf/wrappers.pb-c.h"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

This include requires google/protobuf/wrappers.pb-c.h to be present in the include path. However, the .gitignore file has been updated to ignore the google/ directory, which likely contains this generated header. This will lead to compilation errors in environments that rely on the committed generated code.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Kmesh Workload API to carry Istio/ztunnel-compatible endpoint capacity metadata, enabling future multicluster / split-horizon traffic management and ensuring discovery responses containing capacity can be unmarshaled.

Changes:

  • Added google.protobuf.UInt32Value capacity = 27 to Workload in workload.proto (with wrappers import).
  • Regenerated Go protobuf bindings to expose the new Capacity field.
  • Regenerated C (protobuf-c) bindings to expose the new capacity field and dependency on wrappers.proto.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
api/workloadapi/workload.proto Adds wrappers import and new capacity field on Workload.
api/v2/workloadapi/workload.pb.go Regenerated Go bindings including Capacity and wrappers import.
api/v2-c/workloadapi/workload.pb-c.h Regenerated C header including wrappers pb-c include and new field.
api/v2-c/workloadapi/workload.pb-c.c Regenerated C source adding capacity field descriptor referencing wrappers descriptor.
.gitignore Adds google/ ignore rule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +244 to +245
// This represents the amount of traffic the workload can handle, relative to other workloads
// If unset, the capacity is default to 1.
# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c.
#endif

#include "google/protobuf/wrappers.pb-c.h"
Comment on lines +1156 to +1159
0, /* quantifier_offset */
offsetof(Istio__Workload__Workload, capacity),
&google__protobuf__uint32_value__descriptor,
NULL,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants