Skip to content

Extension chaosgcp

Version 0.37.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-google-cloud-platform



Google Cloud Platform Extension for the Chaos Toolkit

Release Build GitHub issues License Python version

CommunityChangeLog


Welcome to the Google Cloud Platform (GCP) extension for Chaos Toolkit. The package aggregates activities to target your GCP projects and explore your resilience via Chaos Engineering experiments.

Install

This package requires Python 3.8+

To be used from your experiment, this package must be installed in the Python environment where Chaos Toolkit already lives.

$ pip install -U chaostoolkit-google-cloud-platform

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
  "version": "1.0.0",
  "title": "Our users should not be impacted by increased latency from our services",
  "description": "Use traffic shaping from the load Balancer to explore the impact of latency on our users",
  "method": [
    {
      "name": "add-delay-to-traffic",
      "type": "action",
      "provider": {
        "type": "python",
        "module": "chaosgcp.lb.actions",
        "func": "inject_traffic_delay",
        "arguments": {
          "url_map": "my-service",
          "target_name": "all-paths",
          "target_path": "/*",
          "delay_in_seconds": 1,
          "impacted_percentage": 80
        }
      },
      "pauses": {
        "after": 180
      }
    }
  ],
  "rollbacks": [
    {
      "name": "remove-traffic-delay",
      "type": "action",
      "provider": {
        "type": "python",
        "module": "chaosgcp.lb.actions",
        "func": "remove_fault_injection_traffic_policy",
        "arguments": {
          "url_map": "my-service",
          "target_name": "all-paths",
          "target_path": "/*"
        }
      }
    }
  ]
}

That’s it! You can now run it as chaos run experiment.json

Please explore the code to see existing probes and actions.

The extension picks up the credentials found on the machine running the experiment as describe in the official Python GCP client.

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on each commit they would like to merge into the master branch of the repository. Please, make sure you can abide by the rules of the DCO before submitting a PR.

Develop

If you wish to develop on this project, make sure to install the development dependencies. You will need to install PDM.

$ pdm install --dev

Whenever you need to make contribution, ensure to run the linter as follows:

$ pdm run format
$ pdm run lint

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

Test

To run the tests for the project execute the following:

$ pdm run test

Exported Controls

journal

This module exports controls covering the following phases of the execution of an experiment:

Level Before After
Experiment Loading False False
Experiment False True
Steady-state Hypothesis False False
Method False False
Rollback False False
Activities False False

In addition, the controls may define the followings:

Level Enabled
Validate Control False
Configure Control False
Cleanup Control False

To use this control module, please add the following section to your experiment:

{
  "controls": [
    {
      "name": "chaosgcp",
      "provider": {
        "type": "python",
        "module": "chaosgcp.cloudlogging.controls.journal"
      }
    }
  ]
}
controls:
- name: chaosgcp
  provider:
    module: chaosgcp.cloudlogging.controls.journal
    type: python

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

policy

This module exports controls covering the following phases of the execution of an experiment:

Level Before After
Experiment Loading False False
Experiment True True
Steady-state Hypothesis False False
Method False False
Rollback False False
Activities False False

In addition, the controls may define the followings:

Level Enabled
Validate Control False
Configure Control False
Cleanup Control False

To use this control module, please add the following section to your experiment:

{
  "controls": [
    {
      "name": "chaosgcp",
      "provider": {
        "type": "python",
        "module": "chaosgcp.iam.controls.policy"
      }
    }
  ]
}
controls:
- name: chaosgcp
  provider:
    module: chaosgcp.iam.controls.policy
    type: python

This block may also be enabled at any other level (steady-state hypothesis or activity) to focus only on that level.

When enabled at the experiment level, by default, all sub-levels are also applied unless you set the automatic properties to false.

Exported Activities

apphub


inject_fault_if_url_map_exists_app_hub

Type action
Module chaosgcp.apphub.actions
Name inject_fault_if_url_map_exists_app_hub
Return null

Processes a URL map if it exists within the specified AppHub application.

Args: application_name (str): The name of the AppHub application. url_map (str): The URL map value to check for. project_id (str): The Google Cloud project ID. region (str): The region of the AppHub application. target_name (str): the the name of a path matcher in the URL map. target_path (str): default “/*”, impacted_percentage: float default 50.0, http_status (int) default 400, regional: (bool) default True, configuration: (Configuration) default None, secrets: (Secrets) default None,

Signature:

def inject_fault_if_url_map_exists_app_hub(
        application_name: str,
        host_project_id: str,
        url_map: str,
        project_id: str,
        region: str,
        target_name: str,
        target_path: str = '/*',
        impacted_percentage: float = 50.0,
        http_status: int = 400,
        regional: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> None:
    pass

Arguments:

Name Type Default Required
application_name string Yes
host_project_id string Yes
url_map string Yes
project_id string Yes
region string Yes
target_name string Yes
target_path string ”/*” No
impacted_percentage number 50.0 No
http_status integer 400 No
regional boolean true No

Usage:

{
  "name": "inject-fault-if-url-map-exists-app-hub",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.apphub.actions",
    "func": "inject_fault_if_url_map_exists_app_hub",
    "arguments": {
      "application_name": "",
      "host_project_id": "",
      "url_map": "",
      "project_id": "",
      "region": "",
      "target_name": ""
    }
  }
}
name: inject-fault-if-url-map-exists-app-hub
provider:
  arguments:
    application_name: ''
    host_project_id: ''
    project_id: ''
    region: ''
    target_name: ''
    url_map: ''
  func: inject_fault_if_url_map_exists_app_hub
  module: chaosgcp.apphub.actions
  type: python
type: action

remove_fault_if_url_map_exists_app_hub

Type action
Module chaosgcp.apphub.actions
Name remove_fault_if_url_map_exists_app_hub
Return null

Processes a URL map if it exists within the specified AppHub application.

Args: application_name (str): The name of the AppHub application. host_project_id (str): The ID of the Host Apphub project. url_map (str): The URL map value to check for. project_id (str): The Google Cloud project ID. region (str): The region of the AppHub application. target_name (str): the the name of a path matcher in the URL map. target_path (str): default “/*”, regional: (bool) default True, configuration: (Configuration) default None, secrets: (Secrets) default None,

Signature:

def remove_fault_if_url_map_exists_app_hub(
        application_name: str,
        host_project_id: str,
        url_map: str,
        project_id: str,
        region: str,
        target_name: str,
        target_path: str = '/*',
        regional: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> None:
    pass

Arguments:

Name Type Default Required
application_name string Yes
host_project_id string Yes
url_map string Yes
project_id string Yes
region string Yes
target_name string Yes
target_path string ”/*” No
regional boolean true No

Usage:

{
  "name": "remove-fault-if-url-map-exists-app-hub",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.apphub.actions",
    "func": "remove_fault_if_url_map_exists_app_hub",
    "arguments": {
      "application_name": "",
      "host_project_id": "",
      "url_map": "",
      "project_id": "",
      "region": "",
      "target_name": ""
    }
  }
}
name: remove-fault-if-url-map-exists-app-hub
provider:
  arguments:
    application_name: ''
    host_project_id: ''
    project_id: ''
    region: ''
    target_name: ''
    url_map: ''
  func: remove_fault_if_url_map_exists_app_hub
  module: chaosgcp.apphub.actions
  type: python
type: action

artifact


get_container_most_recent_image_vulnerabilities_occurences

Type probe
Module chaosgcp.artifact.probes
Name get_container_most_recent_image_vulnerabilities_occurences
Return mapping

List all occurrences for a given container image tag.

Signature:

def get_container_most_recent_image_vulnerabilities_occurences(
        repository: str,
        package_name: str,
        kind: str = 'VULNERABILITY',
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
repository string Yes
package_name string Yes
kind string “VULNERABILITY” No
project_id string null No
region string null No

Usage:

{
  "name": "get-container-most-recent-image-vulnerabilities-occurences",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.artifact.probes",
    "func": "get_container_most_recent_image_vulnerabilities_occurences",
    "arguments": {
      "repository": "",
      "package_name": ""
    }
  }
}
name: get-container-most-recent-image-vulnerabilities-occurences
provider:
  arguments:
    package_name: ''
    repository: ''
  func: get_container_most_recent_image_vulnerabilities_occurences
  module: chaosgcp.artifact.probes
  type: python
type: probe

get_docker_image_version_from_tag

Type probe
Module chaosgcp.artifact.probes
Name get_docker_image_version_from_tag
Return mapping

Get image version (sha256) for most recent tag.

Signature:

def get_docker_image_version_from_tag(
        repository: str,
        package_name: str,
        tag: str = 'latest',
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
repository string Yes
package_name string Yes
tag string “latest” No
project_id string null No
region string null No

Usage:

{
  "name": "get-docker-image-version-from-tag",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.artifact.probes",
    "func": "get_docker_image_version_from_tag",
    "arguments": {
      "repository": "",
      "package_name": ""
    }
  }
}
name: get-docker-image-version-from-tag
provider:
  arguments:
    package_name: ''
    repository: ''
  func: get_docker_image_version_from_tag
  module: chaosgcp.artifact.probes
  type: python
type: probe

get_most_recent_docker_image

Type probe
Module chaosgcp.artifact.probes
Name get_most_recent_docker_image
Return mapping

Get most recent tag for a package in repository.

Signature:

def get_most_recent_docker_image(
        repository: str,
        package_name: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
repository string Yes
package_name string Yes
project_id string null No
region string null No

Usage:

{
  "name": "get-most-recent-docker-image",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.artifact.probes",
    "func": "get_most_recent_docker_image",
    "arguments": {
      "repository": "",
      "package_name": ""
    }
  }
}
name: get-most-recent-docker-image
provider:
  arguments:
    package_name: ''
    repository: ''
  func: get_most_recent_docker_image
  module: chaosgcp.artifact.probes
  type: python
type: probe

has_most_recent_image_any_severe_or_critical_vulnerabilities

Type probe
Module chaosgcp.artifact.probes
Name has_most_recent_image_any_severe_or_critical_vulnerabilities
Return boolean

Has the most recent tag any severe or critical vulnerabilities.

Signature:

def has_most_recent_image_any_severe_or_critical_vulnerabilities(
        repository: str,
        package_name: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
repository string Yes
package_name string Yes
project_id string null No
region string null No

Usage:

{
  "name": "has-most-recent-image-any-severe-or-critical-vulnerabilities",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.artifact.probes",
    "func": "has_most_recent_image_any_severe_or_critical_vulnerabilities",
    "arguments": {
      "repository": "",
      "package_name": ""
    }
  }
}
name: has-most-recent-image-any-severe-or-critical-vulnerabilities
provider:
  arguments:
    package_name: ''
    repository: ''
  func: has_most_recent_image_any_severe_or_critical_vulnerabilities
  module: chaosgcp.artifact.probes
  type: python
type: probe

list_docker_image_tags

Type probe
Module chaosgcp.artifact.probes
Name list_docker_image_tags
Return list

List docker image tags of a package in the given repository.

Signature:

def list_docker_image_tags(
        repository: str,
        package_name: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
repository string Yes
package_name string Yes
project_id string null No
region string null No

Usage:

{
  "name": "list-docker-image-tags",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.artifact.probes",
    "func": "list_docker_image_tags",
    "arguments": {
      "repository": "",
      "package_name": ""
    }
  }
}
name: list-docker-image-tags
provider:
  arguments:
    package_name: ''
    repository: ''
  func: list_docker_image_tags
  module: chaosgcp.artifact.probes
  type: python
type: probe

list_severe_or_critical_vulnerabilities_in_most_recent_image

Type probe
Module chaosgcp.artifact.probes
Name list_severe_or_critical_vulnerabilities_in_most_recent_image
Return list

List all severe and critical vulnerabilities for the most recent tag.

Signature:

def list_severe_or_critical_vulnerabilities_in_most_recent_image(
        repository: str,
        package_name: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
repository string Yes
package_name string Yes
project_id string null No
region string null No

Usage:

{
  "name": "list-severe-or-critical-vulnerabilities-in-most-recent-image",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.artifact.probes",
    "func": "list_severe_or_critical_vulnerabilities_in_most_recent_image",
    "arguments": {
      "repository": "",
      "package_name": ""
    }
  }
}
name: list-severe-or-critical-vulnerabilities-in-most-recent-image
provider:
  arguments:
    package_name: ''
    repository: ''
  func: list_severe_or_critical_vulnerabilities_in_most_recent_image
  module: chaosgcp.artifact.probes
  type: python
type: probe

cloudbuild


get_trigger

Type probe
Module chaosgcp.cloudbuild.probes
Name get_trigger
Return None

Returns information about a BuildTrigger.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/get

:param name: name of the trigger :param configuration: :param secrets: :return:

Signature:

def get_trigger(name: str,
                project_id: str = None,
                region: str = None,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
project_id string null No
region string null No

Usage:

{
  "name": "get-trigger",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudbuild.probes",
    "func": "get_trigger",
    "arguments": {
      "name": ""
    }
  }
}
name: get-trigger
provider:
  arguments:
    name: ''
  func: get_trigger
  module: chaosgcp.cloudbuild.probes
  type: python
type: probe

list_trigger_names

Type probe
Module chaosgcp.cloudbuild.probes
Name list_trigger_names
Return None

List only the trigger names of a project

:param configuration: :param secrets:

:return:

Signature:

def list_trigger_names(project_id: str = None,
                       region: str = None,
                       configuration: Dict[str, Dict[str, str]] = None,
                       secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
project_id string null No
region string null No

Usage:

{
  "name": "list-trigger-names",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudbuild.probes",
    "func": "list_trigger_names"
  }
}
name: list-trigger-names
provider:
  func: list_trigger_names
  module: chaosgcp.cloudbuild.probes
  type: python
type: probe

list_triggers

Type probe
Module chaosgcp.cloudbuild.probes
Name list_triggers
Return None

Lists existing BuildTriggers.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/list

:param configuration: :param secrets:

:return:

Signature:

def list_triggers(project_id: str = None,
                  region: str = None,
                  configuration: Dict[str, Dict[str, str]] = None,
                  secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
project_id string null No
region string null No

Usage:

{
  "name": "list-triggers",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudbuild.probes",
    "func": "list_triggers"
  }
}
name: list-triggers
provider:
  func: list_triggers
  module: chaosgcp.cloudbuild.probes
  type: python
type: probe

run_trigger

Type action
Module chaosgcp.cloudbuild.actions
Name run_trigger
Return None

Runs a BuildTrigger at a particular source revision.

NB: The trigger must exist in the targeted project.

See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers/run

:param name: name of the trigger :param source: location of the source in a Google Cloud Source Repository :param configuration: :param secrets:

:return:

Signature:

def run_trigger(name: str,
                source: Dict[Any, Any],
                project_id: str = None,
                region: str = None,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
name string Yes
source mapping Yes
project_id string null No
region string null No

Usage:

{
  "name": "run-trigger",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudbuild.actions",
    "func": "run_trigger",
    "arguments": {
      "name": "",
      "source": {}
    }
  }
}
name: run-trigger
provider:
  arguments:
    name: ''
    source: {}
  func: run_trigger
  module: chaosgcp.cloudbuild.actions
  type: python
type: action

controls

cloudrun


create_service

Type action
Module chaosgcp.cloudrun.actions
Name create_service
Return None

Deletes a Cloud Run service and all its revisions. Cannot be undone.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param parent: the path to the location in the project ‘projects/PROJECT_ID/locations/LOC. Otherwise set the project_id and region fields :param project_id: the project identifier where to create the service when parent is not set :param region: the region where to create the service when parent is not set :param service_id: unique identifier for the service :param container: definition of the container as per https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.types.Container :param description: optional text description of the service :param max_instance_request_concurrency: optional maximum number of requests that each serving instance can receive :param labels: optional labels to set on the service :param annotations: optional annotations to set on the service :param configuration: :param secrets:

:return:

Signature:

def create_service(service_id: str,
                   container: Dict[str, Any],
                   parent: str = None,
                   project_id: str = None,
                   region: str = None,
                   description: str = None,
                   max_instance_request_concurrency: int = 0,
                   service_account: str = None,
                   encryption_key: str = None,
                   traffic: List[Dict[str, Any]] = None,
                   labels: Dict[str, str] = None,
                   annotations: Dict[str, str] = None,
                   configuration: Dict[str, Dict[str, str]] = None,
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
service_id string Yes
container mapping Yes
parent string null No
project_id string null No
region string null No
description string null No
max_instance_request_concurrency integer 0 No
service_account string null No
encryption_key string null No
traffic list null No
labels mapping null No
annotations mapping null No

Usage:

{
  "name": "create-service",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudrun.actions",
    "func": "create_service",
    "arguments": {
      "service_id": "",
      "container": {}
    }
  }
}
name: create-service
provider:
  arguments:
    container: {}
    service_id: ''
  func: create_service
  module: chaosgcp.cloudrun.actions
  type: python
type: action

delete_service

Type action
Module chaosgcp.cloudrun.actions
Name delete_service
Return None

Deletes a Cloud Run service and all its revisions. Cannot be undone.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param parent: the path to the service ‘projects/PROJECT_ID/locations/LOC/services/SVC :param project_id: the project identifier where to delete the service when parent is not set :param region: the region where to delete the service when parent is not set :param name: the name of the service when parent is not set :param configuration: :param secrets:

:return:

Signature:

def delete_service(parent: str = None,
                   project_id: str = None,
                   region: str = None,
                   name: str = None,
                   configuration: Dict[str, Dict[str, str]] = None,
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
parent string null No
project_id string null No
region string null No
name string null No

Usage:

{
  "name": "delete-service",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudrun.actions",
    "func": "delete_service"
  }
}
name: delete-service
provider:
  func: delete_service
  module: chaosgcp.cloudrun.actions
  type: python
type: action

get_service

Type probe
Module chaosgcp.cloudrun.probes
Name get_service
Return mapping

Retrieve a single cloud run service

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_get_service

:param parent: the path to the service ‘projects/PROJECT_ID/locations/LOC/services/SVC :param project_id: the project identifier where to delete the service when parent is not set :param region: the region where to delete the service when parent is not set :param name: the name of the service when parent is not set :param configuration: :param secrets:

:return:

Signature:

def get_service(parent: str = None,
                project_id: str = None,
                region: str = None,
                name: str = None,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
parent string null No
project_id string null No
region string null No
name string null No

Usage:

{
  "name": "get-service",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudrun.probes",
    "func": "get_service"
  }
}
name: get-service
provider:
  func: get_service
  module: chaosgcp.cloudrun.probes
  type: python
type: probe

list_service_revisions

Type probe
Module chaosgcp.cloudrun.probes
Name list_service_revisions
Return list

List all Cloud Run service revisions for a specific service.

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.revisions.RevisionsClient#google_cloud_run_v2_services_revisions_RevisionsClient_list_revisions

:param parent: the path to the service ‘projects/PROJECT_ID/locations/LOC/services/SVC :param project_id: the project identifier where to delete the service when parent is not set :param region: the region where to delete the service when parent is not set :param name: the name of the service when parent is not set :param configuration: :param secrets:

:return:

Signature:

def list_service_revisions(
        parent: str,
        project_id: str = None,
        region: str = None,
        name: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
parent string Yes
project_id string null No
region string null No
name string null No

Usage:

{
  "name": "list-service-revisions",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudrun.probes",
    "func": "list_service_revisions",
    "arguments": {
      "parent": ""
    }
  }
}
name: list-service-revisions
provider:
  arguments:
    parent: ''
  func: list_service_revisions
  module: chaosgcp.cloudrun.probes
  type: python
type: probe

list_services

Type probe
Module chaosgcp.cloudrun.probes
Name list_services
Return list

List all Cloud Run services

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_list_services

:param parent: the path to the location in the project ‘projects/PROJECT_ID/locations/LOC. Otherwise set the project_id and region fields :param project_id: the project identifier where to create the service when parent is not set :param region: the region where to create the service when parent is not set :param configuration: :param secrets:

:return:

Signature:

def list_services(
        parent: str = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
parent string null No
project_id string null No
region string null No

Usage:

{
  "name": "list-services",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudrun.probes",
    "func": "list_services"
  }
}
name: list-services
provider:
  func: list_services
  module: chaosgcp.cloudrun.probes
  type: python
type: probe

update_service

Type action
Module chaosgcp.cloudrun.actions
Name update_service
Return None

Updates a Cloud Run service.

For example:

{
    "name": "route-traffic-two-latest-and-older-revision",
    "type": "action",
    "provider": {
   "type": "python",
   "module": chaosgcp.cloudrun.actions",
   "func": "update_service",
   "arguments": {
  "parent": "projects/${gcp_project_id}/locations/${gcp_location}/services/${service_name}",
  "container": {
 "image": "eu.gcr.io/${gcp_project_id}/demo"
  },
  "traffic": [{
 "type_": 1,
 "percent": 50
  }, {
 "type_": 2,
 "revision": "whatever-w788x",
 "percent": 50
  }],
   }
    }
}

See: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.services.services.ServicesClient#google_cloud_run_v2_services_services_ServicesClient_delete_service

:param parent: the path to the service ‘projects/PROJECT_ID/locations/LOC/services/SVC :param project_id: the project identifier where to delete the service when parent is not set :param region: the region where to delete the service when parent is not set :param name: the name of the service when parent is not set :param container: definition of the container as per https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.types.Container :param labels: optional labels to set on the service :param annotations: optional annotations to set on the service :param configuration: :param secrets: :param vpc_access_config: optional value for vpc_connect

:return:

Signature:

def update_service(parent: str = None,
                   project_id: str = None,
                   region: str = None,
                   name: str = None,
                   container: Dict[str, Any] = None,
                   max_instance_request_concurrency: int = 100,
                   service_account: str = None,
                   encryption_key: str = None,
                   traffic: List[Dict[str, Any]] = None,
                   labels: Dict[str, str] = None,
                   annotations: Dict[str, str] = None,
                   vpc_access_config: Dict[str, str] = None,
                   configuration: Dict[str, Dict[str, str]] = None,
                   secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
parent string null No
project_id string null No
region string null No
name string null No
container mapping null No
max_instance_request_concurrency integer 100 No
service_account string null No
encryption_key string null No
traffic list null No
labels mapping null No
annotations mapping null No
vpc_access_config mapping null No

Usage:

{
  "name": "update-service",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.cloudrun.actions",
    "func": "update_service"
  }
}
name: update-service
provider:
  func: update_service
  module: chaosgcp.cloudrun.actions
  type: python
type: action

compute


set_instance_tags

Type action
Module chaosgcp.compute.actions
Name set_instance_tags
Return null

Set a Network Tags to a GCE VM instance

:param project_id : the project ID in which the DNS record is present :param ip_address: the IP address for the A record that needs to be changed :param zone: the name of the zone where the GCE VM is provisioned :param tags_list : list of network tags to be set to the GCE VM instance :return nothing

Signature:

def set_instance_tags(project_id: str,
                      zone: str,
                      instance_name: str,
                      tags_list: list,
                      configuration: Dict[str, Dict[str, str]] = None,
                      secrets: Dict[str, Dict[str, str]] = None) -> None:
    pass

Arguments:

Name Type Default Required
project_id string Yes
zone string Yes
instance_name string Yes
tags_list list Yes

Usage:

{
  "name": "set-instance-tags",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.compute.actions",
    "func": "set_instance_tags",
    "arguments": {
      "project_id": "",
      "zone": "",
      "instance_name": "",
      "tags_list": []
    }
  }
}
name: set-instance-tags
provider:
  arguments:
    instance_name: ''
    project_id: ''
    tags_list: []
    zone: ''
  func: set_instance_tags
  module: chaosgcp.compute.actions
  type: python
type: action

dns


update_dns_record

Type action
Module chaosgcp.dns.actions
Name update_dns_record
Return mapping

Updates the DNS A record entry, It cannot be undone.

Args: project_id : the project ID in which the DNS record is present ip_address: the IP address for the A record that needs to be changed name: the name of the dns record entry zone_name: the name of the dns zone name which needs to be changed kind : the type of dns record set ttl: time to live for dns record change record_type: the record type for the name existing_type: the existing type of record secrets: authorization token Returns: JSON Response which is in form of dictionary

Signature:

def update_dns_record(
        project_id: str,
        ip_address: str,
        name: str,
        zone_name: str,
        kind: str = 'dns#resourceRecordSet',
        ttl: int = 5,
        record_type: str = 'A',
        existing_type: str = 'A',
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
project_id string Yes
ip_address string Yes
name string Yes
zone_name string Yes
kind string “dns#resourceRecordSet” No
ttl integer 5 No
record_type string “A” No
existing_type string “A” No

Usage:

{
  "name": "update-dns-record",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.dns.actions",
    "func": "update_dns_record",
    "arguments": {
      "project_id": "",
      "ip_address": "",
      "name": "",
      "zone_name": ""
    }
  }
}
name: update-dns-record
provider:
  arguments:
    ip_address: ''
    name: ''
    project_id: ''
    zone_name: ''
  func: update_dns_record
  module: chaosgcp.dns.actions
  type: python
type: action

nodepool


create_new_nodepool

Type action
Module chaosgcp.gke.nodepool.actions
Name create_new_nodepool
Return mapping

Create a new node pool in the given cluster/zone of the provided project.

The node pool config must be passed a mapping to the body parameter and respect the REST API.

If wait_until_complete is set to True (the default), the function will block until the node pool is ready. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def create_new_nodepool(
        body: Dict[str, Any],
        parent: str = None,
        project_id: str = None,
        region: str = None,
        wait_until_complete: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
body mapping Yes
parent string null No
project_id string null No
region string null No
wait_until_complete boolean true No

Usage:

{
  "name": "create-new-nodepool",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.actions",
    "func": "create_new_nodepool",
    "arguments": {
      "body": {}
    }
  }
}
name: create-new-nodepool
provider:
  arguments:
    body: {}
  func: create_new_nodepool
  module: chaosgcp.gke.nodepool.actions
  type: python
type: action

delete_nodepool

Type action
Module chaosgcp.gke.nodepool.actions
Name delete_nodepool
Return mapping

Delete node pool from the given cluster/zone of the provided project.

If wait_until_complete is set to True (the default), the function will block until the node pool is deleted. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def delete_nodepool(
        parent: str = None,
        node_pool_id: str = None,
        project_id: str = None,
        region: str = None,
        wait_until_complete: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
parent string null No
node_pool_id string null No
project_id string null No
region string null No
wait_until_complete boolean true No

Usage:

{
  "name": "delete-nodepool",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.actions",
    "func": "delete_nodepool"
  }
}
name: delete-nodepool
provider:
  func: delete_nodepool
  module: chaosgcp.gke.nodepool.actions
  type: python
type: action

get_nodepool

Type probe
Module chaosgcp.gke.nodepool.probes
Name get_nodepool
Return mapping

Get a specific nodepool of a cluster.

The parent is following the form projects/*/locations/*/clusters/*/nodePools/* and will override any settings in the configuration block.

{
    "name": "retrieve-our-nodepool",
    "type": "probe",
    "provider": {
   "type": "python",
   "module": "chaosgcp.gke.nodepool.probes",
   "func": "get_nodepool",
   "secrets": ["gcp"],
   "arguments": {
  "parent": "projects/my-project-89/locations/us-east1/clusters/cluster-1/nodePools/default-pool"
   }
    }
}

If not provided this action uses the configuration settings. In that case, make sure to also pass the node_pool_id value.

{
    "name": "retrieve-our-nodepool",
    "type": "probe",
    "provider": {
   "type": "python",
   "module": "chaosgcp.gke.nodepool.probes",
   "func": "get_nodepool",
   "secrets": ["gcp"],
   "arguments": {
  "node_pool_id": "default-pool"
   }
    }
}

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/get

Signature:

def get_nodepool(node_pool_id: str = None,
                 parent: str = None,
                 project_id: str = None,
                 region: str = None,
                 configuration: Dict[str, Dict[str, str]] = None,
                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
node_pool_id string null No
parent string null No
project_id string null No
region string null No

Usage:

{
  "name": "get-nodepool",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.probes",
    "func": "get_nodepool"
  }
}
name: get-nodepool
provider:
  func: get_nodepool
  module: chaosgcp.gke.nodepool.probes
  type: python
type: probe

list_nodepools

Type probe
Module chaosgcp.gke.nodepool.probes
Name list_nodepools
Return mapping

List nodepools of a cluster.

The parent is following the form projects/*/locations/*/clusters/* and will override any settings in the configuration block. If not provided this action uses the configuration settings.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/list

Signature:

def list_nodepools(
        parent: str = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
parent string null No
project_id string null No
region string null No

Usage:

{
  "name": "list-nodepools",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.probes",
    "func": "list_nodepools"
  }
}
name: list-nodepools
provider:
  func: list_nodepools
  module: chaosgcp.gke.nodepool.probes
  type: python
type: probe

resize_nodepool

Type action
Module chaosgcp.gke.nodepool.actions
Name resize_nodepool
Return mapping

Resize a cluster nodepool.

Specify the nodepool through the parent argument as follows projects/*/locations/*/clusters/*/nodePools/* or set node_pool_id and optionally the project_id and region. If not passed, these two will be loaded from the configuration.

If wait_until_complete is set to True (the default), the function will block until the node pool is ready. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/python/docs/reference/container/latest/google.cloud.container_v1.services.cluster_manager.ClusterManagerClient#google_cloud_container_v1_services_cluster_manager_ClusterManagerClient_set_node_pool_size

Signature:

def resize_nodepool(
        pool_size: int = 1,
        node_pool_id: str = None,
        parent: str = None,
        wait_until_complete: bool = True,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
pool_size integer 1 No
node_pool_id string null No
parent string null No
wait_until_complete boolean true No
project_id string null No
region string null No

Usage:

{
  "name": "resize-nodepool",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.actions",
    "func": "resize_nodepool"
  }
}
name: resize-nodepool
provider:
  func: resize_nodepool
  module: chaosgcp.gke.nodepool.actions
  type: python
type: action

rollback_nodepool

Type action
Module chaosgcp.gke.nodepool.actions
Name rollback_nodepool
Return mapping

Rollback a previously Aborted or Failed NodePool upgrade.

If wait_until_complete is set to True (the default), the function will block until the node pool is ready. Otherwise, will return immediatly with the operation information.

See: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters.nodePools/create

Signature:

def rollback_nodepool(
        node_pool_id: str,
        parent: str = None,
        wait_until_complete: bool = True,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
node_pool_id string Yes
parent string null No
wait_until_complete boolean true No
project_id string null No
region string null No

Usage:

{
  "name": "rollback-nodepool",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.actions",
    "func": "rollback_nodepool",
    "arguments": {
      "node_pool_id": ""
    }
  }
}
name: rollback-nodepool
provider:
  arguments:
    node_pool_id: ''
  func: rollback_nodepool
  module: chaosgcp.gke.nodepool.actions
  type: python
type: action

swap_nodepool

Type action
Module chaosgcp.gke.nodepool.actions
Name swap_nodepool
Return mapping

Create a new nodepool, drain the old one so pods can be rescheduled on the new pool. Delete the old nodepool only delete_old_node_pool is set to True, which is not the default. Otherwise, leave the old node pool cordonned so it cannot be scheduled any longer.

Please ensure to provide the Kubernetes secrets as well when calling this action. See https://github.com/chaostoolkit/chaostoolkit-kubernetes#configuration

Signature:

def swap_nodepool(old_node_pool_id: str,
                  new_nodepool_body: Dict[str, Any],
                  parent: str = None,
                  wait_until_complete: bool = True,
                  delete_old_node_pool: bool = False,
                  drain_timeout: int = 120,
                  project_id: str = None,
                  region: str = None,
                  configuration: Dict[str, Dict[str, str]] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
old_node_pool_id string Yes
new_nodepool_body mapping Yes
parent string null No
wait_until_complete boolean true No
delete_old_node_pool boolean false No
drain_timeout integer 120 No
project_id string null No
region string null No

Usage:

{
  "name": "swap-nodepool",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.gke.nodepool.actions",
    "func": "swap_nodepool",
    "arguments": {
      "old_node_pool_id": "",
      "new_nodepool_body": {}
    }
  }
}
name: swap-nodepool
provider:
  arguments:
    new_nodepool_body: {}
    old_node_pool_id: ''
  func: swap_nodepool
  module: chaosgcp.gke.nodepool.actions
  type: python
type: action

lb


add_latency_to_endpoint

Type action
Module chaosgcp.lb.actions
Name add_latency_to_endpoint
Return mapping

Add latency to a particular URL.

This is a high level shortcut to the inject_traffic_delay which infers all the appropriate parameters from the URL itself. It does this by querying the GCP project for all LB information and matches the correct target from there.

This might no work on all combinaison of Load Balancer and backend services that GCP support but should work well with LB + Cloud Run.

The latency is expressed in seconds with a default set to 0.3 seconds.

Signature:

def add_latency_to_endpoint(
        url: str,
        latency: float = 0.3,
        percentage: float = 90.0,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url string Yes
latency number 0.3 No
percentage number 90.0 No
project_id string null No
region string null No

Usage:

{
  "name": "add-latency-to-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "add_latency_to_endpoint",
    "arguments": {
      "url": ""
    }
  }
}
name: add-latency-to-endpoint
provider:
  arguments:
    url: ''
  func: add_latency_to_endpoint
  module: chaosgcp.lb.actions
  type: python
type: action

get_backend_service_health

Type probe
Module chaosgcp.lb.probes
Name get_backend_service_health
Return list

Fetch the latest health check result of the given backend service.

See also: https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.services.backend_services.BackendServicesClient#google_cloud_compute_v1_services_backend_services_BackendServicesClient_get_health

Signature:

def get_backend_service_health(
        backend_service: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
backend_service string Yes
project_id string null No
region string null No

Usage:

{
  "name": "get-backend-service-health",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.probes",
    "func": "get_backend_service_health",
    "arguments": {
      "backend_service": ""
    }
  }
}
name: get-backend-service-health
provider:
  arguments:
    backend_service: ''
  func: get_backend_service_health
  module: chaosgcp.lb.probes
  type: python
type: probe

get_fault_injection_traffic_policy

Type probe
Module chaosgcp.lb.probes
Name get_fault_injection_traffic_policy
Return mapping

Get the fault injection policy from url map at a given path.

The target_name argument is the the name of a path matcher in the URL map. The target_path argument is the path within the path matcher. Be sure to put the exact one you are targeting.

For instance:

{
    "type: "probe",
    "name": "get-fault-injection-policy",
    "provider": {
   "type": "python",
   "module": "chaosgcp.lb.probes",
   "func": "get_fault_injection_traffic_policy",
   "arguments": {
  "url_map": "demo-urlmap",
  "target_name": "allpaths",
  "target_path": "/*",
   }
    }
}

Set regional to talk to a regional LB.

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

Signature:

def get_fault_injection_traffic_policy(
        url_map: str,
        target_name: str,
        target_path: str = '/*',
        regional: bool = False,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url_map string Yes
target_name string Yes
target_path string ”/*” No
regional boolean false No
project_id string null No
region string null No

Usage:

{
  "name": "get-fault-injection-traffic-policy",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.probes",
    "func": "get_fault_injection_traffic_policy",
    "arguments": {
      "url_map": "",
      "target_name": ""
    }
  }
}
name: get-fault-injection-traffic-policy
provider:
  arguments:
    target_name: ''
    url_map: ''
  func: get_fault_injection_traffic_policy
  module: chaosgcp.lb.probes
  type: python
type: probe

inject_traffic_delay

Type action
Module chaosgcp.lb.actions
Name inject_traffic_delay
Return mapping

Add/set delay for a percentage of requests going through a url map on a given path.

This will not work with classic LB.

Note also, that the LB may be slow to reflect the change. It can take up to a couple of minutes from our experience before it propagates accordingly.

The target_name argument is the the name of a path matcher in the URL map. The target_path argument is the path within the path matcher. Be sure to put the exact one you are targeting.

This action supports looking into path rules as well as route rules (with prefix match, full path match or regex match).

For instance:

{
    "type: "action",
    "name": "add-delay-to-home-page",
    "provider": {
   "type": "python",
   "module": "chaosgcp.lb.actions",
   "func": "inject_traffic_delay",
   "arguments": {
  "url_map": "demo-urlmap",
  "target_name": "allpaths",
  "target_path": "/*",
  "impacted_percentage": 75.0,
  "delay_in_seconds": 3,
   }
    }
}

Set regional to talk to a regional LB.

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

Signature:

def inject_traffic_delay(
        url_map: str,
        target_name: str,
        target_path: str = '/*',
        impacted_percentage: float = 50.0,
        delay_in_seconds: int = 1,
        delay_in_nanos: int = 0,
        regional: bool = False,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url_map string Yes
target_name string Yes
target_path string ”/*” No
impacted_percentage number 50.0 No
delay_in_seconds integer 1 No
delay_in_nanos integer 0 No
regional boolean false No
project_id string null No
region string null No

Usage:

{
  "name": "inject-traffic-delay",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "inject_traffic_delay",
    "arguments": {
      "url_map": "",
      "target_name": ""
    }
  }
}
name: inject-traffic-delay
provider:
  arguments:
    target_name: ''
    url_map: ''
  func: inject_traffic_delay
  module: chaosgcp.lb.actions
  type: python
type: action

inject_traffic_faults

Type action
Module chaosgcp.lb.actions
Name inject_traffic_faults
Return mapping

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

Note also, that the LB may be slow to reflect the change. It can take up to a couple of minutes from our experience before it propagates accordingly.

The target_name argument is the the name of a path matcher in the URL map. The target_path argument is the path within the path matcher. Be sure to put the exact one you are targeting.

For instance:

{
    "type: "action",
    "name": "return-503-from-home-page",
    "provider": {
   "type": "python",
   "module": "chaosgcp.lb.actions",
   "func": "inject_traffic_faults",
   "arguments": {
  "url_map": "demo-urlmap",
  "target_name": "allpaths",
  "target_path": "/*",
  "impacted_percentage": 75.0,
  "http_status": 503,
   }
    }
}

Set regional to talk to a regional LB.

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,
        regional: bool = False,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url_map string Yes
target_name string Yes
target_path string ”/*” No
impacted_percentage number 50.0 No
http_status integer 400 No
regional boolean false No
project_id string null No
region string null No

Usage:

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

remove_fault_injection_traffic_policy

Type action
Module chaosgcp.lb.actions
Name remove_fault_injection_traffic_policy
Return mapping

Remove any fault injection policy from url map on a given path.

The target_name argument is the the name of a path matcher in the URL map. The target_path argument is the path within the path matcher. Be sure to put the exact one you are targeting.

For instance:

{
    "type: "action",
    "name": "remove-fault-injection-policy",
    "provider": {
   "type": "python",
   "module": "chaosgcp.lb.actions",
   "func": "remove_fault_injection_traffic_policy",
   "arguments": {
  "url_map": "demo-urlmap",
  "target_name": "allpaths",
  "target_path": "/*",
   }
    }
}

Set regional to talk to a regional LB.

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

Signature:

def remove_fault_injection_traffic_policy(
        url_map: str,
        target_name: str,
        target_path: str = '/*',
        regional: bool = False,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url_map string Yes
target_name string Yes
target_path string ”/*” No
regional boolean false No
project_id string null No
region string null No

Usage:

{
  "name": "remove-fault-injection-traffic-policy",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "remove_fault_injection_traffic_policy",
    "arguments": {
      "url_map": "",
      "target_name": ""
    }
  }
}
name: remove-fault-injection-traffic-policy
provider:
  arguments:
    target_name: ''
    url_map: ''
  func: remove_fault_injection_traffic_policy
  module: chaosgcp.lb.actions
  type: python
type: action

remove_latency_from_endpoint

Type action
Module chaosgcp.lb.actions
Name remove_latency_from_endpoint
Return mapping

Remove latency from a particular URL.

This is a high level shortcut to the remove_fault_injection_traffic_policy which infers all the appropriate parameters from the URL itself. It does this by querying the GCP project for all LB information and matches the correct target from there.

Signature:

def remove_latency_from_endpoint(
        url: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url string Yes
project_id string null No
region string null No

Usage:

{
  "name": "remove-latency-from-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "remove_latency_from_endpoint",
    "arguments": {
      "url": ""
    }
  }
}
name: remove-latency-from-endpoint
provider:
  arguments:
    url: ''
  func: remove_latency_from_endpoint
  module: chaosgcp.lb.actions
  type: python
type: action

reset_status_code_on_endpoint

Type action
Module chaosgcp.lb.actions
Name reset_status_code_on_endpoint
Return mapping

Remove the status code set on an endpoint

This is a high level shortcut to the remove_fault_injection_traffic_policy which infers all the appropriate parameters from the URL itself. It does this by querying the GCP project for all LB information and matches the correct target from there.

Signature:

def reset_status_code_on_endpoint(
        url: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url string Yes
project_id string null No
region string null No

Usage:

{
  "name": "reset-status-code-on-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "reset_status_code_on_endpoint",
    "arguments": {
      "url": ""
    }
  }
}
name: reset-status-code-on-endpoint
provider:
  arguments:
    url: ''
  func: reset_status_code_on_endpoint
  module: chaosgcp.lb.actions
  type: python
type: action

set_status_code_on_endpoint

Type action
Module chaosgcp.lb.actions
Name set_status_code_on_endpoint
Return mapping

Set the status code on a particular URL.

This is a high level shortcut to the inject_traffic_faults which infers all the appropriate parameters from the URL itself. It does this by querying the GCP project for all LB information and matches the correct target from there.

This might no work on all combinaison of Load Balancer and backend services that GCP support but should work well with LB + Cloud Run.

Signature:

def set_status_code_on_endpoint(
        url: str,
        status_code: int = 400,
        percentage: float = 90.0,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
url string Yes
status_code integer 400 No
percentage number 90.0 No
project_id string null No
region string null No

Usage:

{
  "name": "set-status-code-on-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.lb.actions",
    "func": "set_status_code_on_endpoint",
    "arguments": {
      "url": ""
    }
  }
}
name: set-status-code-on-endpoint
provider:
  arguments:
    url: ''
  func: set_status_code_on_endpoint
  module: chaosgcp.lb.actions
  type: python
type: action

monitoring


get_metrics

Type probe
Module chaosgcp.monitoring.probes
Name get_metrics
Return list

Query for Cloud Monitoring metrics and returns a list of time series objects for the metric and period.

Refer to the documentation https://cloud.google.com/python/docs/reference/monitoring/latest/query to learn about the various flags.

Signature:

def get_metrics(
        metric_type: str,
        metric_labels_filters: Union[str, Dict[str, str], NoneType] = None,
        resource_labels_filters: Union[str, Dict[str, str], NoneType] = None,
        end_time: str = 'now',
        window: str = '5 minutes',
        aligner: int = 0,
        aligner_minutes: int = 1,
        reducer: int = 0,
        reducer_group_by: Optional[List[str]] = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
metric_type string Yes
metric_labels_filters object null No
resource_labels_filters object null No
end_time string “now” No
window string “5 minutes” No
aligner integer 0 No
aligner_minutes integer 1 No
reducer integer 0 No
reducer_group_by object null No
project_id string null No
region string null No

Usage:

{
  "name": "get-metrics",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "get_metrics",
    "arguments": {
      "metric_type": ""
    }
  }
}
name: get-metrics
provider:
  arguments:
    metric_type: ''
  func: get_metrics
  module: chaosgcp.monitoring.probes
  type: python
type: probe

get_slo_budget

Type probe
Module chaosgcp.monitoring.probes
Name get_slo_budget
Return list

Get SLO burn rate of a service.

The name argument is a full path to an SLO such as "projects/<project_id>/services/<service_name>/serviceLevelObjectives/<slo_id>"

See also: https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/timeseries-selectors

Signature:

def get_slo_budget(
        name: str,
        end_time: str = 'now',
        window: str = '5 minutes',
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
name string Yes
end_time string “now” No
window string “5 minutes” No
project_id string null No
region string null No

Usage:

{
  "name": "get-slo-budget",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "get_slo_budget",
    "arguments": {
      "name": ""
    }
  }
}
name: get-slo-budget
provider:
  arguments:
    name: ''
  func: get_slo_budget
  module: chaosgcp.monitoring.probes
  type: python
type: probe

get_slo_burn_rate

Type probe
Module chaosgcp.monitoring.probes
Name get_slo_burn_rate
Return list

Get SLO burn rate of a service.

The name argument is a full path to an SLO such as "projects/<project_id>/services/<service_name>/serviceLevelObjectives/<slo_id>"

See also: https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/timeseries-selectors

Signature:

def get_slo_burn_rate(
        name: str,
        end_time: str = 'now',
        window: str = '5 minutes',
        loopback_period: str = '300s',
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
name string Yes
end_time string “now” No
window string “5 minutes” No
loopback_period string “300s” No
project_id string null No
region string null No

Usage:

{
  "name": "get-slo-burn-rate",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "get_slo_burn_rate",
    "arguments": {
      "name": ""
    }
  }
}
name: get-slo-burn-rate
provider:
  arguments:
    name: ''
  func: get_slo_burn_rate
  module: chaosgcp.monitoring.probes
  type: python
type: probe

get_slo_from_url

Type probe
Module chaosgcp.monitoring.probes
Name get_slo_from_url
Return list

Get all SLOs associated directly with a URL from the load balancer perspective.

Signature:

def get_slo_from_url(
        url: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
url string Yes
project_id string null No
region string null No

Usage:

{
  "name": "get-slo-from-url",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "get_slo_from_url",
    "arguments": {
      "url": ""
    }
  }
}
name: get-slo-from-url
provider:
  arguments:
    url: ''
  func: get_slo_from_url
  module: chaosgcp.monitoring.probes
  type: python
type: probe

get_slo_health

Type probe
Module chaosgcp.monitoring.probes
Name get_slo_health
Return list

Get SLO Health of a service.

The name argument is a full path to an SLO such as "projects/<project_id>/services/<service_name>/serviceLevelObjectives/<slo_id>"

See also: https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/timeseries-selectors See also: https://cloud.google.com/python/docs/reference/monitoring/latest/google.cloud.monitoring_v3.types.Aggregation

Signature:

def get_slo_health(
        name: str,
        end_time: str = 'now',
        window: str = '5 minutes',
        alignment_period: int = 60,
        per_series_aligner: str = 'ALIGN_MEAN',
        cross_series_reducer: int = 'REDUCE_COUNT',
        group_by_fields: Union[str, List[str], NoneType] = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
name string Yes
end_time string “now” No
window string “5 minutes” No
alignment_period integer 60 No
per_series_aligner string “ALIGN_MEAN” No
cross_series_reducer integer “REDUCE_COUNT” No
group_by_fields object null No
project_id string null No
region string null No

Usage:

{
  "name": "get-slo-health",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "get_slo_health",
    "arguments": {
      "name": ""
    }
  }
}
name: get-slo-health
provider:
  arguments:
    name: ''
  func: get_slo_health
  module: chaosgcp.monitoring.probes
  type: python
type: probe

get_slo_health_from_url

Type probe
Module chaosgcp.monitoring.probes
Name get_slo_health_from_url
Return list

Get all SLO healths associated directly with a URL from the load balancer perspective.

Use this probe to efficientely retrieve the curerent health of SLOs associated with a particular URL endpoint.

Signature:

def get_slo_health_from_url(
        url: str,
        end_time: str = 'now',
        window: str = '5 minutes',
        alignment_period: int = 60,
        per_series_aligner: str = 'ALIGN_MEAN',
        cross_series_reducer: int = 'REDUCE_COUNT',
        group_by_fields: Union[str, List[str], NoneType] = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
url string Yes
end_time string “now” No
window string “5 minutes” No
alignment_period integer 60 No
per_series_aligner string “ALIGN_MEAN” No
cross_series_reducer integer “REDUCE_COUNT” No
group_by_fields object null No
project_id string null No
region string null No

Usage:

{
  "name": "get-slo-health-from-url",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "get_slo_health_from_url",
    "arguments": {
      "url": ""
    }
  }
}
name: get-slo-health-from-url
provider:
  arguments:
    url: ''
  func: get_slo_health_from_url
  module: chaosgcp.monitoring.probes
  type: python
type: probe

run_mql_query

Type probe
Module chaosgcp.monitoring.probes
Name run_mql_query
Return list

Execute a MQL query and return its results.

Use the project name or id.

Signature:

def run_mql_query(
        project: str,
        mql: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
project string Yes
mql string Yes
project_id string null No
region string null No

Usage:

{
  "name": "run-mql-query",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "run_mql_query",
    "arguments": {
      "project": "",
      "mql": ""
    }
  }
}
name: run-mql-query
provider:
  arguments:
    mql: ''
    project: ''
  func: run_mql_query
  module: chaosgcp.monitoring.probes
  type: python
type: probe

valid_slo_ratio_during_window

Type probe
Module chaosgcp.monitoring.probes
Name valid_slo_ratio_during_window
Return boolean

Compute SLO during various intervals of the window. Then for each returned interval, we compare the SLO with min_level (between 0 and 1.0).

Finally use the expected_ratio value (between 0 and 1.0) as the treshold which tells us if our service was reaching min_level for at least that number of time.

For instance, with expected_ratio set to 0.5 and min_level set to 0.8, we say that we want that 50% of the intervals have a SLO above 0.8.

The name argument is a full path to an SLO such as "projects/<project_id>/services/<service_name>/serviceLevelObjectives/<slo_id>"

This probe does not support point of type distribution_value.

See also: https://cloud.google.com/stackdriver/docs/solutions/slo-monitoring/api/timeseries-selectors See also: https://cloud.google.com/python/docs/reference/monitoring/latest/google.cloud.monitoring_v3.types.Aggregation See also: https://cloud.google.com/python/docs/reference/monitoring/latest/google.cloud.monitoring_v3.types.TypedValue

Signature:

def valid_slo_ratio_during_window(
        name: str,
        expected_ratio: float = 0.9,
        min_level: Union[float, int, bool, str] = 0.9,
        end_time: str = 'now',
        window: str = '5 minutes',
        alignment_period: int = 60,
        per_series_aligner: str = 'ALIGN_MEAN',
        cross_series_reducer: int = 'REDUCE_COUNT',
        group_by_fields: Union[str, List[str], NoneType] = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
name string Yes
expected_ratio number 0.9 No
min_level object 0.9 No
end_time string “now” No
window string “5 minutes” No
alignment_period integer 60 No
per_series_aligner string “ALIGN_MEAN” No
cross_series_reducer integer “REDUCE_COUNT” No
group_by_fields object null No
project_id string null No
region string null No

Usage:

{
  "name": "valid-slo-ratio-during-window",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.monitoring.probes",
    "func": "valid_slo_ratio_during_window",
    "arguments": {
      "name": ""
    }
  }
}
name: valid-slo-ratio-during-window
provider:
  arguments:
    name: ''
  func: valid_slo_ratio_during_window
  module: chaosgcp.monitoring.probes
  type: python
type: probe

neg


attach_network_endpoint_group

Type action
Module chaosgcp.neg.actions
Name attach_network_endpoint_group
Return null

Attach a list of network endpoints to the specified network endpoint group.

See https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.NetworkEndpoint for the content of each network endpoint.

Signature:

def attach_network_endpoint_group(
        network_endpoint_group: str,
        zone: str,
        endpoints: Optional[List[Dict[str, str]]] = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> None:
    pass

Arguments:

Name Type Default Required
network_endpoint_group string Yes
zone string Yes
endpoints object null No
project_id string null No
region string null No

Usage:

{
  "name": "attach-network-endpoint-group",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.neg.actions",
    "func": "attach_network_endpoint_group",
    "arguments": {
      "network_endpoint_group": "",
      "zone": ""
    }
  }
}
name: attach-network-endpoint-group
provider:
  arguments:
    network_endpoint_group: ''
    zone: ''
  func: attach_network_endpoint_group
  module: chaosgcp.neg.actions
  type: python
type: action

detach_network_endpoint_group

Type action
Module chaosgcp.neg.actions
Name detach_network_endpoint_group
Return null

Detach a list of network endpoints from the specified network endpoint group.

See https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.NetworkEndpoint for the content of each network endpoint.

Signature:

def detach_network_endpoint_group(
        network_endpoint_group: str,
        zone: str,
        endpoints: Optional[List[Dict[str, str]]] = None,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> None:
    pass

Arguments:

Name Type Default Required
network_endpoint_group string Yes
zone string Yes
endpoints object null No
project_id string null No
region string null No

Usage:

{
  "name": "detach-network-endpoint-group",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.neg.actions",
    "func": "detach_network_endpoint_group",
    "arguments": {
      "network_endpoint_group": "",
      "zone": ""
    }
  }
}
name: detach-network-endpoint-group
provider:
  arguments:
    network_endpoint_group: ''
    zone: ''
  func: detach_network_endpoint_group
  module: chaosgcp.neg.actions
  type: python
type: action

get_network_endpoint_group

Type probe
Module chaosgcp.neg.probes
Name get_network_endpoint_group
Return mapping

Get a single network endpoint group.

Signature:

def get_network_endpoint_group(
        network_endpoint_group: str,
        zone: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
network_endpoint_group string Yes
zone string Yes
project_id string null No
region string null No

Usage:

{
  "name": "get-network-endpoint-group",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.neg.probes",
    "func": "get_network_endpoint_group",
    "arguments": {
      "network_endpoint_group": "",
      "zone": ""
    }
  }
}
name: get-network-endpoint-group
provider:
  arguments:
    network_endpoint_group: ''
    zone: ''
  func: get_network_endpoint_group
  module: chaosgcp.neg.probes
  type: python
type: probe

list_network_endpoint_groups

Type probe
Module chaosgcp.neg.probes
Name list_network_endpoint_groups
Return list

List all network endpoint groups in the zone.

Signature:

def list_network_endpoint_groups(
        zone: str,
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
zone string Yes
project_id string null No
region string null No

Usage:

{
  "name": "list-network-endpoint-groups",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.neg.probes",
    "func": "list_network_endpoint_groups",
    "arguments": {
      "zone": ""
    }
  }
}
name: list-network-endpoint-groups
provider:
  arguments:
    zone: ''
  func: list_network_endpoint_groups
  module: chaosgcp.neg.probes
  type: python
type: probe

networkconnectivity


create_policy_based_route

Type action
Module chaosgcp.networkconnectivity.actions
Name create_policy_based_route
Return mapping

Create a policy based route Please refer to this: https://t.ly/soPz7

:param parent_value: for example: “projects/${var.project_id}/locations/global”, :param name: the name of the route, :param next_hop_ilb_ip: IP of the next hop internal load balancer, :param network: GCP network name, :param src_range: Source CIDR range, :param dest_range: Desination CIDR range, :param priority: the piority of the route, :return JSON Response which is in form of dictionary

Signature:

def create_policy_based_route(
        parent_value: str,
        name: str,
        next_hop_ilb_ip: str,
        network: str,
        src_range: str,
        dest_range: str,
        priority: int,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
parent_value string Yes
name string Yes
next_hop_ilb_ip string Yes
network string Yes
src_range string Yes
dest_range string Yes
priority integer Yes

Usage:

{
  "name": "create-policy-based-route",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.networkconnectivity.actions",
    "func": "create_policy_based_route",
    "arguments": {
      "parent_value": "",
      "name": "",
      "next_hop_ilb_ip": "",
      "network": "",
      "src_range": "",
      "dest_range": "",
      "priority": 0
    }
  }
}
name: create-policy-based-route
provider:
  arguments:
    dest_range: ''
    name: ''
    network: ''
    next_hop_ilb_ip: ''
    parent_value: ''
    priority: 0
    src_range: ''
  func: create_policy_based_route
  module: chaosgcp.networkconnectivity.actions
  type: python
type: action

delete_policy_based_route

Type action
Module chaosgcp.networkconnectivity.actions
Name delete_policy_based_route
Return mapping

Delete a policy based route Please refer to this: https://t.ly/VnEPU

:param name_value: the name of the route, :return JSON Response which is in form of dictionary

Signature:

def delete_policy_based_route(name_value: str) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name_value string Yes

Usage:

{
  "name": "delete-policy-based-route",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.networkconnectivity.actions",
    "func": "delete_policy_based_route",
    "arguments": {
      "name_value": ""
    }
  }
}
name: delete-policy-based-route
provider:
  arguments:
    name_value: ''
  func: delete_policy_based_route
  module: chaosgcp.networkconnectivity.actions
  type: python
type: action

sql


describe_instance

Type probe
Module chaosgcp.sql.probes
Name describe_instance
Return mapping

Displays configuration and metadata about a Cloud SQL instance.

Information such as instance name, IP address, region, the CA certificate and configuration settings will be displayed.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/get

:param instance_id: Cloud SQL instance ID.

Signature:

def describe_instance(
        instance_id: str,
        project_id: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
instance_id string Yes
project_id string null No

Usage:

{
  "name": "describe-instance",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.probes",
    "func": "describe_instance",
    "arguments": {
      "instance_id": ""
    }
  }
}
name: describe-instance
provider:
  arguments:
    instance_id: ''
  func: describe_instance
  module: chaosgcp.sql.probes
  type: python
type: probe

disable_replication

Type action
Module chaosgcp.sql.actions
Name disable_replication
Return mapping

Disable replication on a read replica.

See also: https://cloud.google.com/sql/docs/postgres/replication/manage-replicas#disable_replication

Signature:

def disable_replication(
        replica_name: str,
        project_id: str = None,
        wait_until_complete: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
replica_name string Yes
project_id string null No
wait_until_complete boolean true No

Usage:

{
  "name": "disable-replication",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.actions",
    "func": "disable_replication",
    "arguments": {
      "replica_name": ""
    }
  }
}
name: disable-replication
provider:
  arguments:
    replica_name: ''
  func: disable_replication
  module: chaosgcp.sql.actions
  type: python
type: action

enable_replication

Type action
Module chaosgcp.sql.actions
Name enable_replication
Return mapping

Enable replication on a read replica.

See also: https://cloud.google.com/sql/docs/postgres/replication/manage-replicas#enable_replication

Signature:

def enable_replication(
        replica_name: str,
        project_id: str = None,
        wait_until_complete: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
replica_name string Yes
project_id string null No
wait_until_complete boolean true No

Usage:

{
  "name": "enable-replication",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.actions",
    "func": "enable_replication",
    "arguments": {
      "replica_name": ""
    }
  }
}
name: enable-replication
provider:
  arguments:
    replica_name: ''
  func: enable_replication
  module: chaosgcp.sql.actions
  type: python
type: action

export_data

Type action
Module chaosgcp.sql.actions
Name export_data
Return mapping

Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/export

If project_id is given, it will take precedence over the global project ID defined at the configuration level.

Signature:

def export_data(instance_id: str,
                storage_uri: str,
                project_id: str = None,
                file_type: str = 'sql',
                databases: List[str] = None,
                tables: List[str] = None,
                export_schema_only: bool = False,
                wait_until_complete: bool = True,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
instance_id string Yes
storage_uri string Yes
project_id string null No
file_type string “sql” No
databases list null No
tables list null No
export_schema_only boolean false No
wait_until_complete boolean true No

Usage:

{
  "name": "export-data",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.actions",
    "func": "export_data",
    "arguments": {
      "instance_id": "",
      "storage_uri": ""
    }
  }
}
name: export-data
provider:
  arguments:
    instance_id: ''
    storage_uri: ''
  func: export_data
  module: chaosgcp.sql.actions
  type: python
type: action

import_data

Type action
Module chaosgcp.sql.actions
Name import_data
Return mapping

Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/import

If project_id is given, it will take precedence over the global project ID defined at the configuration level.

Signature:

def import_data(instance_id: str,
                storage_uri: str,
                database: str,
                project_id: str = None,
                file_type: str = 'sql',
                import_user: str = None,
                table: str = None,
                columns: List[str] = None,
                wait_until_complete: bool = True,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
instance_id string Yes
storage_uri string Yes
database string Yes
project_id string null No
file_type string “sql” No
import_user string null No
table string null No
columns list null No
wait_until_complete boolean true No

Usage:

{
  "name": "import-data",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.actions",
    "func": "import_data",
    "arguments": {
      "instance_id": "",
      "storage_uri": "",
      "database": ""
    }
  }
}
name: import-data
provider:
  arguments:
    database: ''
    instance_id: ''
    storage_uri: ''
  func: import_data
  module: chaosgcp.sql.actions
  type: python
type: action

list_instances

Type probe
Module chaosgcp.sql.probes
Name list_instances
Return mapping

Lists Cloud SQL instances in a given project in the alphabetical order of the instance name.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/list

Signature:

def list_instances(
        project_id: str = None,
        region: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
project_id string null No
region string null No

Usage:

{
  "name": "list-instances",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.probes",
    "func": "list_instances"
  }
}
name: list-instances
provider:
  func: list_instances
  module: chaosgcp.sql.probes
  type: python
type: probe

restore_backup

Type action
Module chaosgcp.sql.actions
Name restore_backup
Return mapping

Performs a restore of a given backup. If target_instance_id is not set then source and target are the same. If backup_run_id is not set, then it picks the most recent backup automatically.

You may wait for the operation to complete, but bear in mind this can take several minutes.

Signature:

def restore_backup(
        source_instance_id: str,
        target_instance_id: Optional[str] = None,
        backup_run_id: Optional[str] = None,
        project_id: str = None,
        wait_until_complete: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
source_instance_id string Yes
target_instance_id object null No
backup_run_id object null No
project_id string null No
wait_until_complete boolean true No

Usage:

{
  "name": "restore-backup",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.actions",
    "func": "restore_backup",
    "arguments": {
      "source_instance_id": ""
    }
  }
}
name: restore-backup
provider:
  arguments:
    source_instance_id: ''
  func: restore_backup
  module: chaosgcp.sql.actions
  type: python
type: action

trigger_failover

Type action
Module chaosgcp.sql.actions
Name trigger_failover
Return mapping

Causes a high-availability Cloud SQL instance to failover.

See: https://cloud.google.com/sql/docs/postgres/admin-api/v1/instances/failover

:param instance_id: Cloud SQL instance ID. :param wait_until_complete: wait for the operation in progress to complete. :param settings_version: The current settings version of this instance.

:return:

Signature:

def trigger_failover(
        instance_id: str,
        wait_until_complete: bool = True,
        settings_version: Optional[int] = None,
        project_id: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
instance_id string Yes
wait_until_complete boolean true No
settings_version object null No
project_id string null No

Usage:

{
  "name": "trigger-failover",
  "type": "action",
  "provider": {
    "type": "python",
    "module": "chaosgcp.sql.actions",
    "func": "trigger_failover",
    "arguments": {
      "instance_id": ""
    }
  }
}
name: trigger-failover
provider:
  arguments:
    instance_id: ''
  func: trigger_failover
  module: chaosgcp.sql.actions
  type: python
type: action

storage


object_exists

Type probe
Module chaosgcp.storage.probes
Name object_exists
Return boolean

Indicates whether a file in Cloud Storage bucket exists.

:param bucket_name: name of the bucket :param object_name: name of the object within the bucket as path :param configuration: :param secrets:

Signature:

def object_exists(bucket_name: str,
                  object_name: str,
                  configuration: Dict[str, Dict[str, str]] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
bucket_name string Yes
object_name string Yes

Usage:

{
  "name": "object-exists",
  "type": "probe",
  "provider": {
    "type": "python",
    "module": "chaosgcp.storage.probes",
    "func": "object_exists",
    "arguments": {
      "bucket_name": "",
      "object_name": ""
    }
  }
}
name: object-exists
provider:
  arguments:
    bucket_name: ''
    object_name: ''
  func: object_exists
  module: chaosgcp.storage.probes
  type: python
type: probe