diff --git a/Dockerfile b/Dockerfile index 165010d..cf43d79 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:latest +FROM litmuschaos/chaos-ci-lib:v0.5.0 LABEL name="Kubernetes Chaos" LABEL repository="http://github.com/litmuschaos/github-chaos-actions" @@ -10,33 +10,6 @@ LABEL com.github.actions.description="Different Chaos Experiment for Kubernetes" LABEL com.github.actions.icon="terminal" LABEL com.github.actions.color="blue" -ENV GOPATH=/github/home/go -ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin -ARG HELM_VERSION=3.2.3 -ARG RELEASE_ROOT="https://get.helm.sh" -ARG RELEASE_FILE="helm-v${HELM_VERSION}-linux-amd64.tar.gz" - -ARG KUBECTL_VERSION=1.22.0 -ADD https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl /usr/local/bin/kubectl -RUN chmod +x /usr/local/bin/kubectl - -RUN apt-get update && apt-get install -y git \ - curl \ - unzip \ - python3-pip \ - && apt-get clean - -RUN apt-get update && \ - curl -L ${RELEASE_ROOT}/${RELEASE_FILE} |tar xvz && \ - mv linux-amd64/helm /usr/bin/helm && \ - chmod +x /usr/bin/helm - -RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ - unzip awscliv2.zip && \ - ./aws/install - -RUN pip install oci-cli - COPY README.md / COPY entrypoint.sh /entrypoint.sh COPY experiments ./experiments diff --git a/README.md b/README.md index f7523e8..e5cdae1 100644 --- a/README.md +++ b/README.md @@ -80,12 +80,12 @@ jobs: env: EXPERIMENT_NAME: pod-delete EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest + EXPERIMENT_IMAGE_TAG: 3.18.0 JOB_CLEANUP_POLICY: delete APP_NS: default APP_LABEL: run=nginx APP_KIND: deployment - IMAGE_PULL_POLICY: Always + TOTAL_CHAOS_DURATION: 30 CHAOS_INTERVAL: 10 FORCE: false @@ -140,12 +140,12 @@ jobs: env: EXPERIMENT_NAME: pod-delete EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest + EXPERIMENT_IMAGE_TAG: 3.18.0 JOB_CLEANUP_POLICY: delete APP_NS: default APP_LABEL: run=nginx APP_KIND: deployment - IMAGE_PULL_POLICY: Always + TOTAL_CHAOS_DURATION: 30 CHAOS_INTERVAL: 10 FORCE: false @@ -224,7 +224,7 @@ Some comman environment variables used for running the `github-chaos-actions` ar EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional - Default value is latest + Default value is 3.18.0 IMAGE_PULL_POLICY diff --git a/entrypoint.sh b/entrypoint.sh index 80eff50..11c700c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,9 +2,49 @@ set -e -TOTAL_CHAOS_DURATION=${TOTAL_CHAOS_DURATION:=60} -TEST_TIMEOUT=$((600 + $TOTAL_CHAOS_DURATION)) -PARALLEL_EXECUTION=${PARALLEL_EXECUTION:=1} +# ============================================================================== +# Litmus Chaos GitHub Action Environment Variables +# ============================================================================== +# The following environment variables can be set to customize chaos experiments: +# +# REQUIRED SDK Authentication Variables: +# LITMUS_ENDPOINT - URL of Litmus Chaos Center (default: http://localhost:9091) +# LITMUS_USERNAME - Username for authentication (default: admin) +# LITMUS_PASSWORD - Password for authentication (default: litmus) +# LITMUS_PROJECT_ID - Project ID in Litmus (default: admin-project) +# +# Common Environment Variables: +# KUBECONFIG - Path to kubeconfig file (default: /home/runner/.kube/config) +# APP_NS - Application namespace (default: litmus) +# INSTALL_INFRA - Whether to install infrastructure (default: true) +# ACTIVATE_INFRA - Whether to activate infrastructure (default: true) +# CREATE_ENV - Whether to create environment (default: true) +# ENV_NAME - Environment name (default: ci-test-env) +# ENV_TYPE - Environment type (default: NON_PROD) +# INFRA_NAMESPACE - Infrastructure namespace (default: litmus) +# INFRA_ACTIVATION_TIMEOUT - Timeout for infrastructure activation (default: 5) +# +# Probe Configuration: +# LITMUS_CREATE_PROBE - Create probe (default: true) +# LITMUS_USE_EXISTING_PROBE - Use existing probe (default: false) +# LITMUS_PROBE_TYPE - Probe type (default: httpProbe) +# LITMUS_PROBE_MODE - Probe mode (default: SOT) +# LITMUS_PROBE_TIMEOUT - Probe timeout (default: 30s) +# LITMUS_PROBE_INTERVAL - Probe interval (default: 10s) +# LITMUS_PROBE_ATTEMPTS - Probe attempts (default: 1) +# LITMUS_PROBE_RESPONSE_CODE - Expected response code (default: 200) +# +# Experiment-Specific Variables (auto-set based on EXPERIMENT_NAME): +# APP_LABEL - Application label for targeting +# INFRA_NAME - Infrastructure name +# INFRA_SCOPE - Infrastructure scope (cluster/namespace) +# LITMUS_PROBE_NAME - Probe name +# LITMUS_PROBE_URL - Probe URL +# +# Special Variables for container-kill experiment: +# SOCKET_PATH - Container runtime socket path +# CONTAINER_RUNTIME - Container runtime type +# ============================================================================== ##Extract the base64 encoded config data and write this to the KUBECONFIG if [ ! -z "$KUBE_CONFIG_DATA" ] @@ -14,11 +54,7 @@ then export KUBECONFIG=${HOME}/.kube/config fi -##Setup -mkdir -p $HOME/go/src/github.com/litmuschaos -cd ${GOPATH}/src/github.com/litmuschaos/ -dir=${GOPATH}/src/github.com/litmuschaos/chaos-ci-lib - +##Setup AWS credentials if provided if [[ ! -z $AWS_ACCESS_KEY_ID ]] && [[ ! -z $AWS_SECRET_ACCESS_KEY ]] && [[ ! -z $AWS_DEFAULT_REGION ]] then aws configure set default.region ${AWS_DEFAULT_REGION} @@ -26,31 +62,126 @@ then aws configure set aws_secret_access_key ${AWS_SECRET_ACCESS_KEY} fi -if [ ! -d $dir ] -then - git clone https://github.com/litmuschaos/chaos-ci-lib.git -fi -cd chaos-ci-lib +# Set default values for common environment variables +export KUBECONFIG=${KUBECONFIG:-"/home/runner/.kube/config"} +export LITMUS_ENDPOINT=${LITMUS_ENDPOINT:-"http://localhost:9091"} +export LITMUS_USERNAME=${LITMUS_USERNAME:-"admin"} +export LITMUS_PASSWORD=${LITMUS_PASSWORD:-"litmus"} +export LITMUS_PROJECT_ID=${LITMUS_PROJECT_ID:-"admin-project"} -##Install litmus if it is not already installed -if [ "$INSTALL_LITMUS" == "true" ] -then - go test litmus/install-litmus_test.go -v -count=1 -fi +# Application and Infrastructure Setup +export APP_NS=${APP_NS:-"litmus"} +export INSTALL_INFRA=${INSTALL_INFRA:-"true"} +export ACTIVATE_INFRA=${ACTIVATE_INFRA:-"true"} +export CREATE_ENV=${CREATE_ENV:-"true"} +export ENV_NAME=${ENV_NAME:-"ci-test-env"} +export ENV_TYPE=${ENV_TYPE:-"NON_PROD"} +export INFRA_NAMESPACE=${INFRA_NAMESPACE:-"litmus"} +export INFRA_ACTIVATION_TIMEOUT=${INFRA_ACTIVATION_TIMEOUT:-"5"} -if [ "$EXPERIMENT_NAME" == "all" ]; then -## Run all BDDs - cd experiments - ginkgo -nodes=${PARALLEL_EXECUTION} - cd .. +# Probe Configuration +export LITMUS_CREATE_PROBE=${LITMUS_CREATE_PROBE:-"true"} +export LITMUS_USE_EXISTING_PROBE=${LITMUS_USE_EXISTING_PROBE:-"false"} +export LITMUS_PROBE_TYPE=${LITMUS_PROBE_TYPE:-"httpProbe"} +export LITMUS_PROBE_MODE=${LITMUS_PROBE_MODE:-"SOT"} +export LITMUS_PROBE_TIMEOUT=${LITMUS_PROBE_TIMEOUT:-"30s"} +export LITMUS_PROBE_INTERVAL=${LITMUS_PROBE_INTERVAL:-"10s"} +export LITMUS_PROBE_ATTEMPTS=${LITMUS_PROBE_ATTEMPTS:-"1"} +export LITMUS_PROBE_RESPONSE_CODE=${LITMUS_PROBE_RESPONSE_CODE:-"200"} -elif [ ! -z "$EXPERIMENT_NAME" ]; then -## Run the selected chaos experiment - go test experiments/${EXPERIMENT_NAME}_test.go -v -count=1 -timeout=${TEST_TIMEOUT}s -fi +# Set experiment-specific defaults based on experiment name +case "$EXPERIMENT_NAME" in + "container-kill") + export APP_LABEL=${APP_LABEL:-"app=nginx-container-kill"} + export INFRA_NAME=${INFRA_NAME:-"ci-infra-container-kill"} + export INFRA_SCOPE=${INFRA_SCOPE:-"cluster"} + export LITMUS_PROBE_NAME=${LITMUS_PROBE_NAME:-"ci-http-probe-container-kill"} + export LITMUS_PROBE_URL=${LITMUS_PROBE_URL:-"http://nginx-service-container-kill.litmus.svc.cluster.local:80"} + export SOCKET_PATH=${SOCKET_PATH:-"/run/containerd/containerd.sock"} + export CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-"containerd"} + ;; + "node-cpu-hog"|"node-memory-hog"|"node-io-stress") + export APP_LABEL=${APP_LABEL:-"app=nginx-${EXPERIMENT_NAME}"} + export INFRA_NAME=${INFRA_NAME:-"ci-infra-${EXPERIMENT_NAME}"} + export INFRA_SCOPE=${INFRA_SCOPE:-"cluster"} + export LITMUS_PROBE_NAME=${LITMUS_PROBE_NAME:-"ci-http-probe-${EXPERIMENT_NAME}"} + export LITMUS_PROBE_URL=${LITMUS_PROBE_URL:-"http://nginx-service-${EXPERIMENT_NAME}.litmus.svc.cluster.local:80"} + ;; + "disk-fill"|"pod-autoscaler"|"pod-cpu-hog"|"pod-delete"|"pod-memory-hog"|"pod-network-corruption"|"pod-network-duplication"|"pod-network-latency"|"pod-network-loss") + export APP_LABEL=${APP_LABEL:-"app=nginx-${EXPERIMENT_NAME}"} + export INFRA_NAME=${INFRA_NAME:-"ci-infra-${EXPERIMENT_NAME}"} + export INFRA_SCOPE=${INFRA_SCOPE:-"namespace"} + export LITMUS_PROBE_NAME=${LITMUS_PROBE_NAME:-"ci-http-probe-${EXPERIMENT_NAME}"} + export LITMUS_PROBE_URL=${LITMUS_PROBE_URL:-"http://nginx-service-${EXPERIMENT_NAME}.litmus.svc.cluster.local:80"} + ;; + *) + # Default values for unspecified experiments + export APP_LABEL=${APP_LABEL:-"app=nginx"} + export INFRA_NAME=${INFRA_NAME:-"ci-infra-default"} + export INFRA_SCOPE=${INFRA_SCOPE:-"namespace"} + export LITMUS_PROBE_NAME=${LITMUS_PROBE_NAME:-"ci-http-probe-default"} + export LITMUS_PROBE_URL=${LITMUS_PROBE_URL:-"http://nginx-service.litmus.svc.cluster.local:80"} + ;; +esac -##litmus cleanup -if [ "$LITMUS_CLEANUP" == "true" ] -then - go test litmus/uninstall-litmus_test.go -v -count=1 +# Set default values for experiment configuration +EXPERIMENT_IMAGE=${EXPERIMENT_IMAGE:-"litmuschaos/go-runner"} +EXPERIMENT_IMAGE_TAG=${EXPERIMENT_IMAGE_TAG:-"3.18.0"} +TOTAL_CHAOS_DURATION=${TOTAL_CHAOS_DURATION:-60} + +# Map experiment names to their corresponding scripts in chaos-ci-lib +case "$EXPERIMENT_NAME" in + "pod-delete") + /app/pod-delete + ;; + "container-kill") + /app/container-kill + ;; + "pod-cpu-hog") + /app/pod-cpu-hog + ;; + "pod-memory-hog") + /app/pod-memory-hog + ;; + "node-cpu-hog") + /app/node-cpu-hog + ;; + "node-memory-hog") + /app/node-memory-hog + ;; + "node-io-stress") + /app/node-io-stress + ;; + "disk-fill") + /app/disk-fill + ;; + "pod-network-latency") + /app/pod-network-latency + ;; + "pod-network-loss") + /app/pod-network-loss + ;; + "pod-network-corruption") + /app/pod-network-corruption + ;; + "pod-network-duplication") + /app/pod-network-duplication + ;; + "pod-autoscaler") + /app/pod-autoscaler + ;; + "all") + /app/all-experiments + ;; + *) + echo "Unknown experiment: $EXPERIMENT_NAME" + echo "Available experiments: pod-delete, container-kill, pod-cpu-hog, pod-memory-hog, node-cpu-hog, node-memory-hog, node-io-stress, disk-fill, pod-network-latency, pod-network-loss, pod-network-corruption, pod-network-duplication, pod-autoscaler, all" + exit 1 + ;; +esac + +# Handle Litmus cleanup after experiment if requested +if [ "$LITMUS_CLEANUP" = "true" ] && [ ! -z "$EXPERIMENT_NAME" ]; then + echo "Cleaning up Litmus after experiment..." + /app/uninstall-litmus fi diff --git a/experiments/container-kill/README.md b/experiments/container-kill/README.md index 6cffae9..80815a2 100644 --- a/experiments/container-kill/README.md +++ b/experiments/container-kill/README.md @@ -23,30 +23,58 @@ jobs: uses: litmuschaos/github-chaos-actions@v0.4.0 env: KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "container-kill-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "cluster" + + # Application Info APP_NS: default APP_LABEL: run=nginx APP_KIND: deployment + + # Experiment Configuration EXPERIMENT_NAME: container-kill - ##Custom images can also be used EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Container Kill Specific Configuration TARGET_CONTAINER: nginx TOTAL_CHAOS_DURATION: 20 CHAOS_INTERVAL: 10 - CONTAINER_RUNTIME: docker - ##Select true if you want to uninstall litmus after chaos + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + SIGNAL: SIGKILL + SEQUENCE: parallel + PODS_AFFECTED_PERC: 0 + DEFAULT_HEALTH_CHECK: false + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for container-kill will be identified with the app info variables. +The following environment variables are used to configure the container-kill experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -56,81 +84,362 @@ The application pod for container-kill will be identified with the app info vari - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running container kill experiment keep it container-kill LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
TARGET_CONTAINER The name of container to be killed inside the pod LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is nginx /home/runner/.kube/config
CHAOS_INTERVAL Time interval b/w two successive container kill (in seconds) APP_NS Application namespace for chaos testing Optional Default value is 10s litmus
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-container-kill
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-container-kill
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional cluster
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional Default value is 20s http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Container Kill Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + + + + + + + - + - - + + + + + + + + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running container kill experiment keep it container-kill Mandatory No default value
TARGET_CONTAINER The name of container to be killed inside the pod Optional Default value is not set to true nginx
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
CHAOS_INTERVAL Time interval b/w two successive container kills (in seconds) Optional 10
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional Default value is not set to true 20
CONTAINER_RUNTIME Give the target container runtime Optional Default value is 'docker'
containerd
SOCKET_PATH Socket path for the container runtime Optional /run/containerd/containerd.sock
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always Always
SIGNAL Signal to be sent to the container Optional SIGKILL
SEQUENCE Sequence of chaos execution Optional parallel
DEFAULT_HEALTH_CHECK Enable/disable default health checks Optional false
RAMP_TIME Time to wait before and after chaos injection (in seconds) Optional Not set
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/disk-fill/README.md b/experiments/disk-fill/README.md index 9892ce1..2cacb49 100644 --- a/experiments/disk-fill/README.md +++ b/experiments/disk-fill/README.md @@ -19,35 +19,60 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running disk-fill chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: disk-fill - FILL_PERCENTAGE: 80 - TARGET_CONTAINER: nginx - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running disk-fill chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "disk-fill-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "namespace" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: disk-fill + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Disk Fill Specific Configuration + FILL_PERCENTAGE: 80 + TARGET_CONTAINER: nginx + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + TOTAL_CHAOS_DURATION: 60 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for disk-fill will be identified with the app info variables. +The following environment variables are used to configure the disk-fill experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -57,69 +82,338 @@ The application pod for disk-fill will be identified with the app info variables - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running disk fill experiment keep it disk-fill LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
TARGET_CONTAINER Name of container which is subjected to disk-fill LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is nginx
/home/runner/.kube/config
FILL_PERCENTAGE Percentage to fill the Ephemeral storage limit APP_NS Application namespace for chaos testing Optional litmus
ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-disk-fill
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-disk-fill
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional Default value is 2 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Disk Fill Experiment Variables + + - - + + + + + + + + + + + + + + - + + + + + + + - - - + + + - + + + + + + + + + + + + + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running disk fill experiment keep it disk-fill Mandatory No default value
TARGET_CONTAINER Name of container which is subjected to disk-fill Optional Default value is not set to true nginx
FILL_PERCENTAGE Percentage to fill the Ephemeral storage limit Optional 80
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
CONTAINER_RUNTIME Give the target container runtime Optional Default value is not set to true containerd
SOCKET_PATH Socket path for the container runtime Optional /run/containerd/containerd.sock
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional 60
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/node-cpu-hog/README.md b/experiments/node-cpu-hog/README.md index 0f8d550..16ad8b9 100644 --- a/experiments/node-cpu-hog/README.md +++ b/experiments/node-cpu-hog/README.md @@ -17,35 +17,59 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running node-cpu-hog chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: node-cpu-hog - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TOTAL_CHAOS_DURATION: 60 - NODE_CPU_CORE: 2 - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running node-cpu-hog chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "node-cpu-hog-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "cluster" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: node-cpu-hog + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Node CPU Hog Specific Configuration + TOTAL_CHAOS_DURATION: 60 + NODE_CPU_CORE: 2 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for node-cpu-hog will be identified with the app info variables. +The following environment variables are used to configure the node-cpu-hog experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -55,69 +79,320 @@ The application pod for node-cpu-hog will be identified with the app info variab - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running node cpu hog experiment keep it node-cpu-hog LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
NODE_CPU_CORE Number of cores of node CPU to be consumed LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is 2 /home/runner/.kube/config
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) APP_NS Application namespace for chaos testing Optional Default value is 60s
litmus
ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-node-cpu-hog
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-node-cpu-hog
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional cluster
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Node CPU Hog Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + + + + + + + - + + + + + + + - + - + - + - - + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running node cpu hog experiment keep it node-cpu-hog Mandatory No default value
NODE_CPU_CORE Number of cores of node CPU to be consumed Optional Default value is not set to true 2
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
CONTAINER_RUNTIME Give the target container runtime Optional containerd
SOCKET_PATH Socket path for the container runtime Optional Default value is not set to true /run/containerd/containerd.sock
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional 60
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/node-io-stress/README.md b/experiments/node-io-stress/README.md index e840650..340d51b 100644 --- a/experiments/node-io-stress/README.md +++ b/experiments/node-io-stress/README.md @@ -1,7 +1,7 @@ # Node IO Stress Experiment This experiment causes IO stress on the Kubernetes node. The experiment aims to verify the resiliency of applications that share this disk resource for ephemeral or persistent storage purposes. -. Check node io stress docs for more info. To know more and get started with chaos-actions visit github-chaos-actions. +Check node io stress docs for more info. To know more and get started with chaos-actions visit github-chaos-actions. #### Sample workflow @@ -16,35 +16,59 @@ on: branches: [ master ] jobs: build: - runs-on: ubuntu-latest steps: - - name: Running node-io-stress chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##if litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: node-io-stress - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TOTAL_CHAOS_DURATION: 120 - FILESYSTEM_UTILIZATION_PERCENTAGE: 10 - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running node-io-stress chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "node-io-stress-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "cluster" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: node-io-stress + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Node IO Stress Specific Configuration + TOTAL_CHAOS_DURATION: 120 + FILESYSTEM_UTILIZATION_PERCENTAGE: 10 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The target node for node-io-stress will be identified with the app info variables. +The following environment variables are used to configure the node-io-stress experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -54,69 +78,320 @@ The target node for node-io-stress will be identified with the app info variable - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running node io stress experiment keep it node-io-stress LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
FILESYSTEM_UTILIZATION_PERCENTAGE The size as percent of total available filesystem space (in percentage) LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is 10 /home/runner/.kube/config
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) APP_NS Application namespace for chaos testing Optional Default value is 120s
litmus
ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-node-io-stress
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-node-io-stress
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional cluster
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Node IO Stress Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + + + + + + + - + + + + + + + - + - + - + - - + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running node io stress experiment keep it node-io-stress Mandatory No default value
FILESYSTEM_UTILIZATION_PERCENTAGE The size as percent of total available filesystem space (in percentage) Optional Default value is not set to true 10
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
CONTAINER_RUNTIME Give the target container runtime Optional containerd
SOCKET_PATH Socket path for the container runtime Optional Default value is not set to true /run/containerd/containerd.sock
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional 120
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/node-memory-hog/README.md b/experiments/node-memory-hog/README.md index b3209a3..385c0ba 100644 --- a/experiments/node-memory-hog/README.md +++ b/experiments/node-memory-hog/README.md @@ -19,32 +19,57 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Running node-memory-hog chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##if litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: node-memory-hog - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TOTAL_CHAOS_DURATION: 120 - MEMORY_PERCENTAGE: 90 - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running node-memory-hog chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "node-memory-hog-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "cluster" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: node-memory-hog + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Node Memory Hog Specific Configuration + TOTAL_CHAOS_DURATION: 120 + MEMORY_PERCENTAGE: 90 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for node-memory-hog will be identified with the app info variables. +The following environment variables are used to configure the node-memory-hog experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -54,69 +79,320 @@ The application pod for node-memory-hog will be identified with the app info var - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running node memory hog experiment keep it node-memory-hog LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
MEMORY_PERCENTAGE The size as percent of total available memory LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is 90 /home/runner/.kube/config
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) APP_NS Application namespace for chaos testing Optional Default value is 120s
litmus
ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-node-memory-hog
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-node-memory-hog
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional cluster
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Node Memory Hog Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + + + + + + + - + + + + + + + - + - + - + - - + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running node memory hog experiment keep it node-memory-hog Mandatory No default value
MEMORY_PERCENTAGE The size as percent of total available memory Optional Default value is not set to true 90
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
CONTAINER_RUNTIME Give the target container runtime Optional containerd
SOCKET_PATH Socket path for the container runtime Optional Default value is not set to true /run/containerd/containerd.sock
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional 120
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-autoscaler/README.md b/experiments/pod-autoscaler/README.md index 9483d6d..407e532 100644 --- a/experiments/pod-autoscaler/README.md +++ b/experiments/pod-autoscaler/README.md @@ -15,34 +15,60 @@ on: branches: [ master ] jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod autoscaler chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-autoscaler - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TOTAL_CHAOS_DURATION: 60 - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod autoscaler chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "pod-autoscaler-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "namespace" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-autoscaler + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod Autoscaler Specific Configuration + TOTAL_CHAOS_DURATION: 60 + CHAOS_INTERVAL: 5 + REPLICAS: 2 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for pod-autoscaler will be identified with the app info variables. +The following environment variables are used to configure the pod-autoscaler experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -52,68 +78,338 @@ The application pod for pod-autoscaler will be identified with the app info vari - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running pod autoscaler experiment keep it pod-autoscaler LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
CHAOS_INTERVAL Time interval b/w two successive pod failures (in sec) LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is 5s /home/runner/.kube/config
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) APP_NS Application namespace for chaos testing Optional Defaults to 15s, NOTE: Overall run duration of the experiment may exceed the TOTAL_CHAOS_DURATION by a few min litmus
ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-autoscaler
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-autoscaler
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Pod Autoscaler Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + - + + + + + + + + + + + + + + + + + + + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running pod autoscaler experiment keep it pod-autoscaler Mandatory No default value
CHAOS_INTERVAL Time interval b/w two successive pod failures (in sec) Optional Default value is not set to true 5
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
REPLICAS Number of replicas to scale Optional Default value is not set to true 2
CONTAINER_RUNTIME Give the target container runtime Optional containerd
SOCKET_PATH Socket path for the container runtime Optional /run/containerd/containerd.sock
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional 60
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-cpu-hog/README.md b/experiments/pod-cpu-hog/README.md index 3386567..6c48f70 100644 --- a/experiments/pod-cpu-hog/README.md +++ b/experiments/pod-cpu-hog/README.md @@ -17,36 +17,59 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod-cpu-hog chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-cpu-hog - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TARGET_CONTAINER: nginx - TOTAL_CHAOS_DURATION: 60 - CPU_CORES: 1 - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod-cpu-hog chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "pod-cpu-hog-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "namespace" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-cpu-hog + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod CPU Hog Specific Configuration + TARGET_CONTAINER: nginx + TOTAL_CHAOS_DURATION: 60 + CPU_CORES: 1 + PODS_AFFECTED_PERC: 0 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for pod-cpu-hog will be identified with the app info variables. +The following environment variables are used to configure the pod-cpu-hog experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -56,75 +79,326 @@ The application pod for pod-cpu-hog will be identified with the app info variabl - - + + - - - + + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running pod cpu hog experiment keep it pod-cpu-hog LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
TARGET_CONTAINER Name of the container subjected to CPU stress
LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is nginx /home/runner/.kube/config
CPU_CORES Number of the cpu cores subjected to CPU stress APP_NS Application namespace for chaos testing Optional Default value is 1 litmus
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) ACTIVATE_INFRA Whether to activate infrastructure Optional Default value is 60s
true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-cpu-hog
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-cpu-hog
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Pod CPU Hog Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + + + + + + + - + - + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running pod cpu hog experiment keep it pod-cpu-hog Mandatory No default value
TARGET_CONTAINER Name of the container subjected to CPU stress Optional Default value is not set to true nginx
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
CPU_CORES Number of the cpu cores subjected to CPU stress Optional 1
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional Default value is not set to true 60
EXPERIMENT_IMAGE We can provide custom image for running litmus chaos experiment We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-delete/README.md b/experiments/pod-delete/README.md index 22f583e..45aed64 100644 --- a/experiments/pod-delete/README.md +++ b/experiments/pod-delete/README.md @@ -17,36 +17,59 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod delete chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-delete - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TOTAL_CHAOS_DURATION: 30 - CHAOS_INTERVAL: 10 - FORCE: false - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod delete chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "pod-delete-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "namespace" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-delete + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod Delete Specific Configuration + TOTAL_CHAOS_DURATION: 30 + CHAOS_INTERVAL: 10 + FORCE: false + PODS_AFFECTED_PERC: 0 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for pod-delete will be identified with the app info variables. +The following environment variables are used to configure the pod-delete experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -56,81 +79,326 @@ The application pod for pod-delete will be identified with the app info variable - - + + + + + + + + + + + + + + - - + + + + + +
Default Value
EXPERIMENT_NAME For Running pod delete experiment keep it pod-delete LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
TARGET_CONTAINER The name of container to be killed inside the pod LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - + - - + + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is nginx /home/runner/.kube/config
CHAOS_INTERVAL Time interval b/w two successive pod failures (in sec) APP_NS Application namespace for chaos testing Optional Default value is 5s litmus
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) ACTIVATE_INFRA Whether to activate infrastructure Optional Defaults to 15s, NOTE: Overall run duration of the experiment may exceed the TOTAL_CHAOS_DURATION by a few min true
FORCE Application Pod failures type
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-delete
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-delete
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional Default value false 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Pod Delete Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + - + + + + + + + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running pod delete experiment keep it pod-delete Mandatory No default value
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional Default value is not set to true 15
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
CHAOS_INTERVAL Time interval b/w two successive pod failures (in sec) Optional Default value is not set to true 5
FORCE Application Pod failures type Optional false
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-memory-hog/README.md b/experiments/pod-memory-hog/README.md index 028ae08..3ce4e8e 100644 --- a/experiments/pod-memory-hog/README.md +++ b/experiments/pod-memory-hog/README.md @@ -17,36 +17,59 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod-memory-hog chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-cpu-hog - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TARGET_CONTAINER: nginx - TOTAL_CHAOS_DURATION: 60 - MEMORY_CONSUMPTION: 500 - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod-memory-hog chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "pod-memory-hog-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "namespace" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-memory-hog + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod Memory Hog Specific Configuration + TARGET_CONTAINER: nginx + TOTAL_CHAOS_DURATION: 60 + MEMORY_CONSUMPTION: 500 + PODS_AFFECTED_PERC: 0 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for pod-cpu-hog will be identified with the app info variables. +The following environment variables are used to configure the pod-memory-hog experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -56,75 +79,326 @@ The application pod for pod-cpu-hog will be identified with the app info variabl - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running pod memory hog experiment keep it pod-memory-hog LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
MEMORY_CONSUMPTION The amount of memory used of hogging a Kubernetes pod LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is 500M /home/runner/.kube/config
TARGET_CONTAINER Name of the container subjected to CPU stress. APP_NS Application namespace for chaos testing Optional Default value is nginx litmus
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) ACTIVATE_INFRA Whether to activate infrastructure Optional Default value is 120s
true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-memory-hog
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-memory-hog
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Pod Memory Hog Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + + + + + + + - + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running pod memory hog experiment keep it pod-memory-hog Mandatory No default value
MEMORY_CONSUMPTION The amount of memory used of hogging a Kubernetes pod Optional Default value is not set to true 500M
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
TARGET_CONTAINER Name of the container subjected to memory stress Optional nginx
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional Default value is not set to true 120
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-network-corruption/README.md b/experiments/pod-network-corruption/README.md index 250e9d7..049504d 100644 --- a/experiments/pod-network-corruption/README.md +++ b/experiments/pod-network-corruption/README.md @@ -17,37 +17,70 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod network corruption chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-network-corruption - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TARGET_CONTAINER: nginx - TOTAL_CHAOS_DURATION: 60 - NETWORK_INTERFACE: eth0 - CONTAINER_RUNTIME: docker - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod network corruption chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Common Environment Variables + KUBECONFIG: /home/runner/.kube/config + APP_NS: litmus + ACTIVATE_INFRA: true + CREATE_ENV: true + ENV_NAME: ci-test-env + ENV_TYPE: NON_PROD + INFRA_ACTIVATION_TIMEOUT: 5 + LITMUS_USE_EXISTING_PROBE: false + APP_LABEL: app=nginx-pod-network-corruption + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: pod-network-corruption-infra + INFRA_NAMESPACE: litmus + INFRA_SCOPE: namespace + + # Application Info + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-network-corruption + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod Network Corruption Specific Configuration + TARGET_CONTAINER: nginx + TOTAL_CHAOS_DURATION: 60 + NETWORK_INTERFACE: eth0 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + PODS_AFFECTED_PERC: 0 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for pod-network-corruption will be identified with the app info variables. +The following environment variables are used to configure the pod-network-corruption experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -57,81 +90,338 @@ The application pod for pod-network-corruption will be identified with the app i - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running pod network corruption experiment keep it pod-network-corruption LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
NETWORK_INTERFACE Name of ethernet interface considered for shaping traffic LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is eth0 /home/runner/.kube/config
TARGET_CONTAINER Name of container which is subjected to network corruption. APP_NS Application namespace for chaos testing Optional Default value is nginx litmus
CONTAINER_RUNTIME Give the target container runtime ACTIVATE_INFRA Whether to activate infrastructure Optional Default value is 'docker'
true
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) CREATE_ENV Whether to create environment Optional Default value is 120s
true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-network-corruption
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-network-corruption
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Pod Network Corruption Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + - + + + + + + + + + + + + + + + + + + + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running pod network corruption experiment keep it pod-network-corruption Mandatory No default value
NETWORK_INTERFACE Name of ethernet interface considered for shaping traffic Optional Default value is not set to true eth0
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
TARGET_CONTAINER Name of container which is subjected to network corruption Optional Default value is not set to true nginx
CONTAINER_RUNTIME Give the target container runtime Optional containerd
SOCKET_PATH Socket path for the container runtime Optional /run/containerd/containerd.sock
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional 120
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-network-duplication/README.md b/experiments/pod-network-duplication/README.md index c3006d0..8f6d3d9 100644 --- a/experiments/pod-network-duplication/README.md +++ b/experiments/pod-network-duplication/README.md @@ -15,37 +15,61 @@ on: branches: [ master ] jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod network duplication chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-network-duplication - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TARGET_CONTAINER: nginx - TOTAL_CHAOS_DURATION: 60 - NETWORK_INTERFACE: eth0 - CONTAINER_RUNTIME: docker - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod network duplication chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: "pod-network-duplication-infra" + INFRA_NAMESPACE: "litmus" + INFRA_SCOPE: "namespace" + + # Application Info + APP_NS: default + APP_LABEL: run=nginx + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-network-duplication + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod Network Duplication Specific Configuration + TARGET_CONTAINER: nginx + TOTAL_CHAOS_DURATION: 60 + NETWORK_INTERFACE: eth0 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + PODS_AFFECTED_PERC: 0 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables -The application pod for pod-network-duplication will be identified with the app info variables. +The following environment variables are used to configure the pod-network-duplication experiment. -**Supported Chaos Action Tunables** +### SDK Authentication Variables (Required) @@ -55,81 +79,338 @@ The application pod for pod-network-duplication will be identified with the app - - + + - - + + + + + + + + + + + + + + + + + +
Default Value
EXPERIMENT_NAME For Running pod network duplication experiment keep it pod-network-duplication LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
NETWORK_INTERFACE Name of ethernet interface considered for shaping traffic LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + - + - - + + - + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional Default value is eth0 /home/runner/.kube/config
TARGET_CONTAINER Name of container which is subjected to network duplication. APP_NS Application namespace for chaos testing Optional Default value is nginx litmus
CONTAINER_RUNTIME Give the target container runtime ACTIVATE_INFRA Whether to activate infrastructure Optional Default value is 'docker'
true
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) CREATE_ENV Whether to create environment Optional Default value is 120s
true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-network-duplication
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-network-duplication
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables + + + + + + + + - + - - + + - + - - - + + + +
Variables Description Specify In Chaos Action Default Value
APP_NS Provide namespace of application under chaos Optional Default value is default default
APP_LABEL Provide application label of application under chaos. APP_LABEL Provide application label of application under chaos Optional Default value is run=nginx run=nginx
APP_KIND Provide the kind of application Optional Default value is deployment Provide the kind of application Optional deployment
+ +### Pod Network Duplication Experiment Variables + + - - + + + + + + + + + + + + + + - + - - - + + + - + + + + + + + + + + + + + + + + + + + - + - + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + +
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. Variables Description Specify In Chaos Action Default Value
EXPERIMENT_NAME For Running pod network duplication experiment keep it pod-network-duplication Mandatory No default value
NETWORK_INTERFACE Name of ethernet interface considered for shaping traffic Optional Default value is not set to true eth0
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos
TARGET_CONTAINER Name of container which is subjected to network duplication Optional Default value is not set to true nginx
CONTAINER_RUNTIME Give the target container runtime Optional containerd
SOCKET_PATH Socket path for the container runtime Optional /run/containerd/containerd.sock
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional 120
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is litmuschaos/go-runner litmuschaos/go-runner
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional Default value is latest 3.18.0
IMAGE_PULL_POLICY IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is Always
Always
PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional 0 (All pods)
TARGET_PODS Comma-separated list of specific pods to target Optional Not set
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Not set to true
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-network-latency/README.md b/experiments/pod-network-latency/README.md index 17bd061..c7052dd 100644 --- a/experiments/pod-network-latency/README.md +++ b/experiments/pod-network-latency/README.md @@ -17,38 +17,306 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod-network-latency chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - #If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-network-latency - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TARGET_CONTAINER: nginx - TOTAL_CHAOS_DURATION: 60 - NETWORK_INTERFACE: eth0 - NETWORK_LATENCY: 60000 - CONTAINER_RUNTIME: docker - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod-network-latency chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Common Environment Variables + KUBECONFIG: /home/runner/.kube/config + APP_NS: litmus + ACTIVATE_INFRA: true + CREATE_ENV: true + ENV_NAME: ci-test-env + ENV_TYPE: NON_PROD + INFRA_ACTIVATION_TIMEOUT: 5 + LITMUS_USE_EXISTING_PROBE: false + APP_LABEL: app=nginx-pod-network-latency + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: pod-network-latency-infra + INFRA_NAMESPACE: litmus + INFRA_SCOPE: namespace + + # Application Info + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-network-latency + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod Network Latency Specific Configuration + TARGET_CONTAINER: nginx + TOTAL_CHAOS_DURATION: 60 + NETWORK_INTERFACE: eth0 + NETWORK_LATENCY: 60000 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + PODS_AFFECTED_PERC: 0 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables + +The following environment variables are used to configure the pod-network-latency experiment. + +### SDK Authentication Variables (Required) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional /home/runner/.kube/config
APP_NS Application namespace for chaos testing Optional litmus
ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-network-latency
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-network-latency
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables -The application pod for pod-network-latency will be identified with the app info variables. + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
APP_KIND Provide the kind of application Optional deployment
-**Supported Chaos Action Tunables** +### Pod Network Latency Experiment Variables @@ -67,79 +335,88 @@ The application pod for pod-network-latency will be identified with the app info - + - + - + - - + + + + + + + + - + - + - - - - - - - - + + - - + + - + - - - - - + + + + + - - + + - + - - + + - + - - - + + - + - - + + - - + + - - + + - - + +
NETWORK_INTERFACE Name of ethernet interface considered for shaping traffic Optional Default value is eth0 eth0
NETWORK_LATENCY The latency/delay in milliseconds Optional Default (60000ms) 60000
CONTAINER_RUNTIME Give the target container runtime Optional Default value is 'docker'
containerd
SOCKET_PATH Socket path for the container runtime Optional /run/containerd/containerd.sock
TARGET_CONTAINER Name of container which is subjected to network latency. Name of container which is subjected to network latency Optional Default value is nginx nginx
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional Default value is 120s
APP_NS Provide namespace of application under chaos Optional Default value is default
120
APP_LABEL Provide application label of application under chaos. EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is run=nginx litmuschaos/go-runner
APP_KIND Provide the kind of application Optional Default value is deployment
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional 3.18.0
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is not set to true Always
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional Default value is not set to true 0 (All pods)
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment TARGET_PODS Comma-separated list of specific pods to target Optional Default value is litmuschaos/go-runner Not set
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Default value is latest
Not set to true
IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Default value is Always
Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true diff --git a/experiments/pod-network-loss/README.md b/experiments/pod-network-loss/README.md index c68b159..d2f5a39 100644 --- a/experiments/pod-network-loss/README.md +++ b/experiments/pod-network-loss/README.md @@ -17,38 +17,306 @@ on: jobs: build: - runs-on: ubuntu-latest steps: - - name: Running pod-network-loss chaos experiment - uses: litmuschaos/github-chaos-actions@v0.4.0 - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - ##If litmus is not installed - INSTALL_LITMUS: true - ##Give application info under chaos - APP_NS: default - APP_LABEL: run=nginx - APP_KIND: deployment - EXPERIMENT_NAME: pod-network-loss - ##Custom images can also be used - EXPERIMENT_IMAGE: litmuschaos/go-runner - EXPERIMENT_IMAGE_TAG: latest - IMAGE_PULL_POLICY: Always - TARGET_CONTAINER: nginx - TOTAL_CHAOS_DURATION: 60 - NETWORK_INTERFACE: eth0 - NETWORK_PACKET_LOSS_PERCENTAGE: 100 - CONTAINER_RUNTIME: docker - ##Select true if you want to uninstall litmus after chaos - LITMUS_CLEANUP: true + - name: Running pod-network-loss chaos experiment + uses: litmuschaos/github-chaos-actions@v0.4.0 + env: + KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} + + # Litmus SDK Authentication + LITMUS_ENDPOINT: "https://chaos-center.example.com" + LITMUS_USERNAME: "admin" + LITMUS_PASSWORD: ${{ secrets.LITMUS_PASSWORD }} + LITMUS_PROJECT_ID: "your-project-id" + + # Common Environment Variables + KUBECONFIG: /home/runner/.kube/config + APP_NS: litmus + ACTIVATE_INFRA: true + CREATE_ENV: true + ENV_NAME: ci-test-env + ENV_TYPE: NON_PROD + INFRA_ACTIVATION_TIMEOUT: 5 + LITMUS_USE_EXISTING_PROBE: false + APP_LABEL: app=nginx-pod-network-loss + + # Infrastructure Setup + INSTALL_INFRA: "true" + INFRA_NAME: pod-network-loss-infra + INFRA_NAMESPACE: litmus + INFRA_SCOPE: namespace + + # Application Info + APP_KIND: deployment + + # Experiment Configuration + EXPERIMENT_NAME: pod-network-loss + EXPERIMENT_IMAGE: litmuschaos/go-runner + EXPERIMENT_IMAGE_TAG: 3.18.0 + + + # Pod Network Loss Specific Configuration + TARGET_CONTAINER: nginx + TOTAL_CHAOS_DURATION: 60 + NETWORK_INTERFACE: eth0 + NETWORK_PACKET_LOSS_PERCENTAGE: 100 + CONTAINER_RUNTIME: containerd + SOCKET_PATH: /run/containerd/containerd.sock + PODS_AFFECTED_PERC: 0 + + # Optional Probe Setup + LITMUS_CREATE_PROBE: "true" + LITMUS_PROBE_NAME: "http-status-check" + LITMUS_PROBE_TYPE: "httpProbe" + LITMUS_PROBE_MODE: "SOT" + LITMUS_PROBE_URL: "http://nginx-svc:80/" + LITMUS_PROBE_RESPONSE_CODE: "200" + + # Cleanup + LITMUS_CLEANUP: true ``` -## Environment Variabels +## Environment Variables + +The following environment variables are used to configure the pod-network-loss experiment. + +### SDK Authentication Variables (Required) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_ENDPOINT URL of the Litmus Chaos Center Mandatory No default value
LITMUS_USERNAME Username for Litmus authentication Mandatory No default value
LITMUS_PASSWORD Password for Litmus authentication Mandatory No default value
LITMUS_PROJECT_ID Project ID in Litmus Mandatory No default value
+ +### Common Environment Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
KUBECONFIG Path to kubeconfig file Optional /home/runner/.kube/config
APP_NS Application namespace for chaos testing Optional litmus
ACTIVATE_INFRA Whether to activate infrastructure Optional true
CREATE_ENV Whether to create environment Optional true
ENV_NAME Name of the environment Optional ci-test-env
ENV_TYPE Type of environment Optional NON_PROD
INFRA_ACTIVATION_TIMEOUT Timeout for infrastructure activation Optional 5
LITMUS_USE_EXISTING_PROBE Whether to use existing probe Optional false
APP_LABEL Application label for targeting Optional app=nginx-pod-network-loss
+ +### Infrastructure Setup Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
INSTALL_INFRA Whether to install infrastructure Optional true
USE_EXISTING_INFRA Whether to use existing infrastructure Optional false
EXISTING_INFRA_ID ID of existing infrastructure Required if USE_EXISTING_INFRA=true No default value
INFRA_NAME Name for the infrastructure Optional ci-infra-pod-network-loss
INFRA_NAMESPACE Kubernetes namespace for infrastructure Optional litmus
INFRA_SCOPE Scope of infrastructure Optional namespace
INFRA_SERVICE_ACCOUNT Service account for infrastructure Optional litmus
+ +### Probe Configuration Variables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
LITMUS_CREATE_PROBE Whether to create a probe Optional false
LITMUS_PROBE_NAME Name of the probe Optional http-probe
LITMUS_PROBE_TYPE Type of probe Optional httpProbe
LITMUS_PROBE_MODE Mode of the probe (SOT, EOT, Continuous) Optional SOT
LITMUS_PROBE_URL URL for HTTP probe Required for HTTP probe No default value
LITMUS_PROBE_TIMEOUT Timeout for probe Optional 30s
LITMUS_PROBE_INTERVAL Interval for probe Optional 10s
LITMUS_PROBE_ATTEMPTS Number of attempts for probe Optional 1
LITMUS_PROBE_RESPONSE_CODE Expected HTTP response code Optional 200
+ +### Application Info Variables -The application pod for pod-network-loss will be identified with the app info variables. + + + + + + + + + + + + + +
Variables Description Specify In Chaos Action Default Value
APP_KIND Provide the kind of application Optional deployment
-**Supported Chaos Action Tunables** +### Pod Network Loss Experiment Variables @@ -67,78 +335,88 @@ The application pod for pod-network-loss will be identified with the app info va - + - + - + - + - + - + - - + + - - + + - + - - + + - + - - - - - + + + + + - - + + - + - - + + - + - - + + - + - - + + - - + + - - + + - - + +
NETWORK_INTERFACE Name of ethernet interface considered for shaping traffic Optional Default value is eth0 eth0
NETWORK_PACKET_LOSS_PERCENTAGE The packet loss in percentage. The packet loss in percentage Optional Default value is 100 100
TARGET_CONTAINER Name of container which is subjected to network loss. Name of container which is subjected to network loss Optional Default value is nginx nginx
TOTAL_CHAOS_DURATION The time duration for chaos injection (seconds) Optional Default value is 120s 120
CONTAINER_RUNTIME Give the target container runtime Optional Default value is 'docker'
containerd
APP_NS Provide namespace of application under chaos SOCKET_PATH Socket path for the container runtime Optional Default value is default /run/containerd/containerd.sock
APP_LABEL Provide application label of application under chaos. EXPERIMENT_IMAGE We can provide custom image for running chaos experiment Optional Default value is run=nginx litmuschaos/go-runner
APP_KIND Provide the kind of application Optional Default value is deployment
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment Optional 3.18.0
INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed. IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment Optional Default value is not set to true Always
LITMUS_CLEANUP Keep it true to uninstall litmus after chaos PODS_AFFECTED_PERC Percentage of pods affected by chaos Optional Default value is not set to true 0 (All pods)
EXPERIMENT_IMAGE We can provide custom image for running chaos experiment TARGET_PODS Comma-separated list of specific pods to target Optional Default value is litmuschaos/go-runner Not set
EXPERIMENT_IMAGE_TAG We can set the image tag while using custom image for the chaos experiment INSTALL_LITMUS Keep it true to install litmus if litmus is not already installed Optional Default value is latest
Not set to true
IMAGE_PULL_POLICY We can set the image pull policy while using custom image for running chaos experiment LITMUS_CLEANUP Keep it true to uninstall litmus after chaos Optional Default value is Always
Not set to true
+ +## Experiment Execution Process + +The experiment execution has evolved to use a more sophisticated SDK-based approach with these steps: +1. **Authentication & Setup**: Connect to Litmus Chaos Center using SDK credentials +2. **Infrastructure Provisioning**: Create or use existing chaos infrastructure +3. **Experiment Configuration**: Configure experiment parameters and probe settings +4. **Execution & Monitoring**: Run the experiment with unique ID and monitor progress +5. **Result Verification**: Verify results through detailed phase checking +6. **Optional Cleanup**: Remove chaos infrastructure if LITMUS_CLEANUP is set to true