Proto: fault_injection_policy.proto

Package: resilience.policy.gloo.solo.io

Test the resilience of your apps by injecting delays and connection failures. Inject faults in a percentage of your requests to test how your app handles the errors. By using the policy, you can avoid deleting pods, delaying packets, or corrupting packets. Fault specification is part of a VirtualService rule.

Faults include aborts and/or delays.

  • Aborts are crash failures, such as HTTP error codes or TCP connection failures.
  • Delays are timing failures, such as network latency or overloaded upstreams.

Fault injection policies are applied at the Route level. For more information, see the fault injection policy guide.

Examples

Abort: The following example is for a simple fault injection abort policy with a default value for the percentage. No delay is configured.

  apiVersion: resilience.policy.gloo.solo.io/v2
kind: FaultInjectionPolicy
metadata:
  annotations:
    cluster.solo.io/cluster: ""
  name: faultinjection-basic
  namespace: bookinfo
spec:
  applyToRoutes:
  - route:
      labels:
        route: ratings
  config:
    abort:
      httpStatus: 418
  

Delay: The following example is for a simple fault injection delay policy with a default value for the percentage. No abort is configured.

  apiVersion: resilience.policy.gloo.solo.io/v2
kind: FaultInjectionPolicy
metadata:
  name: faultinjection-basic-delay
  namespace: bookinfo
  annotations:
    cluster.solo.io/cluster: $REMOTE_CLUSTER1
spec:
  applyToRoutes:
    - route:
        labels:
          route: ratings
  config:
    delay:
      fixedDelay: 5s
  

Abort and delay: The following example is for a fault injection policy that both delays and aborts requests. Delays and aborts are independent of one another. When both are set, both happen, with the delay happening first.

  apiVersion: resilience.policy.gloo.solo.io/v2
kind: FaultInjectionPolicy
metadata:
  name: faultinjection-basic-abort-and-delay
  namespace: bookinfo
  annotations:
    cluster.solo.io/cluster: $REMOTE_CLUSTER1
spec:
  applyToRoutes:
    - route:
        labels:
          route: ratings
  config:
    abort:
      httpStatus: 418
      percentage: 10
    delay:
      percentage: 40
      fixedDelay: 5s
  

FaultInjectionPolicyReport

FieldDescription
workspaces(repeated FaultInjectionPolicyReport.WorkspacesEntry)

The state of the resource in each workspace that receives its configuration.
selectedRoutes(repeated common.gloo.solo.io.RouteReference)

A list of references to all routes selected by the policy.

FaultInjectionPolicyReport.WorkspacesEntry

FieldDescription
key(string)

value(common.gloo.solo.io.Report)

FaultInjectionPolicySpec

FaultInjectionPolicy is used to inject faults (latency and errors) into requests sent through the mesh. Fault specification is part of a VirtualService rule. Faults include aborting the Http request from downstream service, and/or delaying proxying of requests. A fault rule MUST HAVE delay or abort or both. FaultInjectionPolicies are applied at the Route level.

FieldDescription
applyToRoutes(repeated common.gloo.solo.io.RouteSelector)

Routes to apply the policy to. If empty, the policy applies to all routes in the workspace.
config(FaultInjectionPolicySpec.Config)

The details of the fault injection policy to apply to the selected routes.

FaultInjectionPolicySpec.Config

Note:* Delay and abort faults are independent of one another, even if both are specified simultaneously.

FieldDescription
delay(FaultInjectionPolicySpec.Config.Delay)

Indicate the amount of delay in seconds. The optional percentage field can be used to only delay a certain percentage of requests. If left unspecified, all request will be delayed.
abort(FaultInjectionPolicySpec.Config.Abort)

Abort the request and return the specified error code back to traffic source.

FaultInjectionPolicySpec.Config.Abort

Abort Http request attempts and return error codes back to downstream service, giving the impression that the upstream service is faulty.

FieldDescription
httpStatus(int32)

Required: HTTP status code to use to abort the request.
percentage(google.protobuf.DoubleValue)

Percentage of requests to be aborted. Values range between 0 and 100. If omitted all requests will be aborted. For information about the value format, see the Google protocol buffer documentation.

FaultInjectionPolicySpec.Config.Delay

Delay requests before forwarding, emulating various failures such as network issues, overloaded upstream service, etc.

FieldDescription
fixedDelay(google.protobuf.Duration)

Required: Add a delay of a fixed duration before sending the request. Format: 1h/1m/1s/1ms. MUST be >=1ms. For information about the value format, see the Google protocol buffer documentation.
percentage(google.protobuf.DoubleValue)

Percentage of requests on which the delay will be injected. Values range between 0 and 100. If omitted all requests will be delayed. For information about the value format, see the Google protocol buffer documentation.

FaultInjectionPolicyStatus

The status of the policy after it is applied to your Gloo environment.

FieldDescription
common(common.gloo.solo.io.Status)

The common status of the object
numSelectedRoutes(uint32)

The number of routes selected by the policy.