Skip to content

Properly resolve DomainMapping references - #10167

Merged
knative-prow-robot merged 4 commits into
knative:masterfrom
julz:domainmappingarbitrary
Nov 20, 2020
Merged

knative-prow-robot merged 4 commits into
knative:masterfrom
julz:domainmappingarbitrary

Conversation

@julz

@julz julz commented Nov 20, 2020

Copy link
Copy Markdown
Contributor

Moar of #9713 .

Correctly uses pkg/resolver to resolve spec.Ref to URL, which also means we now get nice condition failures if the target ksvc doesn't exist rather than the ingress just failing to probe. I think this should also let us relax the must-be-ksvc validation requirement in a follow-on PR.

/assign @mattmoor @vagababov

@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Nov 20, 2020
@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 20, 2020
@knative-prow-robot knative-prow-robot added the area/API API objects and controllers label Nov 20, 2020
@codecov

codecov Bot commented Nov 20, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #10167 (a100d56) into master (7552ab7) will decrease coverage by 0.03%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10167      +/-   ##
==========================================
- Coverage   88.07%   88.04%   -0.04%     
==========================================
  Files         184      184              
  Lines        8603     8621      +18     
==========================================
+ Hits         7577     7590      +13     
- Misses        785      789       +4     
- Partials      241      242       +1     
Impacted Files Coverage Δ
pkg/reconciler/domainmapping/controller.go 0.00% <0.00%> (ø)
pkg/reconciler/domainmapping/resources/ingress.go 100.00% <ø> (ø)
pkg/reconciler/domainmapping/reconciler.go 88.57% <100.00%> (+3.11%) ⬆️
pkg/reconciler/autoscaling/kpa/scaler.go 88.57% <0.00%> (-1.43%) ⬇️
pkg/autoscaler/statforwarder/forwarder.go 81.38% <0.00%> (-1.07%) ⬇️
pkg/activator/net/revision_backends.go 90.49% <0.00%> (-0.91%) ⬇️
pkg/reconciler/route/traffic/rollout.go 100.00% <0.00%> (ø)
pkg/reconciler/route/reconcile_resources.go 86.00% <0.00%> (+2.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7552ab7...a100d56. Read the comment docs.

@julz

julz commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

/test pull-knative-serving-istio-stable-no-mesh-tls

@julz julz mentioned this pull request Nov 20, 2020
13 of 14 tasks
@mattmoor

Copy link
Copy Markdown
Contributor

I think this should also let us relax the must-be-ksvc validation requirement in a follow-on PR

When you do, we should be able to write an e2e test that simply uses a K8s service.

@julz

julz commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

When you do, we should be able to write an e2e test that simply uses a K8s service.

Yeps, willdo

Comment on lines +84 to +88
// Resolve the spec.Ref to a URI following the Addressable contract.
target, err := r.resolveRef(ctx, dm)
if err != nil {
return err
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should error out if the target has a Path (e.g. the MT Broker)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 done

@mattmoor mattmoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the only comments I have are erroring out on edge cases that are possible, but we don't support today:

  1. Addressables that return a Path (e.g. MT Broker)
  2. Addressables that return a Service that isn't name.namespace (e.g. IMC IIRC)

Comment on lines 33 to 36
var (
targetServiceName = dm.Spec.Ref.Name
targetServiceNamespace = dm.Spec.Ref.Namespace
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think in the short term we should change this to parse the URL and error out if it doesn't end with network.GetClusterDomainSuffix() (or w/e we called that).

In the longer term, I think we may need to create an ExternalName service when that doesn't match, but it will be hard to test...

@julz julz Nov 20, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, I think for this PR we still require ksvc so this is ok, when we relax the validation we need to worry about stuff that doesn't already have a matching service etc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

.. either way, added some validation for now

@mattmoor mattmoor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 20, 2020
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: julz, mattmoor

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

The pull request process is described 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-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 20, 2020
@julz

julz commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

/test pull-knative-serving-istio-stable-no-mesh-tls

@knative-prow-robot
knative-prow-robot merged commit 9561af9 into knative:master Nov 20, 2020
nak3 pushed a commit to nak3/serving that referenced this pull request Jan 21, 2021
* Properly resolve DomainMapping references

* lint

* error if resolved address contains a path

* check resolved URI is in .svc.cluster.local
nak3 pushed a commit to nak3/serving that referenced this pull request Jan 21, 2021
* Properly resolve DomainMapping references

* lint

* error if resolved address contains a path

* check resolved URI is in .svc.cluster.local
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/API API objects and controllers cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants