Skip to content

Add NewProxyAutoTLSTransport and DialTLSWithBackOff to support TLS proxy#2479

Merged
knative-prow[bot] merged 3 commits into
knative:mainfrom
nak3:add-h2-transport
Apr 11, 2022
Merged

Add NewProxyAutoTLSTransport and DialTLSWithBackOff to support TLS proxy#2479
knative-prow[bot] merged 3 commits into
knative:mainfrom
nak3:add-h2-transport

Conversation

@nak3
Copy link
Copy Markdown
Contributor

@nak3 nak3 commented Apr 5, 2022

Part of: knative/serving#12503
PoC: knative/serving#12815

This patch NewProxyAutoTLSTransport which is `NewProxyAutoTransport + TLS config.
Current proxy does not support TLS but it needs for knative/serving#12503.

DialTLSWithBackOff is also DialWithBackOff + TLS config. It needs
newH2Transport which handles HTTP2 with TLS.

/cc @evankanderson @skonto @rhuss

…S proxy

Part of: knative/serving#12503
PoC: knative/serving#12815

This patch `NewProxyAutoTLSTransport` which is `NewProxyAutoTransport + TLS config.
Current proxy does not support TLS but it needs for knative/serving#12503.

`DialTLSWithBackOff` is also `DialWithBackOff` + TLS config. It needs
`newH2Transport` which handles HTTP2 with TLS.
@knative-prow knative-prow Bot requested review from evankanderson, rhuss and skonto April 5, 2022 13:16
@knative-prow knative-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 5, 2022
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 5, 2022

Codecov Report

Merging #2479 (0ffe420) into main (c2f1f3e) will increase coverage by 0.39%.
The diff coverage is 40.54%.

❗ Current head 0ffe420 differs from pull request most recent head 253457e. Consider uploading reports for the commit 253457e to get more accurate results

@@            Coverage Diff             @@
##             main    #2479      +/-   ##
==========================================
+ Coverage   81.32%   81.71%   +0.39%     
==========================================
  Files         163      163              
  Lines        6499     9653    +3154     
==========================================
+ Hits         5285     7888    +2603     
- Misses        981     1529     +548     
- Partials      233      236       +3     
Impacted Files Coverage Δ
network/h2c.go 16.66% <0.00%> (-8.34%) ⬇️
network/transports.go 71.95% <50.00%> (-14.10%) ⬇️
webhook/certificates/resources/secret.go 81.25% <0.00%> (-4.47%) ⬇️
injection/informers.go 64.70% <0.00%> (-4.05%) ⬇️
metrics/workqueue.go 80.82% <0.00%> (-2.90%) ⬇️
apis/duck/v1alpha1/binding_types.go 90.47% <0.00%> (-2.86%) ⬇️
metrics/config.go 75.55% <0.00%> (-2.80%) ⬇️
webhook/certificates/resources/certs.go 58.92% <0.00%> (-2.70%) ⬇️
configmap/hash-gen/main.go 62.96% <0.00%> (-2.50%) ⬇️
apis/duck/v1/podspec_types.go 93.10% <0.00%> (-2.14%) ⬇️
... and 155 more

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 4f42bf4...253457e. Read the comment docs.

@knative-prow knative-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 5, 2022
Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

Do we want the ability to fall back to non-TLS transport during the transition if TLS is refused?

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 5, 2022

I think we don't need it for now. AFAIK, the users, who requested this feature, want to use the strictly secure connection and they will complain about the fall-back feature if we added 😅

@evankanderson
Copy link
Copy Markdown
Member

I think we need a transition plan for "current config" to "always secure". We can end up with any of the following transition scenarios:

  • Insecure activator -> secure queue-proxy
  • Secure activator -> insecure queue-proxy

I think we want to not serve errors during the update process, which means we either need a way to ensure we know the ordering, or have the ability to fall back to insecure during the transition and then "lock the gate" with a second config change

Full disclosure: I'd like to turn this on for every Knative user, all the time, in some future release.

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 7, 2022

I see. In this case, knative/serving#12815 supports

  • Insecure activator -> secure queue-proxy

and so we should ensure the ordering?
Opening both HTTP and HTTPS on queue-proxy is easy to support (actually knative/serving#12815 does) so I am prefer to it rather than adding the ability to fall back to insecure.

Just in case, I verified the scinario Insecure activator -> secure queue-proxy works fine as nak3/serving#41

@nader-ziada
Copy link
Copy Markdown
Member

does this PR need to get in before we cut pkg - 1.4 on April 12th?

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 7, 2022

Yes, I hope so...

ping @evankanderson @rhuss @skonto could you please review this?

@evankanderson
Copy link
Copy Markdown
Member

I see. In this case, knative/serving#12815 supports

  • Insecure activator -> secure queue-proxy

and so we should ensure the ordering?
Opening both HTTP and HTTPS on queue-proxy is easy to support (actually knative/serving#12815 does) so I am prefer to it rather than adding the ability to fall back to insecure.

Just in case, I verified the scinario Insecure activator -> secure queue-proxy works fine as nak3/serving#41

If you want to enforce the ordering, there needs to be a way to enable the queue-proxy serving on both ports while the activator is still only expecting http traffic. What's the configuration that enables that?

(The same problem applies with ingress -> activator, BTW)

@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 8, 2022

I implemented current PRs in serving repos as queue-proxy serves on both ports when certs are deployed. So, actually there is no way to disable to serve HTTP port at the alpha stage. But I think it is fine because the HTTP port is not used when activator initiates the HTTPs request.

The ingress -> activator is same. Activator serves on both HTTP and HTTPS ports.

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

A few more comments, but most should be straightforward.

Comment thread network/transports.go
Comment thread network/transports_test.go Outdated
bo.Steps = 2

// Timeout. Use special testing IP address.
c, err = dialBackOffHelper(context.Background(), "tcp4", "198.18.0.254:8888", bo, tlsConf)
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.

Could this use a localhost address rather than some Internet IP?

Alternately, use one of the documentation IP ranges so our tests aren't accidentally hitting a real IP.

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.

(i.e. use 127.200.100.10:8888)

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.

Another PR #2402 is changing it now (and it seems we need a little bit big change for this) so I leave it as it is.

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.

My concern was that this is a real IP owned by Oracle, but I'm not going to block this PR on it.

Comment thread network/transports_test.go Outdated
Comment thread network/transports_test.go Outdated
Comment thread network/transports_test.go Outdated
Comment thread network/transports_test.go
@nak3
Copy link
Copy Markdown
Contributor Author

nak3 commented Apr 8, 2022

Thank you! Updated.

Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

bo.Steps = 2

// Timeout. Use special testing IP address.
c, err = dialBackOffHelper(context.Background(), "tcp4", "198.18.0.254:8888", bo, tlsConf)
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.

My concern was that this is a real IP owned by Oracle, but I'm not going to block this PR on it.

@knative-prow knative-prow Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 11, 2022
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented Apr 11, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson, nak3

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 knative-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 11, 2022
@knative-prow knative-prow Bot merged commit ca82d2b into knative:main Apr 11, 2022
@nak3 nak3 deleted the add-h2-transport branch April 11, 2022 08:50
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants