我有一个混音器策略和适配器,它将在我传递的令牌中查找auth_key,但它适用于我的默认命名空间中的所有pod。我需要能够访问默认命名空间中的两个pod进行登录,并获得一个允许我通过此规则的标头。那么我可以列出我想应用此规则的pod的名称,而不是它适用于所有吗?
# handler for adapter mygrpcadapter
apiVersion: "config.istio.io/v1alpha2"
kind: handler
metadata:
name: h1
namespace: istio-system
spec:
adapter: mygrpcadapter
connection:
# address: "[::]:44225"
address: "mygrpcadapterservice:44225"
#address: "35.184.34.117:44225"
params:
auth_key: "Bearer"
---
apiVersion: "config.istio.io/v1alpha2"
kind: instance
metadata:
name: icheck
namespace: istio-system
spec:
template: authorization
params:
subject:
properties:
custom_token_header: request.headers["authorization"]
---
# rule to dispatch to handler h1
apiVersion: "config.istio.io/v1alpha2"
kind: rule
metadata:
name: r1
namespace: istio-system
spec:
actions:
- handler: h1.istio-system
instances:
- icheck
---
Istio Mixer Rules具有match
属性,您可以使用它来通过匹配Istio Mixer attributes来指定应用规则的位置。
例如,从Istio文档中:
match(destination.service.host,“ratings。*)选择任何针对名称以”rating“开头的服务的请求