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

v3 migration - clusters, endpoints #1312

Merged
merged 1 commit into from
Dec 16, 2020
Merged

Conversation

jakubdyszkiewicz
Copy link
Contributor

@jakubdyszkiewicz jakubdyszkiewicz commented Dec 14, 2020

Cluster / Endpoints / TLS / Metadata V3 migration

This PR enables generation of V3 config for Cluster and Endpoints

Concept of V3 migration

Most of the go-control-plane V2 imports is in pkg/xds/envoy and are structures are hidden behind builders.
Then, builders are used in proxy generators which don't really care about the actual type, they care that it is a resource that can be added to ResourceSet which will be put into the cache. You will have to now pass the API Version to the builder as a mandatory parameter so the builder can choose which version of the resource it will return.

V2 -> V3 migration will result in the copy-pasting of a massive amount of the code, but at least here it is hidden behind builders, so the copy-paste will be in one place and it will be easy to remove in the future.

Of course, it's not that obvious, V2 imports are spread around a code
image
some of the tricky parts will be

  • maintaining two SnapshotCaches and servers
  • Callbacks that supports V2 and V3
  • proxy template modifications

but here is a good start for the actual V3 config generation

@nickolaev
Copy link
Contributor

So far this approach is great. We'll support v2 and v3 and smoothly migrate.

envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2"
envoy_core_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
envoy_cluster "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
envoy_core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
Copy link
Contributor

Choose a reason for hiding this comment

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

As agreed, let's always use a numbered version of the envoy imports so envoy_core_v3 etc.

Base automatically changed from chore/upgrade-gcp to master December 14, 2020 14:31
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
@jakubdyszkiewicz jakubdyszkiewicz changed the title concept of v3 migration - clusters v3 migration - clusters, endpoints Dec 15, 2020
@jakubdyszkiewicz jakubdyszkiewicz marked this pull request as ready for review December 15, 2020 08:51
@jakubdyszkiewicz jakubdyszkiewicz requested a review from a team as a code owner December 15, 2020 08:51
Copy link
Contributor

@nickolaev nickolaev left a comment

Choose a reason for hiding this comment

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

A couple of suggestions on my end. Nothing really binding, so you can merge as it is if you wish. Great stuff!

Configure(cluster *envoy_api.Cluster) error
}
envoy_api_v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2"
envoy_api "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems inconsistent with the below v2 and v3 pointing out.

Shall e just use envoy_api_v3? I don't mind either way, but maybe being explicit will make supporting these through thime slightly easier.

"github.com/kumahq/kuma/pkg/core/xds"
"github.com/kumahq/kuma/pkg/util/proto"
"github.com/kumahq/kuma/pkg/xds/envoy"
envoy_metadata "github.com/kumahq/kuma/pkg/xds/envoy/metadata/v2"
tls_v2 "github.com/kumahq/kuma/pkg/xds/envoy/tls/v2"
Copy link
Contributor

Choose a reason for hiding this comment

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

I would assume that under v2 folder you don't mix versions so tls_v2 could just be tls.

"github.com/kumahq/kuma/pkg/xds/envoy"
envoy_metadata "github.com/kumahq/kuma/pkg/xds/envoy/metadata/v3"
"github.com/kumahq/kuma/pkg/xds/envoy/tls"
tls_v3 "github.com/kumahq/kuma/pkg/xds/envoy/tls/v3"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, tls instead of tls_v3

envoy_core_v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
envoy_grpc_credential_v3 "github.com/envoyproxy/go-control-plane/envoy/config/grpc_credential/v3"
envoy_tls_v3 "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
envoy_type_matcher_v3 "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3"
Copy link
Contributor

Choose a reason for hiding this comment

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

everything here is v3, so no need to explicitly envoy_tls_v3

@@ -32,7 +32,7 @@ func (g InboundProxyGenerator) Generate(ctx xds_context.Context, proxy *model.Pr

// generate CDS resource
localClusterName := envoy_names.GetLocalClusterName(endpoint.WorkloadPort)
clusterBuilder := envoy_clusters.NewClusterBuilder().
clusterBuilder := envoy_clusters.NewClusterBuilder(envoy_common.APIV2).
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you put a todo on these so we don't accidentally miss something when we get to configure the version?

@jakubdyszkiewicz
Copy link
Contributor Author

I'll fix the imports in the next PR

@jakubdyszkiewicz jakubdyszkiewicz merged commit 9df49a1 into master Dec 16, 2020
@jakubdyszkiewicz jakubdyszkiewicz deleted the chore/upgrade-v3 branch December 16, 2020 12:38
mergify bot pushed a commit that referenced this pull request Dec 16, 2020
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
(cherry picked from commit 9df49a1)

# Conflicts:
#	pkg/xds/envoy/clusters/v2/health_check_configurer.go
jakubdyszkiewicz pushed a commit that referenced this pull request Dec 18, 2020
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
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.

2 participants