diff --git a/docker-compose.yaml b/docker-compose.yaml index 906a0c5..551d4d4 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -55,11 +55,11 @@ services: context: ./ dockerfile: ./node-io-hog/Dockerfile image: quay.io/redhat-chaos/krkn-hub:node-io-hog - namespace-scenarios: + service-disruption-scenarios: build: context: ./ - dockerfile: ./namespace-scenarios/Dockerfile - image: quay.io/redhat-chaos/krkn-hub:namespace-scenarios + dockerfile: ./service-disruption-scenarios/Dockerfile + image: quay.io/redhat-chaos/krkn-hub:service-disruption-scenarios application-outages: build: context: ./ diff --git a/docs/namespace-scenarios.md b/docs/namespace-scenarios.md index 9b55962..8db63fe 100644 --- a/docs/namespace-scenarios.md +++ b/docs/namespace-scenarios.md @@ -1,19 +1,19 @@ -### Namespace Scenarios -This scenario deletes a namespace in your Kubernetes/OpenShift cluster. More information can be found [here](https://github.com/redhat-chaos/krkn/blob/master/docs/namespace_scenarios.md). +### Namespace/Service Disruption Scenarios +This scenario deletes a namespace in your Kubernetes/OpenShift cluster. More information can be found [here](https://github.com/redhat-chaos/krkn/blob/master/docs/service_disruption_scenarios.md). #### Run If enabling [Cerberus](https://github.com/redhat-chaos/krkn#kraken-scenario-passfail-criteria-and-report) to monitor the cluster and pass/fail the scenario post chaos, refer [docs](https://github.com/redhat-chaos/krkn-hub/tree/main/docs/cerberus.md). Make sure to start it before injecting the chaos and set `CERBERUS_ENABLED` environment variable for the chaos injection container to autoconnect. ``` -$ podman run --name= --net=host --env-host=true -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:namespace-scenarios +$ podman run --name= --net=host --env-host=true -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:service-disruption-scenarios # podman logs -f # Streams Kraken logs $ podman inspect --format "{{.State.ExitCode}}" # Outputs exit code which can considered as pass/fail for the scenario ``` ``` -$ docker run $(./get_docker_params.sh) --name= --net=host -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:namespace-scenarios +$ docker run $(./get_docker_params.sh) --name= --net=host -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:service-disruption-scenarios OR -$ docker run -e = --net=host -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:namespace-scenarios +$ docker run -e = --net=host -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:service-disruption-scenarios $ docker logs -f # Streams Kraken logs $ docker inspect --format "{{.State.ExitCode}}" # Outputs exit code which can considered as pass/fail for the scenario @@ -33,7 +33,6 @@ See list of variables that apply to all scenarios [here](all_scenarios_env.md) t Parameter | Description | Default ----------------------- | ----------------------------------------------------------------- | ------------------------------------ | -ACTION | Action to take on the namespace | delete | LABEL_SELECTOR | Label of the namespace to target. Set this parameter only if NAMESPACE is not set | "" | NAMESPACE | Name of the namespace you want to target. Set this parameter only if LABEL_SELECTOR is not set | "openshift-etcd" | SLEEP | Number of seconds to wait before polling to see if namespace exists again | 15 | @@ -43,4 +42,4 @@ RUNS | Number of runs to execute the action | 1 **NOTE** In case of using custom metrics profile or alerts profile when `CAPTURE_METRICS` or `ENABLE_ALERTS` is enabled, mount the metrics profile from the host on which the container is run using podman/docker under `/root/kraken/config/metrics-aggregated.yaml` and `/root/kraken/config/alerts`. For example: ``` -$ podman run --name= --net=host --env-host=true -v :/root/kraken/config/metrics-aggregated.yaml -v :/root/kraken/config/alerts -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:container-scenarios +$ podman run --name= --net=host --env-host=true -v :/root/kraken/config/metrics-aggregated.yaml -v :/root/kraken/config/alerts -v :/root/.kube/config:Z -d quay.io/redhat-chaos/krkn-hub:service-disruption-scenarios diff --git a/prow/namespace-scenarios/prow_run.sh b/prow/namespace-scenarios/prow_run.sh index c2abc89..27ce51c 100755 --- a/prow/namespace-scenarios/prow_run.sh +++ b/prow/namespace-scenarios/prow_run.sh @@ -17,16 +17,16 @@ oc config view echo "Printing node info" for node in $(oc get nodes | awk 'NR!=1{print $1}'); do oc get node/$node -o yaml; done -source namespace-scenarios/env.sh +source service-disruption-scenarios/env.sh krkn_loc=/root/kraken # Substitute config with environment vars defined -export SCENARIO_FILE="- namespace-scenarios/namespace_scenario.yaml" -envsubst < namespace-scenarios/namespace_scenario.yaml.template > namespace-scenarios/namespace_scenario.yaml -envsubst < config.yaml.template > namespace_config.yaml +export SCENARIO_FILE="- service-disruption-scenarios/service-disruption_scenario.yaml" +envsubst < service-disruption-scenarios/service_disruption_scenario.yaml.template > service-disruption-scenarios/service_disruption_scenario.yaml +envsubst < config.yaml.template > service_disruption_config.yaml # Run Kraken -cat namespace_config.yaml -cat namespace-scenarios/namespace_scenario.yaml -python3.9 $krkn_loc/run_kraken.py --config=namespace_config.yaml +cat service_disruption_config.yaml +cat service-disruption-scenarios/service_disruption_scenario.yaml +python3.9 $krkn_loc/run_kraken.py --config=service_disruption_config.yaml diff --git a/namespace-scenarios/Dockerfile b/service-disruption-scenarios/Dockerfile similarity index 66% rename from namespace-scenarios/Dockerfile rename to service-disruption-scenarios/Dockerfile index 071c9d9..c6b55b5 100644 --- a/namespace-scenarios/Dockerfile +++ b/service-disruption-scenarios/Dockerfile @@ -12,10 +12,10 @@ RUN yum install -y which # Copy configurations COPY config.yaml.template /root/kraken/config/config.yaml.template COPY metrics_config.yaml.template /root/kraken/config/kube_burner.yaml.template -COPY namespace-scenarios/env.sh /root/env.sh +COPY service-disruption-scenarios/env.sh /root/env.sh COPY env.sh /root/main_env.sh -COPY namespace-scenarios/run.sh /root/run.sh -COPY namespace-scenarios/namespace_scenario.yaml.template /root/kraken/scenarios/namespace_scenario.yaml.template +COPY service-disruption-scenarios/run.sh /root/run.sh +COPY service-disruption-scenarios/namespace_scenario.yaml.template /root/kraken/scenarios/namespace_scenario.yaml.template COPY common_run.sh /root/common_run.sh ENTRYPOINT /root/run.sh diff --git a/namespace-scenarios/README.md b/service-disruption-scenarios/README.md similarity index 100% rename from namespace-scenarios/README.md rename to service-disruption-scenarios/README.md diff --git a/namespace-scenarios/env.sh b/service-disruption-scenarios/env.sh similarity index 79% rename from namespace-scenarios/env.sh rename to service-disruption-scenarios/env.sh index 33839a0..62f5dd4 100755 --- a/namespace-scenarios/env.sh +++ b/service-disruption-scenarios/env.sh @@ -1,12 +1,11 @@ #!/bin/bash # Vars and respective defaults -export ACTION=${ACTION:="delete"} export NAMESPACE=${NAMESPACE:="openshift-etcd"} export LABEL_SELECTOR=${LABEL_SELECTOR:="''"} export RUNS=${RUNS:=1} export DELETE_COUNT=${DELETE_COUNT:=1} export SLEEP=${SLEEP:=15} -export SCENARIO_TYPE=${SCENARIO_TYPE:=namespace_scenarios} +export SCENARIO_TYPE=${SCENARIO_TYPE:=service_disruption_scenarios} export SCENARIO_FILE=${SCENARIO_FILE:=- scenarios/namespace_scenario.yaml} export SCENARIO_POST_ACTION=${SCENARIO_POST_ACTION:=""} diff --git a/namespace-scenarios/namespace_scenario.yaml.template b/service-disruption-scenarios/namespace_scenario.yaml.template similarity index 71% rename from namespace-scenarios/namespace_scenario.yaml.template rename to service-disruption-scenarios/namespace_scenario.yaml.template index b8533b0..4c6d3f4 100644 --- a/namespace-scenarios/namespace_scenario.yaml.template +++ b/service-disruption-scenarios/namespace_scenario.yaml.template @@ -1,6 +1,5 @@ scenarios: - - action: $ACTION - namespace: $NAMESPACE + - namespace: $NAMESPACE label_selector: $LABEL_SELECTOR delete_count: $DELETE_COUNT runs: $RUNS diff --git a/namespace-scenarios/run.sh b/service-disruption-scenarios/run.sh similarity index 100% rename from namespace-scenarios/run.sh rename to service-disruption-scenarios/run.sh