Skip to content

Reconcile DomainMappings to Ingress - #9735

Merged
knative-prow-robot merged 5 commits into
knative:masterfrom
julz:domainmappingreconciler
Oct 8, 2020
Merged

knative-prow-robot merged 5 commits into
knative:masterfrom
julz:domainmappingreconciler

Conversation

@julz

@julz julz commented Oct 8, 2020

Copy link
Copy Markdown
Contributor

Second part of #9713.

Reconciles DomainMappings to Ingresses. In the interests of keeping this PR small(-ish 😅) this only handles reconciling downwards, next PR will propagate the ingress status back up to the DomainMapping.

Also for now this assumes the target ref is a KSvc such that we can get the URL via {ref.name}.{ref.namespace}.svc.cluster.local (we also need that to be sure there's a k8s service for the target anyway). See #9713 for other todos.

/assign @mattmoor @dprotaso

@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 8, 2020
@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. area/API API objects and controllers labels Oct 8, 2020
@julz julz mentioned this pull request Oct 8, 2020
13 of 14 tasks
@codecov

codecov Bot commented Oct 8, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #9735 into master will decrease coverage by 0.24%.
The diff coverage is 60.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9735      +/-   ##
==========================================
- Coverage   87.98%   87.74%   -0.25%     
==========================================
  Files         179      180       +1     
  Lines        8457     8492      +35     
==========================================
+ Hits         7441     7451      +10     
- Misses        772      792      +20     
- Partials      244      249       +5     
Impacted Files Coverage Δ
...g/apis/serving/v1alpha1/domainmapping_lifecycle.go 66.66% <0.00%> (-33.34%) ⬇️
pkg/apis/serving/v1alpha1/domainmapping_types.go 100.00% <ø> (ø)
pkg/reconciler/domainmapping/controller.go 0.00% <0.00%> (ø)
pkg/reconciler/domainmapping/reconciler.go 71.87% <71.87%> (ø)
pkg/reconciler/domainmapping/resources/ingress.go 100.00% <100.00%> (ø)
pkg/reconciler/autoscaling/kpa/scaler.go 88.57% <0.00%> (-1.43%) ⬇️
cmd/controller/main.go

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 d0dcbd1...beb18d1. Read the comment docs.

@knative-test-reporter-robot

Copy link
Copy Markdown

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-istio-stable-no-mesh-tls 0/3

Failed non-flaky tests preventing automatic retry of pull-knative-serving-istio-stable-no-mesh-tls:

test/e2e/autotls.TestTLS
test/e2e/autotls.TestTLS/http01

@julz

julz commented Oct 8, 2020

Copy link
Copy Markdown
Contributor Author

/retest

// DomainMappingSpec describes the DomainMapping the user wishes to exist.
type DomainMappingSpec struct {
// Ref points to an Addressable.
// Currently, Ref must be a KSvc.

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.

Why?

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 see the other comment, in practice I think it works with more than that, but this should be pretty easy to resolve more broadly (assuming the addressable doesn't use the path part, and implements our dataplane contract).

Comment seems fine for now, we should just be sure we clean it up 😅

@julz julz Oct 8, 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 guess I'm a little conservative with the comment here - undercommit and overdeliver etc ;) Supporting arbitrary addressables is in the todo list in the tracking issue.

Comment on lines +37 to +40
// This assumes the target is a KSvc. To support arbitrary addressables
// we will need to resolve the reference to a URL in the same way that
// eventing does.
targetHostName := targetServiceName + "." + targetServiceNamespace + ".svc.cluster.local"

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.

This would work with any service that implements our dataplane probe, it just makes an assumption about how URIs are resolved. I assume you know about the URI resolved in knative.dev/pkg?

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.

Wasn't suggesting for this PR btw, just hoping to save you time if you didn't.

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.

I didn't but I assumed I'd find something along those lines when the time came :D

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

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.

Yah, TIL you can change cluster.local - cool! Will fix that tmr

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.

🤔 if we can do this with KinD, then we probably should try varying that across our KinD matrix 🤩

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.

Visibility: netv1alpha1.IngressVisibilityExternalIP,
HTTP: &netv1alpha1.HTTPIngressRuleValue{
Paths: []netv1alpha1.HTTPIngressPath{{
RewriteHost: targetHostName,

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 also set the vanity domain in this header:

OriginalHostHeader = "K-Original-Host"

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.

d'oh, yeah, good point, forgot that, one sec

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

@vagababov vagababov 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 Oct 8, 2020
}

type DomainMappingOption func(dm *v1alpha1.DomainMapping)
type domainMappingOption func(dm *v1alpha1.DomainMapping)

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.

The linter is unhappy with this change :(

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.

sigh. Guess I should lowercase the other functions to match

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.

..that should do it

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.

😁

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 8, 2020
@vagababov

Copy link
Copy Markdown
Contributor

/lgtm

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

@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

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 Oct 8, 2020
@knative-prow-robot
knative-prow-robot merged commit 2a66a50 into knative:master Oct 8, 2020
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants