istio/old_issues_repo

VirtualService with weight 0 for v1 while weight 100 for v2 can not work

Closed this issue · 6 comments

Is this a BUG or FEATURE REQUEST?:
BUG
Did you review https://istio.io/help/ and existing issues to identify if this is already solved or being worked on?:Yes

Bug:
Y

What Version of Istio and Kubernetes are you using, where did you get Istio from, Installation details

istioctl version: release-0.8-20180520-18-17
kubectl version: Server 1.9.2, Client 1.9.3

Is Istio Auth enabled or not ?
Not
Did you install the stable istio.yaml, istio-auth.yaml.... or if using the Helm chart please provide full command line input.
Used istio.yaml

What happened:
I create a virtualservice for reviews in bookinfo. I set weight of v1 as 0 while weight of v2 as 100, and expect all traffice flow into v2, but envoy report error message "Sum of weights in the weighted_cluster should add up to 100".
I used "curl $PILOT/debug/adsz" to find what is sent to envoy and results as follow:

{
                                "domains": [
                                      "reviews.default.svc.cluster.local",
                                      "reviews.default.svc.cluster.local:9080",
                                      "reviews",
                                      "reviews:9080",
                                      "reviews.default.svc.cluster",
                                      "reviews.default.svc.cluster:9080",
                                      "reviews.default.svc",
                                      "reviews.default.svc:9080",
                                      "reviews.default",
                                      "reviews.default:9080",
                                      "10.247.14.215",
                                      "10.247.14.215:9080"
                                    ],
                                "name": "reviews.default.svc.cluster.local:9080",
                                "routes": [
                                      {
                                            "decorator": {
                                                  "operation": "reviews"
                                                },
                                            "match": {
                                                  "prefix": "/"
                                                },
                                            "per_filter_config": {
                                                },
                                            "route": {
                                                  "use_websocket": false,
                                                  "weighted_clusters": {
                                                        "clusters": [
                                                              {
                                                                    "name": "outbound|9080|v1|reviews.default.svc.cluster.local",
                                                                    "weight": 100
                                                                  },
                                                              {
                                                                    "name": "outbound|9080|v2|reviews.default.svc.cluster.local",
                                                                    "weight": 100
                                                                  }
                                                            ]
                                                      }
                                                }
                                          }
                                    ]
                              }

The sum of weights in the weighted_cluster for reviews is 200.

What you expected to happen:
I expected the request to be routed to the service specified by virtualservice.

How to reproduce it:

Relevant virtualservice yaml definitions:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  clusterName: ""
  creationTimestamp: 2018-05-24T03:41:44Z
  generation: 0
  name: reviews
  namespace: default
  resourceVersion: "774134"
  selfLink: /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/reviews
  uid: 61291caf-5f04-11e8-9181-fa163eae1709
spec:
  hosts:
  - reviews
  http:
  - route:
    - destination:
        host: reviews
        subset: v1
      weight: 0
    - destination:
        host: reviews
        subset: v2
      weight: 100

I am facing the same issue. This worked as expected with previous API and I believe it should work the same with the new v1alpha3 APIs. If I have multiple versions of a service, I want to explicitly declare all of them in my VirtualService and set weights to 0 accordingly.

If not clear from the above, setting any weight to 0 appears to compromise the entire virtual service routing configuration.

I am experiencing the same thing here. Would like to know if there is a fix?

@rshriram just confirmed that this is a bug and should be fixed in the next nightly release...

Sorry. I spotted a really stupid bug in code. this is being fixed as part of istio/istio#6081