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

fix(kuma-cp) use cmux for MADS server #1887

Merged
merged 4 commits into from Apr 27, 2021
Merged

fix(kuma-cp) use cmux for MADS server #1887

merged 4 commits into from Apr 27, 2021

Conversation

lobkovilya
Copy link
Contributor

Summary

The existing approach of multiplexing GRPC and HTTP/1.1 on the same port doesn't work without TLS. Instead, library cmux works pretty well, that's why current PR replaces the existing approach with cmux.

Change default version of MADS API to v1alpha1 because of #1886

Full changelog

  • add new library cmux
  • unit tests for MADS server
  • change default version of MADS API to v1alpha1

Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
@lobkovilya lobkovilya requested a review from a team as a code owner April 27, 2021 10:45
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz left a comment

Choose a reason for hiding this comment

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

nice! 👏

pkg/mads/server/server.go Outdated Show resolved Hide resolved
pkg/mads/server/server.go Outdated Show resolved Hide resolved
pkg/mads/server/server_test.go Outdated Show resolved Hide resolved
pkg/mads/server/server_test.go Outdated Show resolved Hide resolved
pkg/plugins/ca/builtin/config/builtin_ca_config.pb.go Outdated Show resolved Hide resolved
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
Signed-off-by: Ilya Lobkov <ilya.lobkov@konghq.com>
@@ -0,0 +1,140 @@
package server_test
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for this nice test!

@lobkovilya lobkovilya merged commit 2d66396 into master Apr 27, 2021
@lobkovilya lobkovilya deleted the fix/mads-server branch April 27, 2021 14:14
@austince
Copy link
Contributor

Should we add the same to the dp-server @lobkovilya?

if request.ProtoMajor == 2 && strings.Contains(request.Header.Get("Content-Type"), "application/grpc") {
d.grpcServer.ServeHTTP(writer, request)
} else {
// we only want to measure HTTP not GRPC requests because they can mess up metrics
// for example ADS bi-directional stream counts as one really long request
std.Handler("", d.promMiddleware, d.httpMux).ServeHTTP(writer, request)
}

Or is this always run with TLS so it doesn't matter?

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

4 participants