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

test(conformance): tls conformance test enabled #3797

Closed
wants to merge 10 commits into from

Conversation

mlavacca
Copy link
Member

@mlavacca mlavacca commented Mar 22, 2023

What this PR does / why we need it:

Which issue this PR fixes:

Fixes #3678

Special notes for your reviewer:

We had TLSRoute integration tests with both Passthrough and terminate, but KIC currently supports Passthrough only due to an upstream docs inconsistency.
The integration test with terminate was actually using a gateway with passthrough (we were not really testing the terminate mode). For this reason, the integration test with terminate has been removed, and the one with Passthrough has been massively improved.

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR

@pmalek
Copy link
Member

pmalek commented May 16, 2023

@mlavacca Do we still need this 🤔 ?

@mlavacca
Copy link
Member Author

@mlavacca Do we still need this 🤔 ?

Yes, we do. I didn't manage to find time for it, I'll get back to it quite soon

@rainest
Copy link
Contributor

rainest commented Jul 14, 2023

@mlavacca it looks like this got sidelined again. I was going to try and pick it up but wasn't sure what was remaining or exactly what was broken before. Can you explain what the change was trying to do?

It looks like we can't actually satisfy the conformance test in KIC alone. It requires serving the TLSRoute on port 443, whereas the test instance has hardcoded HTTPS listens on 443 and stream TLS listens on 8899. We get the validation test cert on 443 (not entirely sure where the config setting that is, but we do) and the passthrough cert (what this test wants) on 8899:

17:07:59-0700 esenin $ openssl s_client -connect 172.18.0.102:8899 -servername abc.example.com -showcerts < /dev/null | openssl x509 -text | grep -A1 Alternative
depth=0 O = Acme Co, CN = default
verify error:num=18:self-signed certificate
verify return:1
depth=0 O = Acme Co, CN = default
verify return:1
DONE
            X509v3 Subject Alternative Name: 
                DNS:abc.example.com

17:09:11-0700 esenin $ openssl s_client -connect 172.18.0.102:443 -servername abc.example.com -showcerts < /dev/null | openssl x509 -text | grep -A1 Alternative 
depth=0 O = Acme Co, CN = default
verify error:num=18:self-signed certificate
verify return:1
depth=0 O = Acme Co, CN = default
verify return:1
DONE
            X509v3 Subject Alternative Name: 
                DNS:*, DNS:*.org

I'm not positive we violate conformance there (the spec probably does want support for both HTTPS and TLS on the same port), but I am fairly certain that the gateway can only serve stream routes on stream listens.

We could satisfy the test (since it only has the one listen and doesn't need both HTTPS and TLS on the same port) with the operator dynamically provisioning kong.conf listen configuration, but we can't satisfy it with the static config we use in the KIC tests. We should probably still add whatever improvement was proposed here, but it won't actually help with that test.

@mlavacca
Copy link
Member Author

@mlavacca it looks like this got sidelined again. I was going to try and pick it up but wasn't sure what was remaining or exactly what was broken before. Can you explain what the change was trying to do?

It looks like we can't actually satisfy the conformance test in KIC alone. It requires serving the TLSRoute on port 443, whereas the test instance has hardcoded HTTPS listens on 443 and stream TLS listens on 8899. We get the validation test cert on 443 (not entirely sure where the config setting that is, but we do) and the passthrough cert (what this test wants) on 8899:

17:07:59-0700 esenin $ openssl s_client -connect 172.18.0.102:8899 -servername abc.example.com -showcerts < /dev/null | openssl x509 -text | grep -A1 Alternative
depth=0 O = Acme Co, CN = default
verify error:num=18:self-signed certificate
verify return:1
depth=0 O = Acme Co, CN = default
verify return:1
DONE
            X509v3 Subject Alternative Name: 
                DNS:abc.example.com

17:09:11-0700 esenin $ openssl s_client -connect 172.18.0.102:443 -servername abc.example.com -showcerts < /dev/null | openssl x509 -text | grep -A1 Alternative 
depth=0 O = Acme Co, CN = default
verify error:num=18:self-signed certificate
verify return:1
depth=0 O = Acme Co, CN = default
verify return:1
DONE
            X509v3 Subject Alternative Name: 
                DNS:*, DNS:*.org

I'm not positive we violate conformance there (the spec probably does want support for both HTTPS and TLS on the same port), but I am fairly certain that the gateway can only serve stream routes on stream listens.

We could satisfy the test (since it only has the one listen and doesn't need both HTTPS and TLS on the same port) with the operator dynamically provisioning kong.conf listen configuration, but we can't satisfy it with the static config we use in the KIC tests. We should probably still add whatever improvement was proposed here, but it won't actually help with that test.

Yes, this was my figuring as well before putting this one aside. I'd like to revamp it and see if what is introduced here is still needed and figure out how we can dynamically configure Kong ports to make this test pass. This is in the 2.11 milestone, hence has quite a high priority now.

@mlavacca mlavacca force-pushed the mlavacca/conformance/tlsroute branch from c3a20ee to 5590f46 Compare July 26, 2023 15:15
@pull-request-size pull-request-size bot added size/M and removed size/S labels Jul 26, 2023
@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Patch coverage: 67.5% and project coverage change: -0.2% ⚠️

Comparison is base (6006cab) 68.4% compared to head (7839338) 68.3%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #3797     +/-   ##
=======================================
- Coverage   68.4%   68.3%   -0.2%     
=======================================
  Files        162     162             
  Lines      19017   19040     +23     
=======================================
- Hits       13023   13012     -11     
- Misses      5227    5263     +36     
+ Partials     767     765      -2     
Files Changed Coverage Δ
internal/controllers/gateway/gateway_controller.go 56.2% <63.6%> (-1.2%) ⬇️
internal/manager/config.go 95.1% <100.0%> (+<0.1%) ⬆️
internal/manager/controllerdef.go 98.8% <100.0%> (+<0.1%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 28, 2023
@pmalek pmalek added the area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API label Jul 31, 2023
@pmalek pmalek added this to the KIC v2.11.0 milestone Jul 31, 2023
@pull-request-size pull-request-size bot added size/M and removed size/L labels Aug 1, 2023
@mlavacca mlavacca force-pushed the mlavacca/conformance/tlsroute branch 2 times, most recently from 2295c2a to 44f5dd7 Compare August 1, 2023 08:55
@mlavacca mlavacca force-pushed the mlavacca/conformance/tlsroute branch 3 times, most recently from 4154175 to 1a0d0e6 Compare August 1, 2023 16:11
@mlavacca mlavacca marked this pull request as ready for review August 1, 2023 16:21
@mlavacca mlavacca requested a review from a team as a code owner August 1, 2023 16:21
@mlavacca mlavacca force-pushed the mlavacca/conformance/tlsroute branch from 1a0d0e6 to 076f020 Compare August 1, 2023 16:22
@mlavacca
Copy link
Member Author

mlavacca commented Aug 7, 2023

@rainest you approved but then re-asked yourself for the review. WDYT, can we merge this?

shaneutt
shaneutt previously approved these changes Aug 7, 2023
Copy link
Contributor

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

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

I did some brainstorming on this one with @mlavacca today.

Our dilemma is that we have a static-mode Gateway API implementation in KIC, which means we are basically at odds with the dynamism the tests are expecting from Gateway Listeners (flatly, we can't be dynamic at all we can only be preemptive with Helm chart configuration). There are a few ways we could resolve this, including trying to ask for changes in upstream to either allow the port for the test to be changed dynamically, OR ask for the static port to be changed but these come across as "asking upstream to put in hacks for Kong". I think we should leave such a change upstream off the table.

There are a few different alternatives we thought up to solve this problem, but they all end up being "hack around our static mode limitations", and ultimately they don't deliver on "allowing users to use port 443 for TLSRoute". @mlavacca's solution here of following UDPRoute's example for TLSRoute strikes me as pragmatic, reasonably simple and rooted in precedent (so therefore we're being somewhat consistent) while also avoiding "hacks in upstream". This will be consistent with how we've enabled something like this in the past, and it will actually enable it rather than working around it by changing the port somewhere.

So all things considered, I think this is a reasonable solution.

Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
Signed-off-by: Mattia Lavacca <lavacca.mattia@gmail.com>
@mlavacca mlavacca force-pushed the mlavacca/conformance/tlsroute branch from 66a5df5 to 2da4975 Compare August 24, 2023 12:13
@mlavacca mlavacca added the kind/conformance Conformance to upstream Kubernetes SIG Networking Gateway API label Aug 24, 2023
Co-authored-by: Travis Raines <571832+rainest@users.noreply.github.com>
@mlavacca
Copy link
Member Author

Closing as we'll implement TLS conformance in KGO instead, where Dynamic listener configuration is not an issue as it is in KIC.

@mlavacca mlavacca closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway-api Relating to upstream Kubernetes SIG Networking Gateway API area/tests kind/conformance Conformance to upstream Kubernetes SIG Networking Gateway API on-hold size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gateway API conformance - TLSRoute
7 participants