Skip to content

Commit f58ff4d

Browse files
rshriramkyessenov
authored andcommitted
Move fault injection into route rule (#57)
1 parent 8e2d3e7 commit f58ff4d

File tree

2 files changed

+22
-72
lines changed

2 files changed

+22
-72
lines changed

proxy/v1/config/cfg.md

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* [Weighted Routing to Different Destination Service Versions](#istio.proxy.v1alpha.config.DestinationWeight)
99
* [HTTP Req Retries](#istio.proxy.v1alpha.config.HTTPRetry)
1010
* [HTTP Req Timeouts](#istio.proxy.v1alpha.config.HTTPTimeout)
11+
* [HTTP Fault Injection](#istio.proxy.v1alpha.config.HTTPFaultInjection)
1112
* [Destination Policies](#istio.proxy.v1alpha.config.DestinationPolicy)
1213
* [Load Balancing](#istio.proxy.v1alpha.config.LoadBalancing)
1314
* [Circuit Breakers](#istio.proxy.v1alpha.config.CircuitBreaker)
14-
* [Fault Injection](#istio.proxy.v1alpha.config.HTTPFaultInjection)
1515

1616
<a name="cfg.proto"/>
1717
<p align="right"><a href="#top">Top</a></p>
@@ -68,7 +68,7 @@ not apply to TCP traffic towards the destination service.
6868
| route | [DestinationWeight](#istio.proxy.v1alpha.config.DestinationWeight) | repeated | Each routing rule is associated with one or more service version destinations (see glossary in beginning of document). Weights associated with the service version determine the proportion of traffic it receives. |
6969
| http_req_timeout | [HTTPTimeout](#istio.proxy.v1alpha.config.HTTPTimeout) | optional | Timeout policy for HTTP requests. |
7070
| http_req_retries | [HTTPRetry](#istio.proxy.v1alpha.config.HTTPRetry) | optional | Retry policy for HTTP requests. |
71-
71+
| http_fault | [HTTPFaultInjection](#istio.proxy.v1alpha.config.HTTPFaultInjection) | optional | L7 fault injection policy applies to Http traffic |
7272

7373
<a name="istio.proxy.v1alpha.config.MatchCondition"/>
7474
### Match Conditions
@@ -84,7 +84,7 @@ Match condition specifies a set of criterion to be met in order for the
8484
| source_tags | [MatchCondition.SourceTagsEntry](#istio.proxy.v1alpha.config.MatchCondition.SourceTagsEntry) | repeated | Identifies the source service version. The identifier is interpreted by the platform to match a service version for the source service.N.B. The map is used instead of pstruct due to lack of serialization supportin golang protobuf library (see https://github.com/golang/protobuf/pull/208) |
8585
| tcp | [L4MatchAttributes](#istio.proxy.v1alpha.config.L4MatchAttributes) | optional | Set of layer 4 match conditions based on the IP ranges. INCOMPLETE implementation |
8686
| udp | [L4MatchAttributes](#istio.proxy.v1alpha.config.L4MatchAttributes) | optional | |
87-
| http | [MatchCondition.HttpEntry](#istio.proxy.v1alpha.config.MatchCondition.HttpEntry) | repeated | Set of HTTP match conditions based on HTTP/1.1, HTTP/2, GRPC request metadata, such as "uri", "scheme", "authority". The header keys are case-insensitive. |
87+
| http_headers | [MatchCondition.HttpEntry](#istio.proxy.v1alpha.config.MatchCondition.HttpEntry) | repeated | Set of HTTP match conditions based on HTTP/1.1, HTTP/2, GRPC request metadata, such as "uri", "scheme", "authority". The header keys are case-insensitive. |
8888

8989

9090
<a name="istio.proxy.v1alpha.config.MatchCondition.HttpEntry"/>
@@ -213,7 +213,6 @@ DestinationPolicy declares policies that determine how to handle traffic for a
213213
| tags | [DestinationPolicy.TagsEntry](#istio.proxy.v1alpha.config.DestinationPolicy.TagsEntry) | repeated | Service version destination identifier for the destination service. The identifier is qualified by the destination service name, e.g. version "env=prod" in "my-service.default.svc.cluster.local".N.B. The map is used instead of pstruct due to lack of serialization supportin golang protobuf library (see https://github.com/golang/protobuf/pull/208) |
214214
| load_balancing | [LoadBalancing](#istio.proxy.v1alpha.config.LoadBalancing) | optional | Load balancing policy |
215215
| circuit_breaker | [CircuitBreaker](#istio.proxy.v1alpha.config.CircuitBreaker) | optional | Circuit breaker policy |
216-
| http_fault | [HTTPFaultInjection](#istio.proxy.v1alpha.config.HTTPFaultInjection) | optional | L7 fault injection policy applies to Http traffic |
217216
| custom | [Any](#google.protobuf.Any) | optional | Other custom policy implementations |
218217

219218

@@ -299,49 +298,15 @@ Abort Http request attempts and return error codes back to downstream
299298
| grpc_status | [string](#string) | optional | |
300299
| http2_error | [string](#string) | optional | |
301300
| http_status | [int32](#int32) | optional | |
302-
| override_header_name | [string](#string) | optional | |
303301

304302

305303
<a name="istio.proxy.v1alpha.config.HTTPFaultInjection.Delay"/>
306304
### HTTPFaultInjection.Delay
307305
MUST specify either a fixed delay or exponential delay. Exponential
308306
delay is unsupported at the moment.
309307

310-
| Field | Type | Label | Description |
311-
| ----- | ---- | ----- | ----------- |
312-
| fixed_delay | [HTTPFaultInjection.FixedDelay](#istio.proxy.v1alpha.config.HTTPFaultInjection.FixedDelay) | optional | |
313-
| exp_delay | [HTTPFaultInjection.ExponentialDelay](#istio.proxy.v1alpha.config.HTTPFaultInjection.ExponentialDelay) | optional | |
314-
| override_header_name | [string](#string) | optional | |
315-
316-
317-
<a name="istio.proxy.v1alpha.config.HTTPFaultInjection.ExponentialDelay"/>
318-
### HTTPFaultInjection.ExponentialDelay
319-
Add a delay (based on an exponential function) before forwarding the
320-
request
321-
322-
| Field | Type | Label | Description |
323-
| ----- | ---- | ----- | ----------- |
324-
| percent | [float](#float) | optional | percentage of requests on which the delay will be injected |
325-
| mean_delay_seconds | [double](#double) | optional | mean delay needed to derive the exponential delay values |
326-
327-
328-
<a name="istio.proxy.v1alpha.config.HTTPFaultInjection.FixedDelay"/>
329-
### HTTPFaultInjection.FixedDelay
330-
Add a fixed delay before forwarding the request
331-
332308
| Field | Type | Label | Description |
333309
| ----- | ---- | ----- | ----------- |
334310
| percent | [float](#float) | optional | percentage of requests on which the delay will be injected |
335-
| fixed_delay_seconds | [double](#double) | optional | delay duration in seconds.nanoseconds |
336-
337-
338-
<a name="istio.proxy.v1alpha.config.HTTPFaultInjection.HeadersEntry"/>
339-
### HTTPFaultInjection.HeadersEntry
340-
341-
342-
| Field | Type | Label | Description |
343-
| ----- | ---- | ----- | ----------- |
344-
| key | [string](#string) | optional | |
345-
| value | [StringMatch](#istio.proxy.v1alpha.config.StringMatch) | optional | |
346-
347-
311+
| fixed_delay_seconds | [double](#double) | optional | Add a fixed delay before forwarding the request. Delay duration in seconds.nanoseconds |
312+
| exponential_delay_seconds | [double](#double) | optional | Add a delay (based on an exponential function) before forwarding the request. mean delay needed to derive the exponential delay values |

proxy/v1/config/cfg.proto

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,8 @@ message DestinationPolicy {
8484
/// Circuit breaker policy
8585
CircuitBreaker circuit_breaker = 4;
8686

87-
///L7 fault injection policy applies to Http traffic
88-
HTTPFaultInjection http_fault = 5;
89-
90-
///@exclude L4 fault injection policy applies to Tcp/Udp (not Http) traffic
91-
L4FaultInjection l4_fault = 6;
92-
9387
/// Other custom policy implementations
94-
google.protobuf.Any custom = 7;
88+
google.protobuf.Any custom = 5;
9589
}
9690

9791
/// Route rule provides a custom routing policy based on the source and
@@ -130,6 +124,12 @@ message RouteRule {
130124

131125
/// Retry policy for HTTP requests.
132126
HTTPRetry http_req_retries = 6;
127+
128+
///L7 fault injection policy applies to Http traffic
129+
HTTPFaultInjection http_fault = 7;
130+
131+
///@exclude L4 fault injection policy applies to Tcp/Udp (not Http) traffic
132+
L4FaultInjection l4_fault = 8;
133133
}
134134

135135
/// Match condition specifies a set of criterion to be met in order for the
@@ -158,7 +158,7 @@ message MatchCondition {
158158
/// Set of HTTP match conditions based on HTTP/1.1, HTTP/2, GRPC request metadata,
159159
/// such as "uri", "scheme", "authority".
160160
/// The header keys are case-insensitive.
161-
map<string, StringMatch> http = 5;
161+
map<string, StringMatch> http_headers = 5;
162162
}
163163

164164
/// Each routing rule is associated with one or more service versions (see
@@ -313,37 +313,22 @@ message HTTPFaultInjection {
313313
/// were also delayed.
314314
Abort abort = 2;
315315

316-
/// Only requests with these Http headers will be subjected to fault
317-
/// injection
318-
map<string, StringMatch> headers = 3;
319-
320316
/// MUST specify either a fixed delay or exponential delay. Exponential
321317
/// delay is unsupported at the moment.
322318
message Delay {
319+
/// percentage of requests on which the delay will be injected
320+
float percent = 1;
323321
oneof http_delay_type {
324-
FixedDelay fixed_delay = 1;
325-
ExponentialDelay exp_delay = 2;
322+
/// Add a fixed delay before forwarding the request. Delay duration in seconds.nanoseconds
323+
double fixed_delay_seconds = 2;
324+
/// Add a delay (based on an exponential function) before forwarding
325+
/// the request. mean delay needed to derive the exponential delay
326+
/// values
327+
double exponential_delay_seconds = 3;
326328
}
327329
// Specify delay duration as part of Http request.
328330
// TODO: The semantics and syntax of the headers is undefined.
329-
string override_header_name = 3;
330-
}
331-
332-
/// Add a fixed delay before forwarding the request
333-
message FixedDelay {
334-
/// percentage of requests on which the delay will be injected
335-
float percent = 1;
336-
/// delay duration in seconds.nanoseconds
337-
double fixed_delay_seconds = 2;
338-
}
339-
340-
/// Add a delay (based on an exponential function) before forwarding the
341-
/// request
342-
message ExponentialDelay {
343-
/// percentage of requests on which the delay will be injected
344-
float percent = 1;
345-
/// mean delay needed to derive the exponential delay values
346-
double mean_delay_seconds = 2;
331+
string override_header_name = 4;
347332
}
348333

349334
/// Abort Http request attempts and return error codes back to downstream

0 commit comments

Comments
 (0)