From 98f26e326c6a76610b56533070e7d128421b3c95 Mon Sep 17 00:00:00 2001 From: Akash Shrivastava Date: Mon, 19 Sep 2022 10:53:34 +0530 Subject: [PATCH] Updated docs for new additions in HTTP Chaos (#3755) * Updated docs for response body in status code and content encodng and type addition Signed-off-by: avaakash * added 'container' in target service port explanation Signed-off-by: avaakash * removed containerd,crio references from pod-dns docs Signed-off-by: avaakash Signed-off-by: avaakash --- .../categories/pods/pod-dns-error.md | 34 ++--- .../container-runtime-and-socket-path.yaml | 2 +- .../categories/pods/pod-dns-spoof.md | 32 ++--- .../categories/pods/pod-http-modify-body.md | 77 ++++++++-- .../modify-body-with-encoding-type.yaml | 31 ++++ .../categories/pods/pod-http-status-code.md | 132 +++++++++++++++--- .../modify-body-with-encoding-type.yaml | 35 +++++ ...modify-body-with-response-pre-defined.yaml | 27 ++++ .../modify-body-with-response.yaml | 5 +- 9 files changed, 310 insertions(+), 65 deletions(-) create mode 100644 mkdocs/docs/experiments/categories/pods/pod-http-modify-body/modify-body-with-encoding-type.yaml create mode 100644 mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-encoding-type.yaml create mode 100644 mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response-pre-defined.yaml diff --git a/mkdocs/docs/experiments/categories/pods/pod-dns-error.md b/mkdocs/docs/experiments/categories/pods/pod-dns-error.md index 208119acd..459cb7fb5 100644 --- a/mkdocs/docs/experiments/categories/pods/pod-dns-error.md +++ b/mkdocs/docs/experiments/categories/pods/pod-dns-error.md @@ -3,29 +3,29 @@ - Pod-dns-error injects chaos to disrupt dns resolution in kubernetes pods. - It causes loss of access to services by blocking dns resolution of hostnames/domains -!!! tip "Scenario: DNS error for the target pod" +!!! tip "Scenario: DNS error for the target pod" ![Pod DNS Error](../../images/dns-chaos.png) ## Uses -??? info "View the uses of the experiment" +??? info "View the uses of the experiment" coming soon ## Prerequisites -??? info "Verify the prerequisites" - - Ensure that Kubernetes Version > 1.16 +??? info "Verify the prerequisites" + - Ensure that Kubernetes Version > 1.16 - Ensure that the Litmus Chaos Operator is running by executing kubectl get pods in operator namespace (typically, litmus).If not, install from here - - Ensure that the pod-dns-error experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here + - Ensure that the pod-dns-error experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here ## Default Validations -??? info "View the default validations" +??? info "View the default validations" The application pods should be in running state before and after chaos injection. ## Minimal RBAC configuration example (optional) -!!! tip "NOTE" +!!! tip "NOTE" If you are using this experiment as part of a litmus workflow scheduled constructed & executed from chaos-center, then you may be making use of the [litmus-admin](https://litmuschaos.github.io/litmus/litmus-admin-rbac.yaml) RBAC, which is pre installed in the cluster as part of the agent setup. ??? note "View the Minimal RBAC permissions" @@ -63,10 +63,10 @@ - apiGroups: [""] resources: ["configmaps"] verbs: ["get","list",] - # Track and get the runner, experiment, and helper pods log + # Track and get the runner, experiment, and helper pods log - apiGroups: [""] resources: ["pods/log"] - verbs: ["get","list","watch"] + verbs: ["get","list","watch"] # for creating and managing to execute comands inside target container - apiGroups: [""] resources: ["pods/exec"] @@ -75,7 +75,7 @@ - apiGroups: ["apps"] resources: ["deployments","statefulsets","replicasets", "daemonsets"] verbs: ["list","get"] - # deriving the parent/owner details of the pod(if parent is deploymentConfig) + # deriving the parent/owner details of the pod(if parent is deploymentConfig) - apiGroups: ["apps.openshift.io"] resources: ["deploymentconfigs"] verbs: ["list","get"] @@ -117,7 +117,7 @@ ## Experiment tunables -??? info "check the experiment tunables" +??? info "check the experiment tunables"

Optional Fields

@@ -140,25 +140,25 @@ - + - + - + - + - + @@ -187,7 +187,7 @@ ### Common and Pod specific tunables -Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. +Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. ### Target Host Names diff --git a/mkdocs/docs/experiments/categories/pods/pod-dns-error/container-runtime-and-socket-path.yaml b/mkdocs/docs/experiments/categories/pods/pod-dns-error/container-runtime-and-socket-path.yaml index d3c0616ad..d419e3ebe 100644 --- a/mkdocs/docs/experiments/categories/pods/pod-dns-error/container-runtime-and-socket-path.yaml +++ b/mkdocs/docs/experiments/categories/pods/pod-dns-error/container-runtime-and-socket-path.yaml @@ -17,7 +17,7 @@ spec: components: env: # runtime for the container - # supports docker, containerd, crio + # supports docker - name: CONTAINER_RUNTIME value: 'docker' # path of the socket file diff --git a/mkdocs/docs/experiments/categories/pods/pod-dns-spoof.md b/mkdocs/docs/experiments/categories/pods/pod-dns-spoof.md index b36bcf3b8..524ee17a9 100644 --- a/mkdocs/docs/experiments/categories/pods/pod-dns-spoof.md +++ b/mkdocs/docs/experiments/categories/pods/pod-dns-spoof.md @@ -3,29 +3,29 @@ - Pod-dns-spoof injects chaos to spoof dns resolution in kubernetes pods. - It causes dns resolution of target hostnames/domains to wrong IPs as specified by SPOOF_MAP in the engine config. -!!! tip "Scenario: DNS spoof for the target pod" +!!! tip "Scenario: DNS spoof for the target pod" ![Pod DNS Spoof](../../images/dns-chaos.png) ## Uses -??? info "View the uses of the experiment" +??? info "View the uses of the experiment" coming soon ## Prerequisites -??? info "Verify the prerequisites" - - Ensure that Kubernetes Version > 1.16 +??? info "Verify the prerequisites" + - Ensure that Kubernetes Version > 1.16 - Ensure that the Litmus Chaos Operator is running by executing kubectl get pods in operator namespace (typically, litmus).If not, install from here - - Ensure that the pod-dns-spoof experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here + - Ensure that the pod-dns-spoof experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here ## Default Validations -??? info "View the default validations" +??? info "View the default validations" The application pods should be in running state before and after chaos injection. ## Minimal RBAC configuration example (optional) -!!! tip "NOTE" +!!! tip "NOTE" If you are using this experiment as part of a litmus workflow scheduled constructed & executed from chaos-center, then you may be making use of the [litmus-admin](https://litmuschaos.github.io/litmus/litmus-admin-rbac.yaml) RBAC, which is pre installed in the cluster as part of the agent setup. ??? note "View the Minimal RBAC permissions" @@ -63,10 +63,10 @@ - apiGroups: [""] resources: ["configmaps"] verbs: ["get","list",] - # Track and get the runner, experiment, and helper pods log + # Track and get the runner, experiment, and helper pods log - apiGroups: [""] resources: ["pods/log"] - verbs: ["get","list","watch"] + verbs: ["get","list","watch"] # for creating and managing to execute comands inside target container - apiGroups: [""] resources: ["pods/exec"] @@ -75,7 +75,7 @@ - apiGroups: ["apps"] resources: ["deployments","statefulsets","replicasets", "daemonsets"] verbs: ["list","get"] - # deriving the parent/owner details of the pod(if parent is deploymentConfig) + # deriving the parent/owner details of the pod(if parent is deploymentConfig) - apiGroups: ["apps.openshift.io"] resources: ["deploymentconfigs"] verbs: ["list","get"] @@ -117,7 +117,7 @@ ## Experiment tunables -??? info "check the experiment tunables" +??? info "check the experiment tunables"

Optional Fields

TARGET_HOSTNAMES List of the target hostnames or keywords eg. '["litmuschaos","chaosnative.com"]' If not provided, all hostnames/domains will be targeted
MATCH_SCHEME Determines whether the dns query has to match exactly with one of the targets or can have any of the targets as substring. Can be either exact or substring if not provided, it will be set as exact
PODS_AFFECTED_PERC The Percentage of total pods to target Defaults to 0 (corresponds to 1 replica), provide numeric value only
CONTAINER_RUNTIME container runtime interface for the cluster Defaults to docker, supported values: docker, containerd and crio Defaults to docker, supported values: docker
SOCKET_PATH Path of the containerd/crio/docker socket file Path of the docker socket file Defaults to /var/run/docker.sock
@@ -140,20 +140,20 @@ - + - + - + - + @@ -182,7 +182,7 @@ ### Common and Pod specific tunables -Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. +Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. ### Spoof Map diff --git a/mkdocs/docs/experiments/categories/pods/pod-http-modify-body.md b/mkdocs/docs/experiments/categories/pods/pod-http-modify-body.md index ecb790feb..523687e34 100644 --- a/mkdocs/docs/experiments/categories/pods/pod-http-modify-body.md +++ b/mkdocs/docs/experiments/categories/pods/pod-http-modify-body.md @@ -4,29 +4,29 @@ - Can be used to overwrite the http response body by providing the new body value as `RESPONSE_BODY`. - It can test the application's resilience to error or incorrect http response body. -!!! tip "Scenario: Modify Body of the HTTP response" +!!! tip "Scenario: Modify Body of the HTTP response" ![Pod HTTP Modify Body](../../images/pod-http.png) ## Uses -??? info "View the uses of the experiment" +??? info "View the uses of the experiment" coming soon ## Prerequisites -??? info "Verify the prerequisites" +??? info "Verify the prerequisites" - Ensure that Kubernetes Version > 1.17 - Ensure that the Litmus Chaos Operator is running by executing kubectl get pods in operator namespace (typically, litmus).If not, install from here - - Ensure that the pod-http-modify-body experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here - + - Ensure that the pod-http-modify-body experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here + ## Default Validations -??? info "View the default validations" +??? info "View the default validations" The application pods should be in running state before and after chaos injection. ## Minimal RBAC configuration example (optional) -!!! tip "NOTE" +!!! tip "NOTE" If you are using this experiment as part of a litmus workflow scheduled constructed & executed from chaos-center, then you may be making use of the [litmus-admin](https://litmuschaos.github.io/litmus/litmus-admin-rbac.yaml) RBAC, which is pre installed in the cluster as part of the agent setup. ??? note "View the Minimal RBAC permissions" @@ -64,10 +64,10 @@ - apiGroups: [""] resources: ["configmaps"] verbs: ["get","list",] - # Track and get the runner, experiment, and helper pods log + # Track and get the runner, experiment, and helper pods log - apiGroups: [""] resources: ["pods/log"] - verbs: ["get","list","watch"] + verbs: ["get","list","watch"] # for creating and managing to execute comands inside target container - apiGroups: [""] resources: ["pods/exec"] @@ -76,7 +76,7 @@ - apiGroups: ["apps"] resources: ["deployments","statefulsets","replicasets", "daemonsets"] verbs: ["list","get"] - # deriving the parent/owner details of the pod(if parent is deploymentConfig) + # deriving the parent/owner details of the pod(if parent is deploymentConfig) - apiGroups: ["apps.openshift.io"] resources: ["deploymentconfigs"] verbs: ["list","get"] @@ -147,6 +147,16 @@ + + + + + + + + + + @@ -175,12 +185,12 @@ - + - + @@ -198,11 +208,11 @@
SPOOF_MAP Map of the target hostnames eg. '{"abc.com":"spoofabc.com"}' where key is the hostname that needs to be spoofed and value is the hostname where it will be spoofed/redirected to. If not provided, no hostnames/domains will be spoofed
PODS_AFFECTED_PERC The Percentage of total pods to target Defaults to 0 (corresponds to 1 replica), provide numeric value only
CONTAINER_RUNTIME container runtime interface for the cluster Defaults to docker, supported values: docker, containerd and crio Defaults to docker, supported values: docker
SOCKET_PATH Path of the containerd/crio/docker socket file Path of the docker socket file Defaults to /var/run/docker.sock
Description Notes
CONTENT_ENCODING Encoding type to compress/encodde the response body Accepted values are: gzip, deflate, br, identity. Defaults to none (no encoding)
CONTENT_TYPE Content type of the response body Defaults to text/plain
PROXY_PORT Port where the proxy will be listening for requests TARGET_PODS Comma separated list of application pod name subjected to pod http modify body chaos If not provided, it will select target pods randomly based on provided appLabels
PODS_AFFECTED_PERC The Percentage of total pods to target Defaults to 0 (corresponds to 1 replica), provide numeric value only
LIB_IMAGE Image used to run the netem command
-## Experiment Examples +## Experiment Examples ### Common and Pod specific tunables -Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. +Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. ### Target Service Port @@ -305,6 +315,45 @@ spec: value: "80" ``` +### Content Encoding and Content Type +It defines the content encoding and content type of the response body. It can be tuned via `CONTENT_ENCODING` and `CONTENT_TYPE` ENV. + +Use the following example to tune this: +[embedmd]:# (pod-http-modify-body/modify-body-with-encoding-type.yaml yaml) +```yaml +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: engine-nginx +spec: + engineState: "active" + annotationCheck: "false" + appinfo: + appns: "default" + applabel: "app=nginx" + appkind: "deployment" + chaosServiceAccount: pod-http-modify-body-sa + experiments: + - name: pod-http-modify-body + spec: + components: + env: + # provide the encoding type for the response body + # currently supported value are gzip, deflate + # if empty no encoding will be applied + - name: CONTENT_ENCODING + value: 'gzip' + # provide the content type for the response body + - name: CONTENT_TYPE + value: 'text/html' + # provide the body string to overwrite the response body + - name: RESPONSE_BODY + value: '2000' + # provide the port of the targeted service + - name: TARGET_SERVICE_PORT + value: "80" +``` + ### Network Interface It defines the network interface to be used for the proxy. It can be tuned via `NETWORK_INTERFACE` ENV. diff --git a/mkdocs/docs/experiments/categories/pods/pod-http-modify-body/modify-body-with-encoding-type.yaml b/mkdocs/docs/experiments/categories/pods/pod-http-modify-body/modify-body-with-encoding-type.yaml new file mode 100644 index 000000000..8f01d200b --- /dev/null +++ b/mkdocs/docs/experiments/categories/pods/pod-http-modify-body/modify-body-with-encoding-type.yaml @@ -0,0 +1,31 @@ +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: engine-nginx +spec: + engineState: "active" + annotationCheck: "false" + appinfo: + appns: "default" + applabel: "app=nginx" + appkind: "deployment" + chaosServiceAccount: pod-http-modify-body-sa + experiments: + - name: pod-http-modify-body + spec: + components: + env: + # provide the encoding type for the response body + # currently supported value are gzip, deflate + # if empty no encoding will be applied + - name: CONTENT_ENCODING + value: 'gzip' + # provide the content type for the response body + - name: CONTENT_TYPE + value: 'text/html' + # provide the body string to overwrite the response body + - name: RESPONSE_BODY + value: '2000' + # provide the port of the targeted service + - name: TARGET_SERVICE_PORT + value: "80" diff --git a/mkdocs/docs/experiments/categories/pods/pod-http-status-code.md b/mkdocs/docs/experiments/categories/pods/pod-http-status-code.md index 10ce7256a..039286b20 100644 --- a/mkdocs/docs/experiments/categories/pods/pod-http-status-code.md +++ b/mkdocs/docs/experiments/categories/pods/pod-http-status-code.md @@ -3,29 +3,29 @@ - It injects http status code chaos inside the pod which modifies the status code of the response from the provided application server to desired status code provided by user on the service whose port is provided as `TARGET_SERVICE_PORT` by starting proxy server and then redirecting the traffic through the proxy server. - It can test the application's resilience to error code http responses from the provided application server. -!!! tip "Scenario: Modify http response status code of the HTTP request" +!!! tip "Scenario: Modify http response status code of the HTTP request" ![Pod HTTP Status Code](../../images/pod-http.png) ## Uses -??? info "View the uses of the experiment" +??? info "View the uses of the experiment" coming soon ## Prerequisites -??? info "Verify the prerequisites" +??? info "Verify the prerequisites" - Ensure that Kubernetes Version > 1.17 - Ensure that the Litmus Chaos Operator is running by executing kubectl get pods in operator namespace (typically, litmus).If not, install from here - - Ensure that the pod-http-status-code experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here - + - Ensure that the pod-http-status-code experiment resource is available in the cluster by executing kubectl get chaosexperiments in the desired namespace. If not, install from here + ## Default Validations -??? info "View the default validations" +??? info "View the default validations" The application pods should be in running state before and after chaos injection. ## Minimal RBAC configuration example (optional) -!!! tip "NOTE" +!!! tip "NOTE" If you are using this experiment as part of a litmus workflow scheduled constructed & executed from chaos-center, then you may be making use of the [litmus-admin](https://litmuschaos.github.io/litmus/litmus-admin-rbac.yaml) RBAC, which is pre installed in the cluster as part of the agent setup. ??? note "View the Minimal RBAC permissions" @@ -63,10 +63,10 @@ - apiGroups: [""] resources: ["configmaps"] verbs: ["get","list",] - # Track and get the runner, experiment, and helper pods log + # Track and get the runner, experiment, and helper pods log - apiGroups: [""] resources: ["pods/log"] - verbs: ["get","list","watch"] + verbs: ["get","list","watch"] # for creating and managing to execute comands inside target container - apiGroups: [""] resources: ["pods/exec"] @@ -75,7 +75,7 @@ - apiGroups: ["apps"] resources: ["deployments","statefulsets","replicasets", "daemonsets"] verbs: ["list","get"] - # deriving the parent/owner details of the pod(if parent is deploymentConfig) + # deriving the parent/owner details of the pod(if parent is deploymentConfig) - apiGroups: ["apps.openshift.io"] resources: ["deploymentconfigs"] verbs: ["list","get"] @@ -129,7 +129,7 @@ TARGET_SERVICE_PORT Port of the service to target - Defaults to port 80 + This should be the port on which the application container runs at the pod level, not at the service level. Defaults to port 80 STATUS_CODE @@ -153,6 +153,21 @@ Description Notes + + RESPONSE_BODY + Body string to overwrite the http response body + This will be used only if MODIFY_RESPONSE_BODY is set to true. If no value is provided, response will be an empty body. Defaults to empty body + + + CONTENT_ENCODING + Encoding type to compress/encodde the response body + Accepted values are: gzip, deflate, br, identity. Defaults to none (no encoding) + + + CONTENT_TYPE + Content type of the response body + Defaults to text/plain + PROXY_PORT Port where the proxy will be listening for requests @@ -181,12 +196,12 @@ TARGET_PODS Comma separated list of application pod name subjected to pod http status code chaos If not provided, it will select target pods randomly based on provided appLabels - + PODS_AFFECTED_PERC The Percentage of total pods to target Defaults to 0 (corresponds to 1 replica), provide numeric value only - + LIB_IMAGE Image used to run the netem command @@ -204,15 +219,16 @@ -## Experiment Examples +## Experiment Examples ### Common and Pod specific tunables -Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. +Refer the [common attributes](../common/common-tunables-for-all-experiments.md) and [Pod specific tunable](common-tunables-for-pod-experiments.md) to tune the common tunables for all experiments and pod specific tunables. ### Target Service Port It defines the port of the targeted service that is being targeted. It can be tuned via `TARGET_SERVICE_PORT` ENV. +This should be the port where the application runs at the pod level, not at the service level. This means if the application pod is running the service at port 8080 and we create a service exposing that at port 80, then the target service port should be 8080 and not 80, which is the port at pod-level. Use the following example to tune this: @@ -323,7 +339,7 @@ It defines whether to modify the respone body with a pre-defined template to mat Use the following example to tune this: -[embedmd]:# (pod-http-status-code/modify-body-with-response.yaml yaml) +[embedmd]:# (pod-http-status-code/modify-body-with-response-pre-defined.yaml yaml) ```yaml ## whether to modify the body as per the status code provided apiVersion: litmuschaos.io/v1alpha1 @@ -354,6 +370,90 @@ spec: value: "80" ``` +### RESPONSE BODY + +It defines the body string that will overwrite the http response body. It can be tuned via `RESPONSE_BODY` and `MODIFY_RESPONSE_BODY` ENV. +The `MODIFY_RESPONSE_BODY` ENV should be set to `true` to enable this feature. + +Use the following example to tune this: + +[embedmd]:# (pod-http-status-code/modify-body-with-response.yaml yaml) +```yaml +## provide the response body value +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: engine-nginx +spec: + engineState: "active" + annotationCheck: "false" + appinfo: + appns: "default" + applabel: "app=nginx" + appkind: "deployment" + chaosServiceAccount: pod-http-status-code-sa + experiments: + - name: pod-http-status-code + spec: + components: + env: + # provide the body string to overwrite the response body. This will be used only if MODIFY_RESPONSE_BODY is set to true + - name: RESPONSE_BODY + value: '

Hello World

' + # whether to modify the body as per the status code provided + - name: "MODIFY_RESPONSE_BODY" + value: "true" + # modified status code for the http response + - name: STATUS_CODE + value: '500' + # provide the port of the targeted service + - name: TARGET_SERVICE_PORT + value: "80" +``` + +### Content Encoding and Content Type +It defines the content encoding and content type of the response body. It can be tuned via `CONTENT_ENCODING` and `CONTENT_TYPE` ENV. + +Use the following example to tune this: +[embedmd]:# (pod-http-status-code/modify-body-with-encoding-type.yaml yaml) +```yaml +## whether to modify the body as per the status code provided +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: engine-nginx +spec: + engineState: "active" + annotationCheck: "false" + appinfo: + appns: "default" + applabel: "app=nginx" + appkind: "deployment" + chaosServiceAccount: pod-http-status-code-sa + experiments: + - name: pod-http-status-code + spec: + components: + env: + # provide the encoding type for the response body + # currently supported value are gzip, deflate + # if empty no encoding will be applied + - name: CONTENT_ENCODING + value: 'gzip' + # provide the content type for the response body + - name: CONTENT_TYPE + value: 'text/html' + # whether to modify the body as per the status code provided + - name: "MODIFY_RESPONSE_BODY" + value: "true" + # modified status code for the http response + - name: STATUS_CODE + value: '500' + # provide the port of the targeted service + - name: TARGET_SERVICE_PORT + value: "80" +``` + ### Network Interface It defines the network interface to be used for the proxy. It can be tuned via `NETWORK_INTERFACE` ENV. diff --git a/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-encoding-type.yaml b/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-encoding-type.yaml new file mode 100644 index 000000000..7f4181fec --- /dev/null +++ b/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-encoding-type.yaml @@ -0,0 +1,35 @@ +## whether to modify the body as per the status code provided +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: engine-nginx +spec: + engineState: "active" + annotationCheck: "false" + appinfo: + appns: "default" + applabel: "app=nginx" + appkind: "deployment" + chaosServiceAccount: pod-http-status-code-sa + experiments: + - name: pod-http-status-code + spec: + components: + env: + # provide the encoding type for the response body + # currently supported value are gzip, deflate + # if empty no encoding will be applied + - name: CONTENT_ENCODING + value: 'gzip' + # provide the content type for the response body + - name: CONTENT_TYPE + value: 'text/html' + # whether to modify the body as per the status code provided + - name: "MODIFY_RESPONSE_BODY" + value: "true" + # modified status code for the http response + - name: STATUS_CODE + value: '500' + # provide the port of the targeted service + - name: TARGET_SERVICE_PORT + value: "80" diff --git a/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response-pre-defined.yaml b/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response-pre-defined.yaml new file mode 100644 index 000000000..c17f349ed --- /dev/null +++ b/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response-pre-defined.yaml @@ -0,0 +1,27 @@ +## whether to modify the body as per the status code provided +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: engine-nginx +spec: + engineState: "active" + annotationCheck: "false" + appinfo: + appns: "default" + applabel: "app=nginx" + appkind: "deployment" + chaosServiceAccount: pod-http-status-code-sa + experiments: + - name: pod-http-status-code + spec: + components: + env: + # whether to modify the body as per the status code provided + - name: "MODIFY_RESPONSE_BODY" + value: "true" + # modified status code for the http response + - name: STATUS_CODE + value: '500' + # provide the port of the targeted service + - name: TARGET_SERVICE_PORT + value: "80" diff --git a/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response.yaml b/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response.yaml index c17f349ed..9f391b7d8 100644 --- a/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response.yaml +++ b/mkdocs/docs/experiments/categories/pods/pod-http-status-code/modify-body-with-response.yaml @@ -1,4 +1,4 @@ -## whether to modify the body as per the status code provided +## provide the response body value apiVersion: litmuschaos.io/v1alpha1 kind: ChaosEngine metadata: @@ -16,6 +16,9 @@ spec: spec: components: env: + # provide the body string to overwrite the response body. This will be used only if MODIFY_RESPONSE_BODY is set to true + - name: RESPONSE_BODY + value: '

Hello World

' # whether to modify the body as per the status code provided - name: "MODIFY_RESPONSE_BODY" value: "true"