Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@stevesloka
Copy link
Member

Fixes #2437 by setting the SNI for the request with the following rules:

  1. If the requestHeadersPolicy.set.Host is set on the service
  2. If the requestHeadersPolicy.set.Host is set on the route
  3. If an externalName is defined

//cc @jeremyrickard

Signed-off-by: Steve Sloka [email protected]

@jeremyrickard
Copy link

Thank you @stevesloka! It was nice to review this as I was walking through the code base to determine how to implement this. Thanks for the quick turn around!

@codecov
Copy link

codecov bot commented Apr 16, 2020

Codecov Report

Merging #2442 into master will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2442      +/-   ##
==========================================
+ Coverage   76.67%   76.75%   +0.07%     
==========================================
  Files          68       68              
  Lines        5506     5515       +9     
==========================================
+ Hits         4222     4233      +11     
+ Misses       1187     1186       -1     
+ Partials       97       96       -1     
Impacted Files Coverage Δ
internal/dag/dag.go 93.15% <ø> (ø)
internal/dag/builder.go 91.02% <100.00%> (+0.10%) ⬆️
internal/envoy/cluster.go 100.00% <100.00%> (ø)
internal/dag/cache.go 95.98% <0.00%> (+0.72%) ⬆️

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 f43dfa9...efdb0f9. Read the comment docs.

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

Like the approach, just would like more explanation of what's happening in the godocs.

ResponseHeadersPolicy *HeadersPolicy

// SNI describes how the SNI is set on a Cluster
SNI string
Copy link
Member

Choose a reason for hiding this comment

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

I think this could use a little explanation of how the field works.

What happens when it's set?

What happens when it's the empty string?

It seems from the rest of the code that if it's not set having the field be present does nothing, it would be good to have that contract explicitly stated here.

A link to the Envoy docs or something would maybe do as well.

Copy link
Member

Choose a reason for hiding this comment

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

That's great, thanks.

return routes
}

// determineSNI decides what the SNI should be on the request
Copy link
Member

Choose a reason for hiding this comment

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

Some explanation of what happens where there should be no SNI on the request would be good.

Copy link
Member

@youngnick youngnick left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the changes.

@stevesloka stevesloka merged commit 7f08726 into projectcontour:master Apr 20, 2020
@stevesloka stevesloka deleted the rewriteSNI branch April 20, 2020 15:04
@jpeach jpeach added this to the 1.5.0 milestone May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExternalName proxying uses external service name for SNI

4 participants