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

Projects
None yet
5 participants
@venilnoronha
Member

venilnoronha commented Oct 3, 2018

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

This comment has been minimized.

Member

venilnoronha commented Oct 3, 2018

/assign @rshriram

@venilnoronha venilnoronha changed the title from pilot: add support for weighted TCP/TLS clusters to [WIP] pilot: add support for weighted TCP/TLS clusters Oct 3, 2018

@codecov

This comment has been minimized.

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 Oct 3, 2018

@rshriram

This comment has been minimized.

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)
}

This comment has been minimized.

@rshriram

rshriram Oct 3, 2018

Member

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.

This comment has been minimized.

@venilnoronha

venilnoronha Oct 3, 2018

Member

Addressed in c164e2d.

@ijsnellf

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 {

This comment has been minimized.

@ijsnellf

ijsnellf Oct 3, 2018

Contributor

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

This comment has been minimized.

@rshriram

rshriram Oct 3, 2018

Member

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 {

This comment has been minimized.

@ijsnellf

ijsnellf Oct 3, 2018

Contributor

there is no max length for stats prefixes?

This comment has been minimized.

@venilnoronha

venilnoronha Oct 3, 2018

Member

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

This comment has been minimized.

@ijsnellf

ijsnellf Oct 3, 2018

Contributor

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 {

This comment has been minimized.

@ijsnellf

ijsnellf Oct 3, 2018

Contributor

what still uses deprecatedTCPFilterMatchAddress?

This comment has been minimized.

@venilnoronha

venilnoronha Oct 3, 2018

Member

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

@venilnoronha venilnoronha force-pushed the venilnoronha:tcp-weighted-clusters branch from 7f580aa to b5aa1c6 Oct 3, 2018

@ijsnellf ijsnellf self-assigned this Oct 3, 2018

@venilnoronha

This comment has been minimized.

Member

venilnoronha commented Oct 3, 2018

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

@ijsnellf

Looks good. Waiting on e2e tests before approving.

Show resolved Hide resolved pilot/pkg/model/validation.go
@venilnoronha

This comment has been minimized.

Member

venilnoronha commented Oct 4, 2018

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

@venilnoronha venilnoronha force-pushed the venilnoronha:tcp-weighted-clusters branch from a6f2b6d to b0a9df8 Oct 4, 2018

@venilnoronha venilnoronha changed the title from [WIP] pilot: add support for weighted TCP/TLS clusters to pilot: add support for weighted TCP/TLS clusters Oct 4, 2018

Weight: 5,
}, &networking.RouteDestination{
Destination: &networking.Destination{Host: "foo.baz.east"},
Weight: 0,

This comment has been minimized.

@rshriram

rshriram Oct 5, 2018

Member

why is zero weight not allowed?

This comment has been minimized.

@venilnoronha

venilnoronha Oct 5, 2018

Member

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

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

This comment has been minimized.

@rshriram

rshriram Oct 5, 2018

Member

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

This comment has been minimized.

@venilnoronha

venilnoronha Oct 5, 2018

Member

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

subset: v1
port:
number: 90
weight: 15

This comment has been minimized.

@rshriram

rshriram Oct 5, 2018

Member

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

This comment has been minimized.

@venilnoronha

venilnoronha Oct 5, 2018

Member

Addressed in d127f1d.

venilnoronha added some commits Oct 3, 2018

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

Signed-off-by: Venil Noronha <veniln@vmware.com>
Update weighted route validation logic
* 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>

venilnoronha added some commits Oct 3, 2018

Use name.namespace for statPrefix
Signed-off-by: Venil Noronha <veniln@vmware.com>
Add unit test for ValidateRouteDestination
Signed-off-by: Venil Noronha <veniln@vmware.com>
Add e2e test for weighted TCP clusters
Signed-off-by: Venil Noronha <veniln@vmware.com>
Fix e2e test
Signed-off-by: Venil Noronha <veniln@vmware.com>
Update istio.io/api package
Signed-off-by: Venil Noronha <veniln@vmware.com>
Update test route weights to reflect actual ratios
Signed-off-by: Venil Noronha <veniln@vmware.com>

@venilnoronha venilnoronha force-pushed the venilnoronha:tcp-weighted-clusters branch from d127f1d to 700f8e0 Oct 5, 2018

@rshriram

/lgtm

@istio-testing istio-testing added the lgtm label Oct 6, 2018

@istio-testing

This comment has been minimized.

Collaborator

istio-testing commented Oct 6, 2018

[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

28 of 30 checks passed

ci/circleci: test-integration-kubernetes Your tests failed on CircleCI
Details
prow/e2e-mixer-no_auth-mcp.sh Job triggered.
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: codecov Your tests passed on CircleCI!
Details
ci/circleci: e2e-galley Your tests passed on CircleCI!
Details
ci/circleci: e2e-mixer-noauth-v1alpha3-v2 Your tests passed on CircleCI!
Details
ci/circleci: e2e-mixer-noauth-v1alpha3-v2-mcp Your tests passed on CircleCI!
Details
ci/circleci: e2e-pilot-auth-v1alpha3-v2 Your tests passed on CircleCI!
Details
ci/circleci: e2e-pilot-auth-v1alpha3-v2-mcp Your tests passed on CircleCI!
Details
ci/circleci: e2e-pilot-cloudfoundry-v1alpha3-v2 Your tests passed on CircleCI!
Details
ci/circleci: e2e-pilot-noauth-v1alpha3-v2 Your tests passed on CircleCI!
Details
ci/circleci: e2e-simple Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: racetest Your tests passed on CircleCI!
Details
ci/circleci: shellcheck Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: test-integration-local Your tests passed on CircleCI!
Details
cla/google All necessary CLAs are signed
prow/e2e-bookInfoTests-v1alpha3.sh Job succeeded.
Details
prow/e2e-bookInfoTests.sh Skipped
prow/e2e-dashboard.sh Job succeeded.
Details
prow/e2e-mixer-no_auth.sh Job succeeded.
Details
prow/e2e-simpleTests.sh Job succeeded.
Details
prow/istio-pilot-e2e-envoyv2-v1alpha3-mcp.sh Job succeeded.
Details
prow/istio-pilot-e2e-envoyv2-v1alpha3.sh Job succeeded.
Details
prow/istio-pilot-e2e.sh Skipped
prow/istio-pilot-multicluster-e2e.sh Job succeeded.
Details
prow/istio-presubmit.sh Job succeeded.
Details
prow/istio-unit-tests.sh Job succeeded.
Details
tide In merge pool.
Details

@hzxuzhonghu hzxuzhonghu referenced this pull request Nov 30, 2018

Closed

Comatibility question #2049

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment