Skip to content

Commit 214c759

Browse files
venilnoronharshriram
authored andcommitted
Deprecate int percent in favor of double percentage (#609)
* Deprecate int percent in favor of FractionalPercent This commit deprecates the integer percent field in Delay and Abort types in favor of the new FractionalPercent type which allows finer control. Signed-off-by: Venil Noronha <[email protected]> * Remove FractionalPercent and use double for percentage Signed-off-by: Venil Noronha <[email protected]> * Fix docs related to the percentage field Signed-off-by: Venil Noronha <[email protected]> * Copy envoy.type.Percent proto definition * The "type" in envoy.type.Percent is renamed to "types" in istio.envoy.types.Percent to avoid a keyword conflict in Golang. * The Makefile splits the *.pb.go file generation for v2alpha1/*.proto and types/*.proto in order to avoid the "inconsistent package names" error in protoc-gen-go. Signed-off-by: Venil Noronha <[email protected]> * Use istio.envoy.types.Percent for percentage Signed-off-by: Venil Noronha <[email protected]> * Revert copy envoy.type.Percent and its usage Signed-off-by: Venil Noronha <[email protected]> * Add and use Percent type in virtual_service.proto Signed-off-by: Venil Noronha <[email protected]>
1 parent 864a733 commit 214c759

File tree

5 files changed

+503
-152
lines changed

5 files changed

+503
-152
lines changed

networking/v1alpha3/destination_rule.pb.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

networking/v1alpha3/istio.networking.v1alpha3.pb.html

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
generator: protoc-gen-docs
77
aliases:
88
- /docs/reference/config/istio.routing.v1alpha1/
9-
number_of_entries: 49
9+
number_of_entries: 50
1010
---
1111
<p>Configuration affecting traffic routing. Here are a few terms useful to define
1212
in the context of traffic routing.</p>
@@ -1274,8 +1274,8 @@ <h2 id="HTTPFaultInjection">HTTPFaultInjection</h2>
12741274
<h2 id="HTTPFaultInjection-Abort">HTTPFaultInjection.Abort</h2>
12751275
<section>
12761276
<p>Abort specification is used to prematurely abort a request with a
1277-
pre-specified error code. The following example will return an HTTP
1278-
400 error code for 10% of the requests to the &ldquo;ratings&rdquo; service &ldquo;v1&rdquo;.</p>
1277+
pre-specified error code. The following example will return an HTTP 400
1278+
error code for 1 out of every 1000 requests to the &ldquo;ratings&rdquo; service &ldquo;v1&rdquo;.</p>
12791279

12801280
<pre><code class="language-yaml">apiVersion: networking.istio.io/v1alpha3
12811281
kind: VirtualService
@@ -1291,14 +1291,15 @@ <h2 id="HTTPFaultInjection-Abort">HTTPFaultInjection.Abort</h2>
12911291
subset: v1
12921292
fault:
12931293
abort:
1294-
percent: 10
1294+
percentage:
1295+
value: 0.001
12951296
httpStatus: 400
12961297
</code></pre>
12971298

12981299
<p>The <em>httpStatus</em> field is used to indicate the HTTP status code to
1299-
return to the caller. The optional <em>percent</em> field, a value between 0
1300-
and 100, is used to only abort a certain percentage of requests. If
1301-
not specified, all requests are aborted.</p>
1300+
return to the caller. The optional <em>percentage</em> field can be used to only
1301+
abort a certain percentage of requests. If not specified, all requests are
1302+
aborted.</p>
13021303

13031304
<table class="message-fields">
13041305
<thead>
@@ -1309,11 +1310,13 @@ <h2 id="HTTPFaultInjection-Abort">HTTPFaultInjection.Abort</h2>
13091310
</tr>
13101311
</thead>
13111312
<tbody>
1312-
<tr id="HTTPFaultInjection-Abort-percent">
1313+
<tr id="HTTPFaultInjection-Abort-percent" class="deprecated ">
13131314
<td><code>percent</code></td>
13141315
<td><code>int32</code></td>
13151316
<td>
1316-
<p>Percentage of requests to be aborted with the error code provided (0-100).</p>
1317+
<p>Percentage of requests to be aborted with the error code provided (0-100).
1318+
Use of integer <code>percent</code> value is deprecated. Use the double <code>percentage</code>
1319+
field instead.</p>
13171320

13181321
</td>
13191322
</tr>
@@ -1323,6 +1326,14 @@ <h2 id="HTTPFaultInjection-Abort">HTTPFaultInjection.Abort</h2>
13231326
<td>
13241327
<p>REQUIRED. HTTP status code to use to abort the Http request.</p>
13251328

1329+
</td>
1330+
</tr>
1331+
<tr id="HTTPFaultInjection-Abort-percentage">
1332+
<td><code>percentage</code></td>
1333+
<td><code><a href="#Percent">Percent</a></code></td>
1334+
<td>
1335+
<p>Percentage of requests to be aborted with the error code provided.</p>
1336+
13261337
</td>
13271338
</tr>
13281339
</tbody>
@@ -1332,7 +1343,7 @@ <h2 id="HTTPFaultInjection-Delay">HTTPFaultInjection.Delay</h2>
13321343
<section>
13331344
<p>Delay specification is used to inject latency into the request
13341345
forwarding path. The following example will introduce a 5 second delay
1335-
in 10% of the requests to the &ldquo;v1&rdquo; version of the &ldquo;reviews&rdquo;
1346+
in 1 out of every 1000 requests to the &ldquo;v1&rdquo; version of the &ldquo;reviews&rdquo;
13361347
service from all pods with label env: prod</p>
13371348

13381349
<pre><code class="language-yaml">apiVersion: networking.istio.io/v1alpha3
@@ -1352,14 +1363,14 @@ <h2 id="HTTPFaultInjection-Delay">HTTPFaultInjection.Delay</h2>
13521363
subset: v1
13531364
fault:
13541365
delay:
1355-
percent: 10
1366+
percentage:
1367+
value: 0.001
13561368
fixedDelay: 5s
13571369
</code></pre>
13581370

1359-
<p>The <em>fixedDelay</em> field is used to indicate the amount of delay in
1360-
seconds. An optional <em>percent</em> field, a value between 0 and 100, can
1361-
be used to only delay a certain percentage of requests. If left
1362-
unspecified, all request will be delayed.</p>
1371+
<p>The <em>fixedDelay</em> field is used to indicate the amount of delay in seconds.
1372+
The optional <em>percentage</em> field can be used to only delay a certain
1373+
percentage of requests. If left unspecified, all request will be delayed.</p>
13631374

13641375
<table class="message-fields">
13651376
<thead>
@@ -1370,11 +1381,13 @@ <h2 id="HTTPFaultInjection-Delay">HTTPFaultInjection.Delay</h2>
13701381
</tr>
13711382
</thead>
13721383
<tbody>
1373-
<tr id="HTTPFaultInjection-Delay-percent">
1384+
<tr id="HTTPFaultInjection-Delay-percent" class="deprecated ">
13741385
<td><code>percent</code></td>
13751386
<td><code>int32</code></td>
13761387
<td>
1377-
<p>Percentage of requests on which the delay will be injected (0-100).</p>
1388+
<p>Percentage of requests on which the delay will be injected (0-100).
1389+
Use of integer <code>percent</code> value is deprecated. Use the double <code>percentage</code>
1390+
field instead.</p>
13781391

13791392
</td>
13801393
</tr>
@@ -1385,6 +1398,14 @@ <h2 id="HTTPFaultInjection-Delay">HTTPFaultInjection.Delay</h2>
13851398
<p>REQUIRED. Add a fixed delay before forwarding the request. Format:
13861399
1h/1m/1s/1ms. MUST be &gt;=1ms.</p>
13871400

1401+
</td>
1402+
</tr>
1403+
<tr id="HTTPFaultInjection-Delay-percentage">
1404+
<td><code>percentage</code></td>
1405+
<td><code><a href="#Percent">Percent</a></code></td>
1406+
<td>
1407+
<p>Percentage of requests on which the delay will be injected.</p>
1408+
13881409
</td>
13891410
</tr>
13901411
</tbody>
@@ -2190,6 +2211,28 @@ <h2 id="OutlierDetection">OutlierDetection</h2>
21902211
<p>Maximum % of hosts in the load balancing pool for the upstream
21912212
service that can be ejected. Defaults to 10%.</p>
21922213

2214+
</td>
2215+
</tr>
2216+
</tbody>
2217+
</table>
2218+
</section>
2219+
<h2 id="Percent">Percent</h2>
2220+
<section>
2221+
<p>Percent specifies a percentage in the range of [0.0, 100.0].</p>
2222+
2223+
<table class="message-fields">
2224+
<thead>
2225+
<tr>
2226+
<th>Field</th>
2227+
<th>Type</th>
2228+
<th>Description</th>
2229+
</tr>
2230+
</thead>
2231+
<tbody>
2232+
<tr id="Percent-value">
2233+
<td><code>value</code></td>
2234+
<td><code>double</code></td>
2235+
<td>
21932236
</td>
21942237
</tr>
21952238
</tbody>

0 commit comments

Comments
 (0)