Skip to content

Commit

Permalink
Deprecate int percent in favor of double percentage (#609)
Browse files Browse the repository at this point in the history
* 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 <veniln@vmware.com>

* Remove FractionalPercent and use double for percentage

Signed-off-by: Venil Noronha <veniln@vmware.com>

* Fix docs related to the percentage field

Signed-off-by: Venil Noronha <veniln@vmware.com>

* 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 <veniln@vmware.com>

* Use istio.envoy.types.Percent for percentage

Signed-off-by: Venil Noronha <veniln@vmware.com>

* Revert copy envoy.type.Percent and its usage

Signed-off-by: Venil Noronha <veniln@vmware.com>

* Add and use Percent type in virtual_service.proto

Signed-off-by: Venil Noronha <veniln@vmware.com>
  • Loading branch information
venilnoronha authored and rshriram committed Aug 17, 2018
1 parent 864a733 commit 214c759
Show file tree
Hide file tree
Showing 5 changed files with 503 additions and 152 deletions.
1 change: 1 addition & 0 deletions networking/v1alpha3/destination_rule.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

77 changes: 60 additions & 17 deletions networking/v1alpha3/istio.networking.v1alpha3.pb.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
generator: protoc-gen-docs
aliases:
- /docs/reference/config/istio.routing.v1alpha1/
number_of_entries: 49
number_of_entries: 50
---
<p>Configuration affecting traffic routing. Here are a few terms useful to define
in the context of traffic routing.</p>
Expand Down Expand Up @@ -1274,8 +1274,8 @@ <h2 id="HTTPFaultInjection">HTTPFaultInjection</h2>
<h2 id="HTTPFaultInjection-Abort">HTTPFaultInjection.Abort</h2>
<section>
<p>Abort specification is used to prematurely abort a request with a
pre-specified error code. The following example will return an HTTP
400 error code for 10% of the requests to the &ldquo;ratings&rdquo; service &ldquo;v1&rdquo;.</p>
pre-specified error code. The following example will return an HTTP 400
error code for 1 out of every 1000 requests to the &ldquo;ratings&rdquo; service &ldquo;v1&rdquo;.</p>

<pre><code class="language-yaml">apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
Expand All @@ -1291,14 +1291,15 @@ <h2 id="HTTPFaultInjection-Abort">HTTPFaultInjection.Abort</h2>
subset: v1
fault:
abort:
percent: 10
percentage:
value: 0.001
httpStatus: 400
</code></pre>

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

<table class="message-fields">
<thead>
Expand All @@ -1309,11 +1310,13 @@ <h2 id="HTTPFaultInjection-Abort">HTTPFaultInjection.Abort</h2>
</tr>
</thead>
<tbody>
<tr id="HTTPFaultInjection-Abort-percent">
<tr id="HTTPFaultInjection-Abort-percent" class="deprecated ">
<td><code>percent</code></td>
<td><code>int32</code></td>
<td>
<p>Percentage of requests to be aborted with the error code provided (0-100).</p>
<p>Percentage of requests to be aborted with the error code provided (0-100).
Use of integer <code>percent</code> value is deprecated. Use the double <code>percentage</code>
field instead.</p>

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

</td>
</tr>
<tr id="HTTPFaultInjection-Abort-percentage">
<td><code>percentage</code></td>
<td><code><a href="#Percent">Percent</a></code></td>
<td>
<p>Percentage of requests to be aborted with the error code provided.</p>

</td>
</tr>
</tbody>
Expand All @@ -1332,7 +1343,7 @@ <h2 id="HTTPFaultInjection-Delay">HTTPFaultInjection.Delay</h2>
<section>
<p>Delay specification is used to inject latency into the request
forwarding path. The following example will introduce a 5 second delay
in 10% of the requests to the &ldquo;v1&rdquo; version of the &ldquo;reviews&rdquo;
in 1 out of every 1000 requests to the &ldquo;v1&rdquo; version of the &ldquo;reviews&rdquo;
service from all pods with label env: prod</p>

<pre><code class="language-yaml">apiVersion: networking.istio.io/v1alpha3
Expand All @@ -1352,14 +1363,14 @@ <h2 id="HTTPFaultInjection-Delay">HTTPFaultInjection.Delay</h2>
subset: v1
fault:
delay:
percent: 10
percentage:
value: 0.001
fixedDelay: 5s
</code></pre>

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

<table class="message-fields">
<thead>
Expand All @@ -1370,11 +1381,13 @@ <h2 id="HTTPFaultInjection-Delay">HTTPFaultInjection.Delay</h2>
</tr>
</thead>
<tbody>
<tr id="HTTPFaultInjection-Delay-percent">
<tr id="HTTPFaultInjection-Delay-percent" class="deprecated ">
<td><code>percent</code></td>
<td><code>int32</code></td>
<td>
<p>Percentage of requests on which the delay will be injected (0-100).</p>
<p>Percentage of requests on which the delay will be injected (0-100).
Use of integer <code>percent</code> value is deprecated. Use the double <code>percentage</code>
field instead.</p>

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

</td>
</tr>
<tr id="HTTPFaultInjection-Delay-percentage">
<td><code>percentage</code></td>
<td><code><a href="#Percent">Percent</a></code></td>
<td>
<p>Percentage of requests on which the delay will be injected.</p>

</td>
</tr>
</tbody>
Expand Down Expand Up @@ -2190,6 +2211,28 @@ <h2 id="OutlierDetection">OutlierDetection</h2>
<p>Maximum % of hosts in the load balancing pool for the upstream
service that can be ejected. Defaults to 10%.</p>

</td>
</tr>
</tbody>
</table>
</section>
<h2 id="Percent">Percent</h2>
<section>
<p>Percent specifies a percentage in the range of [0.0, 100.0].</p>

<table class="message-fields">
<thead>
<tr>
<th>Field</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr id="Percent-value">
<td><code>value</code></td>
<td><code>double</code></td>
<td>
</td>
</tr>
</tbody>
Expand Down
Loading

0 comments on commit 214c759

Please sign in to comment.