Skip to main content

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.

YAML only feature

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.

FieldDescriptionTypeRangeNotes
nameFlag to hold the name of the probeMandatoryN/A type: stringThe name holds the name of the probe. It can be set based on the usecase
typeFlag to hold the type of the probeMandatoryhttpProbe, k8sProbe, cmdProbe, promProbeThe type supports four types of probes. It can one of the httpProbe, k8sProbe, cmdProbe, promProbe
modeFlag to hold the mode of the probeMandatorySOT, EOT, Edge, Continuous, OnChaosThe mode supports five modes of probes. It can one of the SOT, EOT, Edge, Continuous, OnChaos
urlFlag to hold the URL for the httpProbeMandatoryN/A type: stringThe url contains the URL which the experiment uses to gauge health/service availability (or other custom conditions) as part of the entry/exit criteria.
insecureSkipVerifyFlag to hold the flag to skip certificate checks for the httpProbeOptionaltrue, falseThe insecureSkipVerify contains flag to skip certificate checks.
responseTimeoutFlag to hold the flag to response timeout for the httpProbeOptionalN/A type: integerThe responseTimeout contains flag to provide the response timeout for the http Get/Post request.

Method

GET method properties

FieldDescriptionTypeRangeNotes
criteriaFlag to hold the criteria for the http get requestMandatory==, !=, oneOfThe 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
responseCodeFlag to hold the expected response code for the get requestMandatoryHTTP_RESPONSE_CODEThe responseCode contains the expected response code for the http get request as part of httpProbe run

POST method properties

FieldDescriptionTypeRangeNotes
criteriaFlag to hold the criteria for the http post requestMandatory==, !=, oneOfThe 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
responseCodeFlag to hold the expected response code for the post requestMandatoryHTTP_RESPONSE_CODEThe responseCode contains the expected response code for the http post request as part of httpProbe run
contentTypeFlag to hold the content type of the post requestMandatoryN/A type: stringThe contentType contains the content type of the http body data, which need to be passed for the http post request
bodyFlag to hold the body of the http post requestMandatoryN/A type: stringThe 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.
bodyPathFlag to hold the path of the http body, required for the http post requestOptionalN/A type: stringThe 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

FieldDescriptionTypeRangeNotes
probeTimeoutFlag to hold the timeout of the probeMandatoryN/A type: integerThe probeTimeout represents the time limit for the probe to execute the specified check and return the expected data
retryFlag to hold the retry count of the probeMandatoryN/A type: integerThe retry contains the number of times a check is re-run upon failure in the first attempt before declaring the probe status as failed.
intervalFlag to hold the interval of the probeMandatoryN/A type: integerThe interval contains the interval for which probes waits between subsequent retries
probePollingIntervalFlag to hold the polling interval for the probes (applicable for all modes)OptionalN/A type: integerThe probePollingInterval contains the time interval for which continuous probe should be sleep after each iteration
initialDelaySecondsFlag to hold the initial delay interval for the probesOptionalN/A type: integerThe initialDelaySeconds represents the initial waiting time interval for the probes.
stopOnFailureFlags to hold the stop or continue the experiment on probe failureOptionalN/A type: booleanThe stopOnFailure can be set to true/false to stop or continue the experiment execution after probe fails

Authentication

This establishes a fundamental authentication mechanism for the http endpoint. The username:password, encoded in base64 or bearer token should be placed either within the credentials field or as a file path in the credentialsFile field. It's important to note that credentials and credentialsFile are two options that cannot be used simultaneously.

FieldDescriptionTypeRangeNotes
typeFlag to hold the authentication typeOptionalstringThe type encompasses the authentication method, which includes support for both Basic and Bearer authentication types
credentialsFlag to hold the basic auth credentials or bearer tokenOptionalstringThe credentials consists of the basic authentication credentials, either as username:password encoded in base64 format or as a bearer token, depending on the authentication type
credentialsFileFlag to hold the basic auth credentials or bearer token file pathOptionalstringThe credentials consists of file path for basic authentication credentials or a bearer token, which are then attached to the experiment pod as volume secrets. These secret resources contain either the username:password encoded in base64 format or a bearer token, depending on the authentication type

TLS

It offers the mechanism to validate TLS certifications for the http endpoint. You can supply the cacert or the client certificate and client key, to perform the validation. Alternatively, you have the option to enable the insecureSkipVerify check to bypass certificate validation.

FieldDescriptionTypeRangeNotes
caFileFlag to hold the ca file pathOptionalstringThe caFile holds the file path of the CA certificates utilized for server TLS verification
certFileFlag to hold the client cert file pathOptionalstringThe certFile holds the file path of the client certificates utilized for TLS verification
keyFileFlag to hold the client key file pathOptionalstringThe keyFile holds the file path of the client key utilized for TLS verification
insecureSkipVerifyFlag to skip the tls certificates checksOptionalbooleanThe insecureSkipVerify skip the tls certificates checks

Definition

probe:
- name: "check-frontend-access-url"
type: "httpProbe"
httpProbe/inputs:
url: "<url>"
insecureSkipVerify: false
responseTimeout: <value> # in milli seconds
auth:
type: Bearer
credentials: "<bearer token>"
tlsConfig:
caFile: "/etc/secret/ca.crt"
method:
get:
criteria: == # supports == & != and oneof operations
responseCode: "<response code>"
mode: "Continuous"
runProperties:
probeTimeout: 5
interval: 5
retry: 1
probePollingInterval: 2