Feat/support network gateway routing#1661
Feat/support network gateway routing#1661Tushar240503 wants to merge 5 commits intokmesh-net:mainfrom
Conversation
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>
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Summary of ChangesHello, 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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
| test/mugen-master/ | ||
|
|
||
| .github/copilot-instructions.md | ||
| google/ |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 = 27toWorkloadinworkload.proto(with wrappers import). - Regenerated Go protobuf bindings to expose the new
Capacityfield. - Regenerated C (protobuf-c) bindings to expose the new
capacityfield and dependency onwrappers.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.
| // 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" |
| 0, /* quantifier_offset */ | ||
| offsetof(Istio__Workload__Workload, capacity), | ||
| &google__protobuf__uint32_value__descriptor, | ||
| NULL, |
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.