Update Resiliency spec example

Signed-off-by: Nick Greenfield <nigreenf@microsoft.com>
This commit is contained in:
Nick Greenfield 2022-04-04 16:54:36 -07:00
parent f96ef9148d
commit 884e9cfa15
1 changed files with 27 additions and 23 deletions

View File

@ -68,20 +68,22 @@ apiVersion: dapr.io/v1alpha1
kind: Resiliency kind: Resiliency
metadata: metadata:
name: resiliency name: resiliency
# Like in the Subscriptions CRD, scopes lists the Dapr App IDs that this # simialrly to Subscriptions CRD, scopes lists the Dapr App IDs that this
# configuration applies to. # configuration applies to.
scopes: scopes:
- app1 - app1
- app2 - app2
spec: spec:
# policies is where timeouts, retries and circuit breaker policies are defined.
# each is given a name so they can be referred to from the targets section in the resiliency spec.
policies: policies:
# Timeouts are simple named durations. # timeouts are simple named durations.
timeouts: timeouts:
general: 5s general: 5s
important: 60s important: 60s
largeResponse: 10s largeResponse: 10s
# Retries are named templates for retry configurations and are instantiated for life of the operation. # retries are named templates for retry configurations and are instantiated for life of the operation.
retries: retries:
pubsubRetry: pubsubRetry:
policy: constant policy: constant
@ -91,7 +93,7 @@ spec:
retryForever: retryForever:
policy: exponential policy: exponential
maxInterval: 15s maxInterval: 15s
maxRetries: -1 # Retry indefinitely maxRetries: -1 # retry indefinitely
important: important:
policy: constant policy: constant
@ -107,46 +109,49 @@ spec:
duration: 5s duration: 5s
maxRetries: 3 maxRetries: 3
# Circuit breakers are automatically instantiated per component and app endpoint. # circuit breakers are automatically instantiated per component and app endpoint.
# Circuit breakers maintain counters that can live as long as the Dapr sidecar. # circuit breakers maintain counters that can live as long as the Dapr sidecar.
circuitBreakers: circuitBreakers:
simpleCB:
maxRequests: 1
timeout: 30s
trip: consecutiveFailures >= 5
pubsubCB: pubsubCB:
maxRequests: 1 maxRequests: 1
interval: 8s interval: 8s
timeout: 45s timeout: 45s
trip: consecutiveFailures > 8 trip: consecutiveFailures > 8
# This section specifies policies for: # targets are what named policies are applied to. Dapr supports 3 target types - apps, components and actors
# * service invocation
# * requests to components
targets: targets:
apps: apps:
appB: appB:
timeout: general timeout: general
retry: important retry: important
# Circuit breakers for services are scoped per endpoint (e.g. hostname + port). # circuit breakers for services are scoped per endpoint (e.g. hostname + port).
# When a breaker is tripped, that route is removed from load balancing for the configured `timeout` duration. # when a breaker is tripped, that route is removed from load balancing for the configured `timeout` duration.
circuitBreaker: general circuitBreaker: simpleCB
actors: actors:
myActorType: # custom Actor Type Name myActorType: # custom Actor Type Name
timeout: general timeout: general
retry: important retry: important
# Circuit breakers for actors are scoped by type, id, or both. # circuit breakers for actors are scoped by type, id, or both.
# When a breaker is tripped, that type or id is removed from the placement table for the configured `timeout` duration. # when a breaker is tripped, that type or id is removed from the placement table for the configured `timeout` duration.
circuitBreaker: general circuitBreaker: simpleCB
circuitBreakerScope: both circuitBreakerScope: both
circuitBreakerCacheSize: 5000 circuitBreakerCacheSize: 5000
components: components:
# For state stores, policies apply to saving and retrieving state. # for state stores, policies apply to saving and retrieving state.
statestore1: # any component name -- happens to be a state store here statestore1: # any component name -- happens to be a state store here
outbound: outbound:
timeout: general timeout: general
retry: general retry: retryForever
# Circuit breakers for components are scoped per component configuration/instance (e.g. redis1). # circuit breakers for components are scoped per component configuration/instance (e.g. redis1).
# When this breaker is tripped, all interaction to that component is prevented for the configured `timeout` duration. # when this breaker is tripped, all interaction to that component is prevented for the configured `timeout` duration.
circuitBreaker: general circuitBreaker: simpleCB
pubsub1: # any component name -- happens to be a pubsub broker here pubsub1: # any component name -- happens to be a pubsub broker here
outbound: outbound:
@ -159,7 +164,6 @@ spec:
circuitBreaker: pubsubCB circuitBreaker: pubsubCB
inbound: # inbound only applies to delivery from sidecar to app inbound: # inbound only applies to delivery from sidecar to app
timeout: general timeout: general
retry: general retry: important
circuitBreaker: general circuitBreaker: pubsubCB
``` ```