feat: create per-tag KIngress resources instead of a single KIngress per Route#16439
feat: create per-tag KIngress resources instead of a single KIngress per Route#16439kahirokunn wants to merge 8 commits intoknative:mainfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kahirokunn 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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #16439 +/- ##
==========================================
+ Coverage 80.16% 80.27% +0.10%
==========================================
Files 217 217
Lines 13503 13661 +158
==========================================
+ Hits 10825 10966 +141
- Misses 2310 2326 +16
- Partials 368 369 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
780d593 to
ebfaf55
Compare
6fd19b3 to
99fc0ea
Compare
…per Route Instead of consolidating all traffic tags into one KIngress, the Route reconciler now creates individual KIngress resources for each traffic tag. Each per-tag KIngress is labeled with networking.internal.knative.dev/tag to identify which tag it serves. This enables independent lifecycle management and status tracking per tag. Signed-off-by: kahirokunn <okinakahiro@gmail.com>
99fc0ea to
94567d0
Compare
…tag functions Address review feedback to separate ingress creation into distinct methods: - MakeDefaultIngressWithRollout: builds the default ingress with explicit rollout - MakeRouteTagIngress: builds per-tag ingress (rollout derived internally) - MakeIngressWithRollout: remains as orchestrator delegating to buildTagIngress This makes it clear at the API level that rollout is primarily a concern of the default ingress. Also extracts buildACMEPathsByHost and rolloutForTag as reusable helpers. Signed-off-by: kahirokunn <okinakahiro@gmail.com>
…g value The default ingress was labeled with `networking.internal.knative.dev/tag: ""` which conflates "no tag" with "empty string tag." Now only per-tag ingresses carry the TagLabelKey label, making label selectors cleaner for operators. The ingressByTag map logic in route.go is unaffected since Go's map zero-value for a missing key is "" which matches traffic.DefaultTarget. Signed-off-by: kahirokunn <okinakahiro@gmail.com>
…resses Replace MakeIngress (full spec construction) with DesiredIngressNames (name-only computation) in Pass 1, and replace MakeIngressWithRollout orchestrator with direct MakeDefaultIngressWithRollout + MakeRouteTagIngress calls in Pass 2. This eliminates unnecessary spec construction in Pass 1, removes the need for the empty-targets guard in the reconciler path, and connects the split functions introduced in the previous commit. Signed-off-by: kahirokunn <okinakahiro@gmail.com>
8819fec to
5809c57
Compare
The reconciler now calls MakeDefaultIngressWithRollout and MakeRouteTagIngress directly, so the fallback that created a default ingress for empty tc.Targets was unreachable. Remove it and fix tests that relied on passing empty traffic.Config. Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Co-authored-by: Dave Protasowski <dprotaso@gmail.com>
… reconcileIngresses
Address review feedback from dprotaso (round 2):
- Fix build error: slices.Sort → slices.Sorted, add maps/slices imports
- Limit rollout annotation to the default ingress only; tag ingresses
no longer carry rollout annotations since rollout state (gradual
traffic shifting) is a concern of the default ingress only
- Store full rollout (all tags) in the default ingress annotation
instead of per-tag filtered subsets
- Restructure reconcileIngresses into 3 clear phases:
Phase 1: build default ingress with rollout (read prevRO from
default ingress only)
Phase 2: build per-tag ingresses (no rollout annotation)
Phase 3: upsert all desired ingresses, then clean up orphans
- Move ingressByTag map construction from route.go into
updatePlaceholderServices (signature change: map → slice)
- Remove dead len(ingresses) > 0 guard in ReconcileKind
- Remove unused rolloutForTag helper
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
599dfd1 to
5f813e6
Compare
|
Circling back on this - given that we have route tag header based routing - splitting the KIngress doesn't buy us much. I think ultimately I'd rather keep things really simple and go back to your prior approach - but instead of modifying the CRD I think a simple annotation mapping tags to host names would suffice. |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Following discussions on Slack, we will adopt this option. |
Depends on knative/networking#1120 (must be merged first).
Proposed Changes
Create individual KIngress resources per traffic tag instead of bundling all tags into a single KIngress. Each per-tag KIngress is labeled with
networking.internal.knative.dev/tag.MakeIngressnow returns[]*Ingress(one per tag)reconcileIngresswithreconcileIngresses(with orphan cleanup)Release Note
Testing
Manually verified the behavior by deploying a Route with multiple traffic tags.
With tag
Without tag
Tag Header Base Routing is also working properly.