Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle the case when ingress name has dot #532

Merged

Conversation

ZhiminXiang
Copy link

Fixes #
#514

Release Note

Fix the incorrect Gateway name format for DomainMapping auto TLS feature for Istio implmenetation

@ZhiminXiang ZhiminXiang requested a review from a team as a code owner March 2, 2021 19:11
@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 2, 2021
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 2, 2021
@ZhiminXiang
Copy link
Author

/assign @nak3 @tcnghia

@codecov
Copy link

codecov bot commented Mar 2, 2021

Codecov Report

Merging #532 (8b4bf3e) into main (713aacd) will increase coverage by 0.10%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #532      +/-   ##
==========================================
+ Coverage   81.43%   81.54%   +0.10%     
==========================================
  Files          15       15              
  Lines        1018     1024       +6     
==========================================
+ Hits          829      835       +6     
  Misses        110      110              
  Partials       79       79              
Impacted Files Coverage Δ
pkg/reconciler/ingress/resources/gateway.go 85.63% <100.00%> (+0.47%) ⬆️

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 713aacd...8b4bf3e. Read the comment docs.

// We directly copy this function instead of importing it into vendor and using it because
// if this function is changed in the upstream (for example, Istio allows the dot in the future), we don't want to
// import the change without awareness because it could break the compatibility of Gateway name generation.
func isDNS1123Label(value string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

I think technically we can either use istio one or k8s one.

But I am inclined to copy the function into this repo because if there is any change to this function in the upstream (e.g. allowing dot in the future), then the gateway name could be changed implicitly and we may not be aware of this.
If the version of the function we use in the our code is not compatible with the requirement of Istio or k8s in the future, then our E2E tests should be failed and we will get notice about it. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I get your point, but this is not some random function, it follows RFC 1123. It is not going to change.
Up to you.

Copy link
Contributor

@nak3 nak3 left a comment

Choose a reason for hiding this comment

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

Left a few comments but looks good to me overall.

@@ -304,6 +323,14 @@ func MakeTLSServers(ing *v1alpha1.Ingress, ingressTLS []v1alpha1.IngressTLS, gat
return SortServers(servers), nil
}

func portNamePrefix(prefix, ingressName string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func portNamePrefix(prefix, ingressName string) string {
func portNamePrefix(ingressNamespace, ingressName string) string {

or

Suggested change
func portNamePrefix(prefix, ingressName string) string {
func portNamePrefix(prefix, suffix string) string {

Copy link
Author

Choose a reason for hiding this comment

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

Done

const GatewayHTTPPort = 80
const (
GatewayHTTPPort = 80
DNS1123LabelMaxLength = 63 // Public for testing only.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
DNS1123LabelMaxLength = 63 // Public for testing only.
dns1123LabelMaxLength = 63

I think this is not used for testing 🤔

Copy link
Author

Choose a reason for hiding this comment

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

Done

Base automatically changed from master to main March 4, 2021 16:24
@markusthoemmes markusthoemmes requested a review from a team as a code owner March 4, 2021 16:24
@markusthoemmes markusthoemmes requested a review from a team March 4, 2021 16:24
@markusthoemmes markusthoemmes requested a review from a team as a code owner March 4, 2021 16:24
@markusthoemmes markusthoemmes requested review from fallback-notification-blocker and removed request for a team March 4, 2021 16:24
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-sandbox-net-istio-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/ingress/resources/gateway.go 85.6% 86.2% 0.6

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 6, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nak3

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

The pull request process is described here

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 Mar 6, 2021
@knative-prow-robot knative-prow-robot merged commit eebb4e6 into knative-extensions:main Mar 6, 2021
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants