Navigation Menu

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

pilot: add support for weighted TCP/TLS clusters #9112

Merged
merged 8 commits into from Oct 6, 2018

Conversation

venilnoronha
Copy link
Member

This PR adds support for weighted clusters in TCP and TLS implementations as supported in Envoy.

Signed-off-by: Venil Noronha veniln@vmware.com

@venilnoronha
Copy link
Member Author

/assign @rshriram

@venilnoronha venilnoronha changed the title pilot: add support for weighted TCP/TLS clusters [WIP] pilot: add support for weighted TCP/TLS clusters Oct 3, 2018
@istio-testing istio-testing added the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Oct 3, 2018
@codecov
Copy link

codecov bot commented Oct 3, 2018

Codecov Report

❗ No coverage uploaded for pull request base (master@7a88b12). Click here to learn what that means.
The diff coverage is 46%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #9112   +/-   ##
========================================
  Coverage          ?     69%           
========================================
  Files             ?     413           
  Lines             ?   38594           
  Branches          ?       0           
========================================
  Hits              ?   26604           
  Misses            ?   10727           
  Partials          ?    1263
Impacted Files Coverage Δ
pilot/pkg/networking/core/v1alpha3/gateway.go 46% <0%> (ø)
pilot/pkg/model/validation.go 83% <100%> (ø)
...ilot/pkg/networking/core/v1alpha3/networkfilter.go 65% <35%> (ø)
pilot/pkg/networking/core/v1alpha3/tls.go 41% <65%> (ø)

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 7a88b12...700f8e0. Read the comment docs.

@rshriram rshriram requested review from GregHanson and ijsnellf and removed request for linsun and vadimeisenbergibm October 3, 2018 13:35
@rshriram
Copy link
Member

rshriram commented Oct 3, 2018

@ijsnellf and @GregHanson could you please shepherd this through?
@venilnoronha , you might want to rebase your PR.. once this #9095 goes in..

Also, please make sure the validation code allows weighted clusters for tcp (not sure if we disallowed it).
And e2e tests please.

}
sort.Strings(routeNames)
return model.BuildSubsetKey(model.TrafficDirectionOutbound, "", model.Hostname(strings.Join(routeNames[:], "_")), port)
}
Copy link
Member

Choose a reason for hiding this comment

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

this whole thing is very kludgey. Figure out a different stat prefix. There is no need to have a stat prefix with all destination and subset names.. it will be too big and probably cause other issues.
I suggest using the virtualservice name.namespace as the stat prefix for weighted clusters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in c164e2d.

Copy link
Contributor

@ijsnellf ijsnellf left a comment

Choose a reason for hiding this comment

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

Looks good so far. We'll want to have e2e tests as well.

routes []*networking.RouteDestination, push *model.PushContext,
deprecatedTCPFilterMatchAddress string, port *model.Port) []listener.Filter {

if (len(deprecatedTCPFilterMatchAddress) > 0 && !util.Is1xProxy(node)) || len(routes) == 1 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can get rid of code with util.Is1xProxy(...). Please confirm @rshriram.

Copy link
Member

Choose a reason for hiding this comment

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

Rebase this PR..

deprecatedTCPFilterMatchAddress string, port *model.Port) []listener.Filter {
// buildStatPrefix builds a stat prefix by concatenating the given route
// destinations and port.
func buildStatPrefix(routes []*networking.RouteDestination, port int, push *model.PushContext) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

there is no max length for stats prefixes?

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed via c164e2d.

// buildStatPrefix builds a stat prefix by concatenating the given route
// destinations and port.
func buildStatPrefix(routes []*networking.RouteDestination, port int, push *model.PushContext) string {
var routeNames []string
Copy link
Contributor

Choose a reason for hiding this comment

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

routeNames := make([]string, 0, len(routes))

// buildOutboundNetworkFiltersWithSingleDestination takes a single cluster name
// and builds a stack of network filters. Matching of TCP addresses is deprecated.
func buildOutboundNetworkFiltersWithSingleDestination(env *model.Environment, node *model.Proxy,
clusterName string, deprecatedTCPFilterMatchAddress string, port *model.Port) []listener.Filter {
Copy link
Contributor

Choose a reason for hiding this comment

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

what still uses deprecatedTCPFilterMatchAddress?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was removed via #9095 which was merged after creating this PR. Fixed via rebase now.

@venilnoronha
Copy link
Member Author

/test istio-unit-tests
/test istio-pilot-multicluster-e2e

Copy link
Contributor

@ijsnellf ijsnellf left a comment

Choose a reason for hiding this comment

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

Looks good. Waiting on e2e tests before approving.

pilot/pkg/model/validation.go Show resolved Hide resolved
@venilnoronha
Copy link
Member Author

Yup, I'm working on the e2e test, and should have it soon.

@venilnoronha venilnoronha changed the title [WIP] pilot: add support for weighted TCP/TLS clusters pilot: add support for weighted TCP/TLS clusters Oct 4, 2018
@istio-testing istio-testing removed the do-not-merge/work-in-progress Block merging of a PR because it isn't ready yet. label Oct 4, 2018
Weight: 5,
}, &networking.RouteDestination{
Destination: &networking.Destination{Host: "foo.baz.east"},
Weight: 0,
Copy link
Member

Choose a reason for hiding this comment

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

why is zero weight not allowed?

Copy link
Member Author

Choose a reason for hiding this comment

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

How would Envoy determine cluster buckets in case of 0 weights?

headerVal: "",
expectedCount: map[string]int{"v1": 0, "v2": 100},
operation: "",
},
Copy link
Member

Choose a reason for hiding this comment

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

remove this test. We have plenty of TCP routing tests in tcp_test.go or tls_test.go I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is slightly different because the weight isn't specified here.

subset: v1
port:
number: 90
weight: 15
Copy link
Member

Choose a reason for hiding this comment

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

change ghe weights.. 15/50 is not exactly 30%. So tests are likely to fail every now and then

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed in d127f1d.

This commit adds support for weighted clusters in TCP and TLS
implementations as supported in Envoy.

Signed-off-by: Venil Noronha <veniln@vmware.com>
* Total weight is irrelevant for TCP/TLS weighted routes
* Individual route weight must be at least 1

Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
Signed-off-by: Venil Noronha <veniln@vmware.com>
Copy link
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

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

/lgtm

@istio-testing
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rshriram

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@istio-testing istio-testing merged commit aaaf0a3 into istio:master Oct 6, 2018
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

5 participants