action Load Balancer

inject_traffic_faults

Add/set HTTP status codes for a percentage of requests going through a url map on a given path

Run it now
View details
Typeaction
Modulechaosgcp.lb.actions
Nameinject_traffic_faults
Returnmapping

Usage

JSON

{
  "name": "inject-traffic-faults",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "inject_traffic_faults",
    "arguments": {
      "url_map": "",
      "target_name": "",
      "target_path": ""
    }
  }
}

YAML

name: inject-traffic-faults
provider:
  arguments:
    target_name: ''
    target_path: ''
    url_map: ''
  func: inject_traffic_faults
  module: chaosgcp.lb.actions
  type: python
type: action

Arguments

NameTypeDefaultRequiredTitleDescription
url_mapstringYesURL Map NameName of the URL map to add the fault to
target_namestringYesPath Matcher NameName of the patch matcher to add the fault to
target_pathstringYesPathPath to impact with the fault. Must already exist in the path matcher definition
impacted_percentagefloat50.0NoPercentage of Impacted RequestsVolume of requests to impact with the fault
http_statusinteger400NoHTTP Status CodeHTTP status code to set on requests
project_idstringNoProjectName of the GCP project in which the resource is running
regionalbooleanfalseNoRegionalSet this if the project is regional
regionstringNoRegionalSet this to the correct region if it is regional

This does not work with classic load balancer. Note also the fault may take a couple of minutes to propagated through GCP infrastructure and may not be immediatly on.

See: https://cloud.google.com/load-balancing/docs/l7-internal/setting-up-traffic-management#configure_fault_injection

Signature

def inject_traffic_faults(
        url_map: str,
        target_name: str,
        target_path: str,
        impacted_percentage: float = 50.0,
        http_status: int = 400,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass