Menu Close
6.6.8. 定义产品映射规则
将 Openshift Container Platform 与新创建的 3scale 租户一起使用,使用 mappingRules
对象在产品自定义资源中定义所需的映射规则。
考虑以下观察:
-
httpMethod
、mode、in
c
rement 和metricMethodRef
是必填字段。 -
metricMethodRef
包含对现有指标或方法映射键名称system_name
的引用。在以下示例中,按s键
。
步骤
将产品映射规则添加到新的 3scale 后端,如下例所示:
apiVersion: capabilities.3scale.net/v1beta1 kind: Product metadata: name: product1 spec: name: "OperatedProduct 1" metrics: hits: description: Number of API hits friendlyName: Hits unit: "hit" methods: method01: friendlyName: Method01 mappingRules: - httpMethod: GET pattern: "/pets" increment: 1 metricMethodRef: hits - httpMethod: GET pattern: "/cars" increment: 1 metricMethodRef: method01