Uh oh!
There was an error while loading. Please reload this page.
Use Route traffic for Knative DomainMappings - #16685
Conversation
Signed-off-by: kahirokunn <okinakahiro@gmail.com>
[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 #16685 +/- ##
==========================================
- Coverage 80.29% 80.25% -0.04%
==========================================
Files 217 218 +1 Lines 13560 13682 +122 ==========================================
+ Hits 10888 10981 +93 - Misses 2309 2330 +21 - Partials 363 371 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
@dprotaso@Cali0707@dsimansk Hello. Would you mind leaving a review? 🙏 There is an ongoing discussion about ExternalName in #11821 . Removing ExternalName could make DomainMapping work without this change, but this PR Thank you 🙇♂️ |
Fixesknative-extensions/net-gateway-api#961
Fixes#14872
Proposed Changes
Copy the first matching cluster-local HTTP paths from a referenced Knative Service or Route into the DomainMapping Ingress, while preserving its last-known-good configuration when the source is unavailable.
Before and after
This DomainMapping exposes the Knative Service
websiteasapp.example.com:Before this change, requests were sent through
Service/website, which points to the cluster-local ingress:The Ingress created by the Route controller already names the backend Services and their percentages. The DomainMapping controller now copies those HTTP paths:
Service/website-00001andService/website-00002are Kubernetes Services that can be used as HTTPRoute backendRefs.Generated Ingress
For a Route that sends 80% of requests to
website-00001and 20% towebsite-00002, the relevant part of the Ingress for the DomainMapping is:The copied paths do not set
rewriteHostbecause requests now go to the backend Services instead of re-entering the cluster-local ingress. The controller addsK-Original-Host: app.example.comand keeps the headers set by the Route controller. It also keeps each backend port, including port 443 whensystem-internal-tlsis enabled.Reconciliation
For a Knative Service or Route reference, the controller:
K-Original-Host; and removesrewriteHost.The Route controller owns validation of the source Ingress. DomainMapping does not add separate validation for empty paths or backends; it copies the first matching rule as produced by the Route controller. A matching rule with
http: nilis reported as a reconciliation error instead of being dereferenced.When the source cannot be used, the controller does not create or update the DomainMapping Ingress. If a previously configured Ingress exists, it is left unchanged as the last-known-good configuration.
ReferenceResolved=False, reasonResolveFailed;IngressReady=Unknown, reasonIngressNotConfiguredIngressReady=Unknown, reasonIngressNotConfiguredIngressReady=False, reasonNotOwnedIngressReady=Unknown, reasonIngressNotConfiguredhttp: nilInternalErroreventWhen the DomainMapping itself is deleted, Kubernetes garbage collection removes its Ingress through the owner reference. Long DomainMapping names continue to use a deterministic, Kubernetes-safe child Ingress name.
Compatibility
Requests for a Knative Service or Route no longer pass through the target Route's cluster-local Ingress.
There are no API schema changes or new condition types.