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

feat(kuma-cp) add Gateway TLS termination support #3044

Merged
merged 1 commit into from
Nov 7, 2021
Merged

feat(kuma-cp) add Gateway TLS termination support #3044

merged 1 commit into from
Nov 7, 2021

Conversation

jpeach
Copy link
Contributor

@jpeach jpeach commented Oct 29, 2021

Summary

Add support for terminating TLS sessions on Gateway listeners. Most of
the eventual TLS configuration is missing, but TLS 1.2 (and greater)
sessions can be terminated with reasonable defaults.

The approach we take in this PR is to add a new generator to build
the filter chain. Since HTTP and HTTPS protocols get different filter
chains, we separate the logic into two protocol-specific builders. HTTPS
listeners get a filter chain for each hostname, but HTTP listeners only
get a single shared filter chain. Unfortunately, this makes the lifetime
of the filter chain builder a little non-obvious.

Currently, both the server certificate and the CA certificate chain
must appear in the TLS secret, but this will change in subsequent PRs
to allow multiple certificates, and separate CA chain secrets.

Full changelog

N/A

Issues resolved

N/A

Documentation

N/A

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Kubernetes

Backwards compatibility

  • Add backport-to-stable label if the code is backwards compatible. Otherwise, list breaking changes.

@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2021

Codecov Report

Merging #3044 (817cd32) into master (06d73bc) will decrease coverage by 0.01%.
The diff coverage is 52.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3044      +/-   ##
==========================================
- Coverage   52.29%   52.27%   -0.02%     
==========================================
  Files         919      922       +3     
  Lines       53116    53353     +237     
==========================================
+ Hits        27777    27892     +115     
- Misses      23116    23236     +120     
- Partials     2223     2225       +2     
Impacted Files Coverage Δ
test/e2e/gateway/gateway_universal.go 0.00% <0.00%> (ø)
test/e2e/trafficroute/testutil/collect.go 0.00% <0.00%> (ø)
test/framework/universal_cluster.go 0.00% <0.00%> (ø)
pkg/tls/parse.go 30.00% <30.00%> (ø)
pkg/core/resources/apis/mesh/gateway_validator.go 92.77% <33.33%> (-2.23%) ⬇️
.../plugins/runtime/gateway/filter_chain_generator.go 76.92% <76.92%> (ø)
pkg/xds/envoy/secrets/v3/server_certificate.go 92.00% <92.00%> (ø)
pkg/plugins/runtime/gateway/generator.go 78.47% <100.00%> (-0.41%) ⬇️
pkg/plugins/runtime/gateway/listener_generator.go 90.32% <100.00%> (-4.13%) ⬇️
pkg/plugins/runtime/gateway/plugin.go 100.00% <100.00%> (ø)
... and 16 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 06d73bc...817cd32. Read the comment docs.

@jpeach jpeach changed the title WIP: gateway tls support feat(kuma-cp) add Gateway TLS termination support Nov 3, 2021
@jpeach jpeach marked this pull request as ready for review November 3, 2021 05:56
@jpeach jpeach requested a review from a team as a code owner November 3, 2021 05:56
Copy link
Contributor

@lahabana lahabana left a comment

Choose a reason for hiding this comment

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

Pretty big PR but the FilterChainGenerators make sense to me.

Add support for terminating TLS sessions on Gateway listeners. Most of
the eventual TLS configuration is missing, but TLS 1.2 (and greater)
sessions can be terminated with reasonable defaults.

The approach we take in this PR is to add a new generator to build
the filter chain. Since HTTP and HTTPS protocols get different filter
chains, we separate the logic into two protocol-specific builders. HTTPS
listeners get a filter chain for each hostname, but HTTP listeners only
get a single shared filter chain. Unfortunately, this makes the lifetime
of the filter chain builder a little non-obvious.

Up to two certificate secrets are supported. Each must contain the
private key, the server certificate and the CA certificate chain.

Signed-off-by: James Peach <james.peach@konghq.com>
@jpeach jpeach merged commit 3bf62a9 into kumahq:master Nov 7, 2021
@jpeach jpeach deleted the feat/gateway-tls-support branch November 7, 2021 21:02
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.

None yet

3 participants