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) refactor SDS to go-control-plane building blocks #721

Merged
merged 3 commits into from
May 11, 2020

Conversation

jakubdyszkiewicz
Copy link
Contributor

Summary

This PR refactors SDS to use the same patterns as our XDS implementation.

Until now, SDS was custom implementation operating on raw Envoy protos.
The problem with this implementation is that

  1. It's hard to build logic on top of it
  2. We generate a certificate on every stream request. Example:
    DP has 1000 outbound listeners. Since it is mTLS, we have to configure every outbound listener with DP cert and CA cert. Every DP will open 2000 streams (one for CA, one for DP cert) and send a request on every stream. This will generate 1000 certs for one DP instead of one.

Given that there can be thousands of such dataplanes and CA can be external system, we can overload the system with generating millions of certs.

In this implementation we use SnapshotCache from go-control-plane which will store the same cert for subsequent requests, so we only generate 1 certificate per Dataplane.

This will also helps us to solve #719

@jakubdyszkiewicz jakubdyszkiewicz requested a review from a team May 6, 2020 11:49
Copy link
Contributor

@lobkovilya lobkovilya left a comment

Choose a reason for hiding this comment

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

Some minor comments

pkg/sds/server/auth_callbacks.go Outdated Show resolved Hide resolved
pkg/sds/server/auth_callbacks.go Outdated Show resolved Hide resolved
pkg/sds/server/auth_callbacks.go Outdated Show resolved Hide resolved
pkg/sds/server/auth_callbacks.go Outdated Show resolved Hide resolved
pkg/sds/server/reconciler.go Show resolved Hide resolved
pkg/sds/server/reconciler.go Outdated Show resolved Hide resolved

parts := strings.Split(currentSnapshot.GetVersion(envoy_resource.SecretType), "-")
if len(parts) != 2 {
return false, errors.New(`invalid snapshot version format. Format should be "UnixNano-NameOfTheCA"`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way cache contains snapshots with invalid version format? From what I see we generate it ourselves in generateSnapshot. That might simplify signature of shouldGenerateSnapshot and get rid of error in return values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, unless someone connects to the control plane and explicitly set the version. Or we change it in the future and it won't be compatible with current format.

But let's say it should not happen. What is the alternative? Panic or ignore the error?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to protect ourselves from our future changes in the format, then it feels more like panic. But that's really minor comment, so up to you :)

pkg/plugins/resources/memory/store.go Show resolved Hide resolved
pkg/sds/server/auth_callbacks.go Show resolved Hide resolved
pkg/sds/server/auth_callbacks.go Outdated Show resolved Hide resolved
@jakubdyszkiewicz jakubdyszkiewicz merged commit 6bbf9aa into master May 11, 2020
@lahabana lahabana deleted the sds-cache branch December 2, 2021 10:48
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