Istio queryParams总是返回真实值 [英] Istio queryParams always returning truthy

查看:157
本文介绍了Istio queryParams总是返回真实值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置istio和基本的bookinfo应用

Set up istio and the basic bookinfo app

这样设置虚拟服务: 带有标题的一个:

set up the virtual service as such: one with headers:

kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: bookinfo
spec:
  hosts:
    - '*'
  gateways:
    - bookinfo-gateway
  http:
    - match:
        - headers:
            apiKey:
              exact: test
      rewrite:
        uri: /productpage
      route:
        - destination:
            host: productpage
            port:
              number: 9080
  tcp: ~
  tls: ~

,另一个使用queryParams作为路由区分符:

and another with queryParams as the routing differentiator:

kind: VirtualService
apiVersion: networking.istio.io/v1alpha3
metadata:
  name: bookinfo
spec:
  hosts:
    - '*'
  gateways:
    - bookinfo-gateway
  http:
    - match:
        - headers:
            apiKey:
              exact: test
      rewrite:
        uri: /productpage
      route:
        - destination:
            host: productpage
            port:
              number: 9080
  tcp: ~
  tls: ~

由于某种原因,标头策略似乎可以正常工作.也就是说,如果我不提交header=test,则istio将返回404.

For some reason, the header policy seems to work fine. i.e if I dont submit the header=test, istio will return 404.

但是,对于queryParams来说,它总是返回thruthy.难道我做错了什么?还是这是一个与istio相关的问题.

HOWEVER, for the queryParams, it is always returning thruthy. am I doing something wrong? or is this an istio related issue at its core.

(请注意:这2个vs不是并行运行,而是从一个更新到另一个,因此拥有2个类似的VS可能有些古怪)

(note: these 2 vs are not running in parallel, but rather an update from one to another, so it cant be some wonkyness with having 2 similar VS)

理想情况下,我希望queryParam vs标头起到相同的作用.

Ideally i would expect for the queryParam vs headers to act the same.

推荐答案

这实际上是一个准缺陷.

This was in fact a quasi-defect.

istio-1.2的文档错误地指出了1.3中的功能.

The docs for istio-1.2 was incorrectly stating feature that was found in 1.3.

对于处于类似情况的您来说,升级到istio 1.3.x应该可以解决该问题.

For those of you in a similar situation, upgrading to istio 1.3.x should resolve it.

这篇关于Istio queryParams总是返回真实值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆