-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DX-1591] Integrate Tyk Operator Endpoint Level Features (Draft) #5258
Merged
Merged
Changes from 38 commits
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
cab36f7
add Tyk operator section
dc74f0c
temporary commit, draft commit
3881a49
add blocklist tyk operator example
6697980
add advanced caching section ready for when receive example
06ca47e
add do not track middleware example
f07ab71
add circuite breaker example
8b5f35c
add enforced timeout
d2aea53
update links to sections
3032a2e
fix rendering of yaml in enforced timeout section
64a2fdb
add ignore authentication example
5c1b900
remove extra content added
8330c97
add internal endpoint example
e4cb564
add line nos to block list yaml example
350b344
add linking sentence to Tyk Operator section for blocklist
8ede397
add simple trigger example for url-rewrite for tyk operator
1b2a1cf
add validate request middleware example for operator
14eed62
fix link text
292b91c
add line nums
71799c2
add endpoint requst size limit for Tyk Operator
23f6412
add endpoint request transformation example for Tyk Operator
d46cc56
add line nums
348e797
add request header transformation for tyk operator
7e4600e
fix typo
10a0db3
draft commit for request body transformation
8b02113
add request body trasformation example
e0c720a
add line nums
811149f
draft commit for response header transform
5167db5
update response header transform for tyk operator
0917208
draft commit for Tyk response body transformation
4f2db44
fix response header transform
7c3219c
fix response body transform
5a13c27
fix mock response
1700da8
fix link in mock response
b196925
remove additional space
f3b08b0
fix typo
0057734
add virtual endpoint example
439b272
add blank line at end of file
307e767
remove blank line at end of section to trigger preview build
68dc957
update compatibility table
3ee929d
add endpoint cache advanced config
1f5e19f
Update tyk-docs/content/product-stack/tyk-gateway/middleware/allow-li…
dcs3spp 7eb806b
Update tyk-docs/content/product-stack/tyk-gateway/middleware/block-li…
dcs3spp 18fb68e
Update tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-…
dcs3spp a3e31f3
Update tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-…
dcs3spp 39ad414
Update tyk-docs/content/product-stack/tyk-gateway/middleware/circuit-…
dcs3spp a76cf0a
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp c191ea4
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp b971da5
Update tyk-docs/content/product-stack/tyk-gateway/middleware/url-rewr…
dcs3spp 4b90f53
Update tyk-docs/content/product-stack/tyk-gateway/middleware/validate…
dcs3spp aff1cd5
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp ebd06ff
Update tyk-docs/content/product-stack/tyk-gateway/middleware/do-not-t…
dcs3spp eec7045
Update tyk-docs/content/product-stack/tyk-gateway/middleware/request-…
dcs3spp 63110a8
Update tyk-docs/content/product-stack/tyk-gateway/middleware/request-…
dcs3spp 3ccfcb8
Update tyk-docs/content/product-stack/tyk-gateway/middleware/request-…
dcs3spp 32d4b02
Update tyk-docs/content/product-stack/tyk-gateway/middleware/request-…
dcs3spp 7aaf7ac
Update tyk-docs/content/product-stack/tyk-gateway/middleware/request-…
dcs3spp 89d5d33
Update tyk-docs/content/product-stack/tyk-gateway/middleware/request-…
dcs3spp 24e30e1
Update tyk-docs/content/product-stack/tyk-gateway/middleware/request-…
dcs3spp 7d0b277
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp 8711132
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp c9ca7d8
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp d66f523
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp 1f24f24
Update tyk-docs/content/product-stack/tyk-gateway/middleware/response…
dcs3spp 2badf99
update to add line nums for consistency with classic API section
7062658
add highlight lines to examples
d689a74
add global API request size limit
2a99c09
add global API response header transform
52d2850
update virtual endpoint path
234654b
Merge branch 'caroltyk-tyk-operator-2' into dx-1591
dcs3spp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,9 @@ When working with Tyk Classic APIs the circuit breaker is configured in the Tyk | |
|
||
If you're using the newer Tyk OAS APIs, then check out the [Tyk OAS]({{< ref "product-stack/tyk-gateway/middleware/circuit-breaker-tyk-oas" >}}) page. | ||
|
||
## Configuring the Circuit Breaker in the Tyk Classic API Definition | ||
If you're using Tyk Operator then check out the [confguring the Circuit Breaker in Tyk Operator](#tyk-operator) section below. | ||
|
||
## Configuring the Circuit Breaker in the Tyk Classic API Definition {#tyk-classic} | ||
|
||
To configure the circuit breaker you must add a new `circuit_breakers` object to the `extended_paths` section of your API definition, with the following configuration: | ||
- `path`: the endpoint path | ||
|
@@ -68,4 +70,51 @@ Use the *save* or *create* buttons to save the changes and activate the middlewa | |
|
||
The Dashboard supports the separate `BreakerTripped` and `BreakerReset` events, but not the combined `BreakerTriggered` [event type]({{< ref "basic-config-and-security/report-monitor-trigger-events/event-types" >}}). You should use **API Designer > Advanced Options** to add a Webhook plugin to your endpoint for each event. | ||
|
||
{{< img src="/img/dashboard/system-management/webhook-breaker.png" alt="Webhook events" >}} | ||
{{< img src="/img/dashboard/system-management/webhook-breaker.png" alt="Webhook events" >}} | ||
|
||
## Confguring the Circuit Breaker in Tyk Operator {#tyk-operator} | ||
|
||
The example API Definition below configures an API to listen on path `/httpbin-timeout-breaker` and forwards requests upstream to http://httpbin.org. A hard timeout value of 2 seconds is configured for path `/delay/{delay_seconds}`. This will return a `504 Gateway Timeout` response to the client if the upstream response is not received before expiry of the timer. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we again highlight the lines responsible for circuit breakers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated examples to highlight lines |
||
```yaml | ||
apiVersion: tyk.tyk.io/v1alpha1 | ||
kind: ApiDefinition | ||
metadata: | ||
name: httpbin-timeout-breaker | ||
spec: | ||
name: httpbin-timeout-breaker | ||
use_keyless: true | ||
protocol: http | ||
active: true | ||
proxy: | ||
target_url: http://httpbin.org | ||
listen_path: /httpbin-timeout-breaker | ||
strip_listen_path: true | ||
version_data: | ||
default_version: Default | ||
not_versioned: true | ||
versions: | ||
Default: | ||
name: Default | ||
use_extended_paths: true | ||
paths: | ||
black_list: [] | ||
ignored: [] | ||
white_list: [] | ||
extended_paths: | ||
hard_timeouts: | ||
- method: GET | ||
path: /delay/{delay_seconds} | ||
timeout: 2 | ||
circuit_breakers: | ||
- method: GET | ||
path: /status/500 | ||
return_to_service_after: 10 | ||
samples: 4 | ||
dcs3spp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# createOrUpdate failure {"ApiDefinition": "default/httpbin-timeout-breaker", "error": "unable to create api: API Returned error: {\"Status\":\"Error\",\"Message\":\"Request body malformed\",\"Meta\":null} (code: 403)" | ||
dcs3spp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
threshold_percent: "0.5" # Tyk Dashboard API doesn't support strings. | ||
``` | ||
|
||
dcs3spp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
A circuit breaker has been configured to monitor HTTP GET requests to the /status/500 endpoint. It will configure a sampling window (samples) of 4 requests and calculate the ratio of failed requests (those returning HTTP 500 or above) within that window. If the ratio of failed requests exceeds 50% (threshold_percent = 0.5) then the breaker will be tripped. After it has tripped, the circuit breaker will remain open for 10 seconds (return_to_service_after). The circuit breaker will operate using the default half-open mode so when open, Tyk will periodically poll the upstream service to test if it has become available again. | ||
|
||
When the breaker has tripped, it will return HTTP 503 Service temporarily unavailable in response to any calls to GET /status/500. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add line highlighting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated examples to highlight lines