HTTP probe
HTTP probe allows you to specify a URL that the experiment uses to determine the health or service availability (or other custom conditions) that is a part of the entry or exit criteria. The status code received is mapped against an expected status. It supports HTTP GET and POST methods.
The HTTP GET method sends a GET request to the specified URL. The response code received is matched with the response code based on the given criteria (==
, !=
, oneOf
).
HTTP POST method sends a POST
request to the provided URL.
In the case of a complex POST
request in which the body spans multiple lines, the bodyPath
attribute is used to specify the path to a file consisting of the same. This file is available to the experiment pod through a ConfigMap resource, wherein the ConfigMap name is defined in the chaos engine or the chaos experiment CR. The body
and bodyPath
attributes are mutually exclusive. Go to probe schema to learn more.
Defining the probe
You can define the probes at .spec.experiments[].spec.probe path inside the chaos engine.
kind: Workflow
apiVersion: argoproj.io/v1alpha1
spec:
templates:
- inputs:
artifacts:
- raw:
data: |
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
spec:
experiments:
- spec:
probe:
####################################
Probes are defined here
####################################
Schema
Listed below is the probe schema for HTTP Probe with common properties shared across all probes and properties unique to HTTP probe.
Field | Description | Type | Range | Notes |
name | Flag to hold the name of the probe | Mandatory | N/A type: string | The name holds the name of the probe. It can be set based on the usecase |
type | Flag to hold the type of the probe | Mandatory | httpProbe, k8sProbe, cmdProbe, promProbe | The type supports four types of probes. It can one of the httpProbe, k8sProbe, cmdProbe, promProbe |
mode | Flag to hold the mode of the probe | Mandatory | SOT, EOT, Edge, Continuous, OnChaos | The mode supports five modes of probes. It can one of the SOT, EOT, Edge, Continuous, OnChaos |
url | Flag to hold the URL for the httpProbe | Mandatory | N/A type: string | The url contains the URL which the experiment uses to gauge health/service availability (or other custom conditions) as part of the entry/exit criteria. |
insecureSkipVerify | Flag to hold the flag to skip certificate checks for the httpProbe | Optional | true, false | The insecureSkipVerify contains flag to skip certificate checks. |
responseTimeout | Flag to hold the flag to response timeout for the httpProbe | Optional | N/A type: integer | The responseTimeout contains flag to provide the response timeout for the http Get/Post request. |
Method
GET method properties
Field | Description | Type | Range | Notes |
criteria | Flag to hold the criteria for the http get request | Mandatory | ==, !=, oneOf | The criteria contains criteria to match the http get request's response code with the expected responseCode, which need to be fulfill as part of httpProbe run |
responseCode | Flag to hold the expected response code for the get request | Mandatory | HTTP_RESPONSE_CODE | The responseCode contains the expected response code for the http get request as part of httpProbe run |
POST method properties
Field | Description | Type | Range | Notes |
criteria | Flag to hold the criteria for the http post request | Mandatory | ==, !=, oneOf | The criteria contains criteria to match the http post request's response code with the expected responseCode, which need to be fulfill as part of httpProbe run |
responseCode | Flag to hold the expected response code for the post request | Mandatory | HTTP_RESPONSE_CODE | The responseCode contains the expected response code for the http post request as part of httpProbe run |
contentType | Flag to hold the content type of the post request | Mandatory | N/A type: string | The contentType contains the content type of the http body data, which need to be passed for the http post request |
body | Flag to hold the body of the http post request | Mandatory | N/A type: string | The body contains the http body, which is required for the http post request. It is used for the simple http body. If the http body is complex then use bodyPath field. |
bodyPath | Flag to hold the path of the http body, required for the http post request | Optional | N/A type: string | The bodyPath This field is used in case of complex POST request in which the body spans multiple lines, the bodyPath attribute can be used to provide the path to a file consisting of the same. This file can be made available to the experiment pod via a ConfigMap resource, with the ConfigMap name being defined in the ChaosEngine OR the ChaosExperiment CR. |
Run properties
Field | Description | Type | Range | Notes |
probeTimeout | Flag to hold the timeout of the probe | Mandatory | N/A type: integer | The probeTimeout represents the time limit for the probe to execute the specified check and return the expected data |
retry | Flag to hold the retry count of the probe | Mandatory | N/A type: integer | The retry contains the number of times a check is re-run upon failure in the first attempt before declaring the probe status as failed. |
interval | Flag to hold the interval of the probe | Mandatory | N/A type: integer | The interval contains the interval for which probes waits between subsequent retries |
probePollingInterval | Flag to hold the polling interval for the probes (applicable for all modes) | Optional | N/A type: integer | The probePollingInterval contains the time interval for which continuous probe should be sleep after each iteration |
initialDelaySeconds | Flag to hold the initial delay interval for the probes | Optional | N/A type: integer | The initialDelaySeconds represents the initial waiting time interval for the probes. |
stopOnFailure | Flags to hold the stop or continue the experiment on probe failure | Optional | N/A type: boolean | The stopOnFailure can be set to true/false to stop or continue the experiment execution after probe fails |
Definition
probe:
- name: "check-frontend-access-url"
type: "httpProbe"
httpProbe/inputs:
url: "<url>"
insecureSkipVerify: false
responseTimeout: <value> # in milli seconds
method:
get:
criteria: == # supports == & != and oneof operations
responseCode: "<response code>"
mode: "Continuous"
runProperties:
probeTimeout: 5
interval: 5
retry: 1
probePollingInterval: 2