Skip to content

Commit

Permalink
godoc: reformat all sources with gofmt 1.19 (#2074)
Browse files Browse the repository at this point in the history
* godoc: reformat all sources with gofmt 1.19

`gofmt` misinterprets code blocks of `eskip` examples starting with `*` as a bullet list.
This change adds route id to all such eskip examples such that subsequent reformatting
with gofmt 1.18 and 1.19 does not produce any changes.

Signed-off-by: Alexander Yastrebov <[email protected]>

* ignore statickcheck error

Signed-off-by: Alexander Yastrebov <[email protected]>

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Sep 9, 2022
1 parent 8b7cd03 commit 54ff9d0
Show file tree
Hide file tree
Showing 76 changed files with 754 additions and 862 deletions.
26 changes: 13 additions & 13 deletions circuit/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ The circuit breakers are always assigned to backend hosts, so that the outcome o
affects the circuit breaker behavior of another host. Besides hosts, individual routes can have separate circuit
breakers, too.
Breaker Type - Consecutive Failures
# Breaker Type - Consecutive Failures
This breaker opens when the proxy couldn't connect to a backend or received a >=500 status code at least N times
in a row. When open, the proxy returns 503 - Service Unavailable response during the breaker timeout. After this
timeout, the breaker goes into half-open state, in which it expects that M number of requests succeed. The
requests in the half-open state are accepted concurrently. If any of the requests during the half-open state
fails, the breaker goes back to open state. If all succeed, it goes to closed state again.
Breaker Type - Failure Rate
# Breaker Type - Failure Rate
The "rate breaker" works similar to the "consecutive breaker", but instead of considering N consecutive failures
for going open, it maintains a sliding window of the last M events, both successes and failures, and opens only
when the number of failures reaches N within the window. This way the sliding window is not time based and
allows the same breaker characteristics for low and high rate traffic.
Usage
# Usage
When imported as a package, the Registry can be used to hold the circuit breakers and their settings. On a
higher level, the circuit breaker settings can be simply passed to skipper as part of the skipper.Options
Expand Down Expand Up @@ -63,54 +63,54 @@ Setting global values happens the same way as setting host values, but leaving t
route based values happens with filters in the route definitions.
(https://godoc.org/github.com/zalando/skipper/filters/circuit)
Settings - Type
# Settings - Type
It can be ConsecutiveFailures, FailureRate or Disabled, where the first two values select which breaker to use,
while the Disabled value can override a global or host configuration disabling the circuit breaker for the
specific host or route.
Command line name: type. Possible command line values: consecutive, rate, disabled.
Settings - Host
# Settings - Host
The Host field indicates to which backend host should the current set of settings be applied. Leaving it empty
indicates global settings.
Command line name: host.
Settings - Window
# Settings - Window
The window value sets the size of the sliding counter window of the failure rate breaker.
Command line name: window. Possible command line values: any positive integer.
Settings - Failures
# Settings - Failures
The failures value sets the max failure count for both the "consecutive" and "rate" breakers.
Command line name: failures. Possible command line values: any positive integer.
Settings - Timeout
# Settings - Timeout
With the timeout we can set how long the breaker should stay open, before becoming half-open.
Command line name: timeout. Possible command line values: any positive integer as milliseconds or a duration
string, e.g. 15m30s.
Settings - Half-Open Requests
# Settings - Half-Open Requests
Defines the number of requests expected to succeed while the circuit breaker is in the half-open state.
Command line name: half-open-requests. Possible command line values: any positive integer.
Settings - Idle TTL
# Settings - Idle TTL
Defines the idle timeout after which a circuit breaker gets recycled, if it hasn't been used.
Command line name: idle-ttl. Possible command line values: any positive integer as milliseconds or a duration
string, e.g. 15m30s.
Filters
# Filters
The following circuit breaker filters are supported: consecutiveBreaker(), rateBreaker() and disableBreaker().
Expand All @@ -129,7 +129,7 @@ route that it appears in.
disableBreaker()
Proxy Usage
# Proxy Usage
The proxy, when circuit breakers are configured, uses them for backend connections. It checks the breaker for
the current backend host if it's closed before making backend requests. It reports the outcome of the request to
Expand All @@ -139,7 +139,7 @@ breaker is open, the proxy doesn't try to make backend requests, and returns a r
X-Circuit-Open: true
Registry
# Registry
The active circuit breakers are stored in a registry. They are created on-demand, for the requested settings.
The registry synchronizes access to the shared circuit breakers. When the registry detects that a circuit
Expand Down
2 changes: 1 addition & 1 deletion circuit/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (r *Registry) get(s BreakerSettings) *Breaker {
// Get returns a circuit breaker for the provided settings. The BreakerSettings object is used here as a key,
// but typically it is enough to just set its Host field:
//
// r.Get(BreakerSettings{Host: backendHost})
// r.Get(BreakerSettings{Host: backendHost})
//
// The key will be filled up with the defaults and the matching circuit breaker will be returned if it exists,
// or a new one will be created if not.
Expand Down
20 changes: 10 additions & 10 deletions cmd/eskip/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,41 @@ formatted routes from and to different data sources.
For command line help, enter:
eskip -help
eskip -help
Examples
# Examples
Check if an eskip file has valid syntax:
eskip check routes.eskip
eskip check routes.eskip
Print routes stored in etcd:
eskip print -etcd-urls https://etcd.example.org
eskip print -etcd-urls https://etcd.example.org
Print routes as JSON:
eskip print -json
eskip print -json
Insert/update routes in etcd from an eskip file:
eskip upsert routes.eskip
eskip upsert routes.eskip
Sync routes from an eskip file to etcd:
eskip reset routes.eskip
eskip reset routes.eskip
Delete routes from etcd:
eskip delete -ids route1,route2,route3
eskip delete -ids route1,route2,route3
Delete all routes from etcd:
eskip print | eskip delete
eskip print | eskip delete
Copy all routes in etcd under a different prefix:
eskip print | eskip upsert -etcd-prefix /skipper-backup
eskip print | eskip upsert -etcd-prefix /skipper-backup
(Where -etcd-urls is not set for write operations like upsert, reset and
delete, the default etcd cluster urls are used:
Expand Down
2 changes: 1 addition & 1 deletion cmd/skipper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set of filters.
For the list of command line options, run:
skipper -help
skipper -help
For details about the usage and extensibility of skipper, please see the
documentation of the root skipper package.
Expand Down
9 changes: 5 additions & 4 deletions dataclients/kubernetes/clusterclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ func newClusterClient(o Options, apiURL, ingCls, rgCls string, quit <-chan struc

// serializes a given map of label selectors to a string that can be appended to a request URI to kubernetes
// Examples (note that the resulting value in the query is URL escaped, for readability this is not done in examples):
// [] becomes ``
// ["label": ""] becomes `?labelSelector=label`
// ["label": "value"] becomes `?labelSelector=label=value`
// ["label": "value", "label2": "value2"] becomes `?labelSelector=label=value&label2=value2`
//
// [] becomes ``
// ["label": ""] becomes `?labelSelector=label`
// ["label": "value"] becomes `?labelSelector=label=value`
// ["label": "value", "label2": "value2"] becomes `?labelSelector=label=value&label2=value2`
func toLabelSelectorQuery(selectors map[string]string) string {
if len(selectors) == 0 {
return ""
Expand Down
4 changes: 2 additions & 2 deletions dataclients/kubernetes/definitions/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* Package definitions provides type definitions, parsing, marshaling and
validation for Kubernetes resources used by Skipper. */
// Package definitions provides type definitions, parsing, marshaling and
// validation for Kubernetes resources used by Skipper.
package definitions
Loading

0 comments on commit 54ff9d0

Please sign in to comment.