我正在尝试在Istio(1.3.3)中定义一个虚拟服务,该服务具有多个匹配项,但是在匹配项中,应该具有OR功能。
例如:(伪代码)
match
header-key = value1
OR header-key = value2
OR header-key = value3
OR ....
OR header-key = value100
AND
match
uri-prefix = prefix1
OR uri-prefix = prefix2
OR uri-prefix = prefix3
OR uri-prefix = ...
OR uri-prefix = prefix100
因此,对于每个AND块,至少应有一个匹配的OR条件。
我尝试过匹配,但是如果满足所有条件之一,那么它是有效的,但是我想要匹配的是API密钥之一和URI前缀之一。
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: test
namespace: demo
spec:
hosts:
- test1
gateways:
- test-gateway
http:
- match:
- headers:
apikey:
exact: 111
- headers:
apikey:
exact: 222
- headers:
apikey:
exact: 333
- uri:
prefix: /path1/
- uri:
prefix: /path2/
rewrite:
uri: /newpath/v1/
authority: test2
route:
- destination:
host: test2
- fault:
abort:
httpStatus: 444
percent: 100
route:
- destination:
host: test2