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 <as86414@gmail.com>

* added 'container' in target service port explanation

Signed-off-by: avaakash <as86414@gmail.com>

* removed containerd,crio references from pod-dns docs

Signed-off-by: avaakash <as86414@gmail.com>

Signed-off-by: avaakash <as86414@gmail.com>
This commit is contained in:
Akash Shrivastava 2022-09-19 10:53:34 +05:30 committed by GitHub
parent 41b546af09
commit 98f26e326c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 310 additions and 65 deletions

View File

@ -154,11 +154,11 @@
<tr>
<td> CONTAINER_RUNTIME </td>
<td> container runtime interface for the cluster</td>
<td> Defaults to docker, supported values: docker, containerd and crio </td>
<td> Defaults to docker, supported values: docker</td>
</tr>
<tr>
<td> SOCKET_PATH </td>
<td> Path of the containerd/crio/docker socket file </td>
<td> Path of the docker socket file </td>
<td> Defaults to <code>/var/run/docker.sock</code> </td>
</tr>
<tr>

View File

@ -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

View File

@ -149,11 +149,11 @@
<tr>
<td> CONTAINER_RUNTIME </td>
<td> container runtime interface for the cluster</td>
<td> Defaults to docker, supported values: docker, containerd and crio </td>
<td> Defaults to docker, supported values: docker</td>
</tr>
<tr>
<td> SOCKET_PATH </td>
<td> Path of the containerd/crio/docker socket file </td>
<td> Path of the docker socket file </td>
<td> Defaults to <code>/var/run/docker.sock</code> </td>
</tr>
<tr>

View File

@ -147,6 +147,16 @@
<th> Description </th>
<th> Notes </th>
</tr>
<tr>
<td> CONTENT_ENCODING </td>
<td> Encoding type to compress/encodde the response body </td>
<td> Accepted values are: gzip, deflate, br, identity. Defaults to none (no encoding) </td>
</td>
<tr>
<td> CONTENT_TYPE </td>
<td> Content type of the response body </td>
<td> Defaults to text/plain </td>
</tr>
<tr>
<td> PROXY_PORT </td>
<td> Port where the proxy will be listening for requests</td>
@ -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.

View File

@ -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"

View File

@ -129,7 +129,7 @@
<tr>
<td> TARGET_SERVICE_PORT </td>
<td> Port of the service to target</td>
<td>Defaults to port 80 </td>
<td>This should be the port on which the application container runs at the pod level, not at the service level. Defaults to port 80 </td>
</tr>
<tr>
<td> STATUS_CODE </td>
@ -153,6 +153,21 @@
<th> Description </th>
<th> Notes </th>
</tr>
<tr>
<td> RESPONSE_BODY </td>
<td> Body string to overwrite the http response body</td>
<td> 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 </td>
</tr>
<tr>
<td> CONTENT_ENCODING </td>
<td> Encoding type to compress/encodde the response body </td>
<td> Accepted values are: gzip, deflate, br, identity. Defaults to none (no encoding) </td>
</td>
<tr>
<td> CONTENT_TYPE </td>
<td> Content type of the response body </td>
<td> Defaults to text/plain </td>
</tr>
<tr>
<td> PROXY_PORT </td>
<td> Port where the proxy will be listening for requests</td>
@ -213,6 +228,7 @@ Refer the [common attributes](../common/common-tunables-for-all-experiments.md)
### 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: '<h1>Hello World</h1>'
# 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.

View File

@ -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"

View File

@ -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"

View File

@ -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: '<h1>Hello World</h1>'
# whether to modify the body as per the status code provided
- name: "MODIFY_RESPONSE_BODY"
value: "true"