apiVersion: config.istio.io/v1alpha2
kind: QuotaSpec
metadata:
name: quotaspec
namespace: istio-system
spec:
rules:
- match:
- clause:
request.headers["user"]:
exact: raft
quotas:
- charge: 1
quota: requestquota
I want to use QuotaSpec as above, only matching request which http header has user and its value exact “raft”.
But It dosen’t work.
After reading code, I found that
// istio-proxy/src/istio/quota_config/config_parser_impl.cc
bool ConfigParserImpl::MatchAttributes(const AttributeMatch& match,
const Attributes& attributes) const {
const auto& attributes_map = attributes.attributes();
for (const auto& map_it : match.clause()) {
// map is attribute_name to StringMatch.
const std::string& name = map_it.first;
const auto& match = map_it.second;
// Check if required attribure exists with string type.
const auto& it = attributes_map.find(name);
if (it == attributes_map.end() ||
it->second.value_case() != Attributes_AttributeValue::kStringValue) {
return false;
}
const std::string& value = it->second.string_value();
...
}
It only support string type,so why not support stringmap? Are there any other considerations?