Skip to content

feat: add Tag field to IngressRule#1116

Closed
kahirokunn wants to merge 1 commit intoknative:mainfrom
kahirokunn:add-tag-field-to-ingress-rule
Closed

feat: add Tag field to IngressRule#1116
kahirokunn wants to merge 1 commit intoknative:mainfrom
kahirokunn:add-tag-field-to-ingress-rule

Conversation

@kahirokunn
Copy link
Member

Allow downstream ingress controllers to propagate traffic tag metadata (e.g. as labels on HTTPRoute/HTTPProxy), improving observability and enabling tag-based extension controllers.

Changes

When a Knative Service has traffic tags, tagged HTTPRoutes are generated but have no metadata indicating which tag they belong to. This makes it difficult for external tools to identify the traffic tag from HTTPRoute resources.

The root cause is that IngressRule — the intermediate representation between knative/serving and ingress controllers — does not carry the tag name. The tag is only encoded in the hostname, forcing downstream controllers to reverse-parse it with fragile template-based heuristics (e.g. TagOfHost() in net-gateway-api).

This PR adds a Tag string field to IngressRule so that the tag name is explicitly available to ingress controllers. The field is omitempty and +optional, making it fully backward compatible.

  • 🎁 Add Tag field to IngressRule struct

Context

In knative-extensions/net-gateway-api#931, we attempted to add a tag label to HTTPRoute by reverse-parsing the hostname using the tag template. However, since the tag template format is highly configurable, this approach turned out to be fragile. We concluded that the upstream IngressRule should carry the tag name explicitly rather than relying on hostname heuristics.

/kind api-change

Release Note

Add `Tag` field to `IngressRule` to propagate traffic tag metadata to downstream ingress controllers, improving observability of generated resources such as HTTPRoute.

Docs

N/A

@knative-prow knative-prow bot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 9, 2026
@knative-prow
Copy link

knative-prow bot commented Mar 9, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kahirokunn
Once this PR has been reviewed and has the lgtm label, please assign skonto for approval. For more information see the 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

@knative-prow knative-prow bot requested review from dsimansk and skonto March 9, 2026 07:10
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.33%. Comparing base (965e7c3) to head (e6f4518).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1116   +/-   ##
=======================================
  Coverage   93.33%   93.33%           
=======================================
  Files          35       35           
  Lines        1005     1005           
=======================================
  Hits          938      938           
  Misses         53       53           
  Partials       14       14           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kahirokunn kahirokunn force-pushed the add-tag-field-to-ingress-rule branch from 045dd9a to 2e37714 Compare March 9, 2026 09:07
Allow downstream ingress controllers to propagate traffic tag metadata
(e.g. as labels on HTTPRoute/HTTPProxy), improving observability and
enabling tag-based extension controllers.

Signed-off-by: kahirokunn <okinakahiro@gmail.com>
@kahirokunn kahirokunn force-pushed the add-tag-field-to-ingress-rule branch from 2e37714 to e6f4518 Compare March 9, 2026 09:14
@linkvt
Copy link

linkvt commented Mar 9, 2026

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 9, 2026
@kahirokunn
Copy link
Member Author

Thanks for the review! I did run ./hack/update-codegen.sh before pushing.

Happy to wait for @dprotaso's review on the overall direction. The corresponding serving PR is knative/serving#16437 for reference.

@dprotaso
Copy link
Member

dprotaso commented Mar 9, 2026

Talking in slack - I'm wondering if it's simpler to have a separate KIngress resource for the route tag. Then if the annotations of these resources would propagate over the child resources automatically. I think this would then work for all net-* implementations (as long as they are propagating annotations)

An additional benefit of this split is that the ingress resource should remain 'stable' (unchanged) as we make other route updates.

/hold

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 9, 2026
@kahirokunn kahirokunn marked this pull request as draft March 10, 2026 12:24
@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 10, 2026
@kahirokunn
Copy link
Member Author

We will handle this through another method, so we are closing this ticket.
knative/serving#16439

@kahirokunn kahirokunn closed this Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants