rule
Summary
Rules dictate logic on traffic is routed. Attributes from incoming requests are matched against preconfigured rule objects to determine where the outgoing upstream request should be routed. Rules are specified programmatically in routes and shared_rules as an array in the Rules attribute.
Example object
{
"rule_key": "rkey1",
"methods": [
"GET"
],
"matches": [
{
"kind": "header",
"from": {
"key": "routeTo",
"value": "passthrough-cluster"
}
}
],
"constraints": {
"light": [
{
"cluster_key": "passthrough-cluster",
"weight": 1
}
]
}
}Fields
rule_key
rule_keyA unique key for each rule. When a request is routed by a rule, it appends the header "X-Gm-Rule" with the rule key.
methods
methodsThe supported request methods for this rule. Setting to an empty array will allow all methods.
matches
matchesMatches for this rule.
constraints
constraintsThe constraints field defines cluster_constraint arrays that map requests to clusters. Currently, the only implemented field is the light field which is used to determine the Instance to which the live request will be sent and from which the response will be sent to the caller.
Currently, the constraints field must set a light field that contains an array of cluster_constraints.
"constraints" : {
"light": [
{
"cluster_key": "example-service-1.0",
"weight": 10
},
{
"cluster_key": "example-service-1.1",
"weight": 1
}
]
}NOTE:
constraintsalso contains adarkand alightfield which currently have no effect.darkarray will be used in future versions to support traffic shadowing to Instances. Similarly thetaparray will determine an Instance to send a copy of the request to, comparing the response to thelightresponse.
cohort_seed
cohort_seedThis field has no effect.
Last updated
Was this helpful?