Project: Litmus (Observability and Analysis / Chaos Engineering)
File: common-tunables-for-pod-experiments.md

It contains tunables, which are common for all pod-level experiments. These tunables can be provided at `.spec.experiment[*].spec.components.env` in chaosengine. It defines the comma-separated name of the target pods subjected to chaos. The target pods can be tuned via `TARGET_PODS` ENV. Use the following example to tune this: ```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-delete-sa experiments: name: pod-delete spec: components: env: name: TARGET_PODS value: 'pod1,pod2' name: TOTALCHAOSDURATION value: '60' ``` It defines the percentage of pods subjected to chaos with matching labels provided at `.spec.appinfo.applabel` inside chaosengine. It can be tuned with `PODSAFFECTEDPERC` ENV. If `PODSAFFECTEDPERC` is provided as `empty` or `0` then it will target a minimum of one pod. Use the following example to tune this: ```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-delete-sa experiments: name: pod-delete spec: components: env: name: PODSAFFECTEDPERC value: '100' name: TOTALCHAOSDURATION value: '60' ``` It defines the name of the targeted container subjected to chaos. It can be tuned via `TARGETCONTAINER` ENV. If `TARGETCONTAINER` is provided as empty then it will use the first container of the targeted pod. Use the following example to tune this: ```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-delete-sa experiments: name: pod-delete spec: components: env: name: TARGET_CONTAINER value: 'nginx' name: TOTALCHAOSDURATION value: '60' ``` It defines the default application status checks as a tunable. It is helpful for the scenarios where you dont want to validate the application status as a mandatory check during pre & post chaos. It can be tuned via `DEFAULTAPPHEALTHCHECK` ENV. If `DEFAULTAPPHEALTHCHECK` is not provided by default it is set to `true`. Use the following example to tune this: ```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-delete-sa experiments: name: pod-delete spec: components: env: name: DEFAULTAPPHEALTH_CHECK value: 'false' ``` It defines the target application pod selection from a specific node. It is helpful for the scenarios where you want to select the pods scheduled on specific nodes as chaos candidates considering the pod affected percentage. It can be tuned via `NODE_LABEL` ENV. <b>NOTE: This feature requires having node-level permission or clusterrole service account for filtering pods on a specific node.</b> <table> <tr> <th>APP_LABEL</th> <th>TARGET_PODS</th> <th>NODE_LABEL</th> <th>SELECTED PODS</th> </tr> <tr> <td>Provided</td> <td>Provided</td> <td>Provided</td> <td>The target pods that are filtered from applabel and resides on node containing the given node label and also provided in TARGET_PODS env is selected</td> </tr> <tr> <td>Provided</td> <td>Not Provided</td> <td>Provided</td> <td>The pods that are filtered from applabel and resides on node containing the given node label is selected </td> </tr> <tr> <td>Not Provided</td> <td>Provided</td> <td>Provided</td> <td>The target pods are selected that resides on node with given node label </td> </tr> </tr> <tr> <td>Not Provided</td> <td>Not Provided</td> <td>Provided</td> <td>Invalid</td> </tr> <tr> <td>Not Provided</td> <td>Not Provided</td> <td>Not Provided</td> <td>Invalid</td> </tr> </table> Use the following example to tune this: ```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-delete-sa experiments: name: pod-delete spec: components: env: name: NODE_LABEL value: 'kubernetes.io/hostname=worker-01' ```