From bbfe4fec4a8fc07140f77ea960c418e08deaf539 Mon Sep 17 00:00:00 2001 From: Naga Ravi Chaitanya Elluri Date: Thu, 25 Apr 2024 09:37:40 -0400 Subject: [PATCH] Allow users to set recovery timeout for pod scenarios Signed-off-by: Naga Ravi Chaitanya Elluri --- docs/pod-scenarios.md | 4 +--- pod-scenarios/env.sh | 3 +-- pod-scenarios/pod_scenario.yaml.template | 7 +------ pod-scenarios/pod_scenario_namespace.yaml.template | 1 + 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/docs/pod-scenarios.md b/docs/pod-scenarios.md index b0f2c79..b2fec72 100644 --- a/docs/pod-scenarios.md +++ b/docs/pod-scenarios.md @@ -36,9 +36,7 @@ POD_LABEL | Label of the pod(s) to target NAME_PATTERN | Regex pattern to match the pods in NAMESPACE when POD_LABEL is not specified | .* | DISRUPTION_COUNT | Number of pods to disrupt | 1 | KILL_TIMEOUT | Timeout to wait for the target pod(s) to be removed in seconds | 180 | -WAIT_TIMEOUT | Seconds to wait for the pod recovery to match EXPECTED_POD_COUNT | 360 | -EXPECTED_POD_COUNT | Total pod count matching the label to verify post disruption ( REQUIRED when POD_LABEL is set )| "" | - +EXPECTED_RECOVERY_TIME | Fails if the pod disrupted do not recover within the timeout set | 120 | **NOTE** Set NAMESPACE environment variable to `openshift-.*` to pick and disrupt pods randomly in openshift system namespaces, the DAEMON_MODE can also be enabled to disrupt the pods every x seconds in the background to check the reliability. diff --git a/pod-scenarios/env.sh b/pod-scenarios/env.sh index a69a672..c0f723e 100755 --- a/pod-scenarios/env.sh +++ b/pod-scenarios/env.sh @@ -5,9 +5,8 @@ export NAMESPACE=${NAMESPACE:="openshift-.*"} export POD_LABEL=${POD_LABEL:=""} export NAME_PATTERN=${NAME_PATTERN:=".*"} export DISRUPTION_COUNT=${DISRUPTION_COUNT:=1} -export EXPECTED_POD_COUNT=${EXPECTED_POD_COUNT:=""} export KILL_TIMEOUT=${KILL_TIMEOUT:=180} -export WAIT_TIMEOUT=${WAIT_TIMEOUT:=360} +export EXPECTED_RECOVERY_TIME=${EXPECTED_RECOVERY_TIME:=120} export SCENARIO_TYPE=${SCENARIO_TYPE:=plugin_scenarios} export SCENARIO_FILE=${SCENARIO_FILE:=scenarios/pod_scenario.yaml} export SCENARIO_POST_ACTION=${SCENARIO_POST_ACTION:=""} diff --git a/pod-scenarios/pod_scenario.yaml.template b/pod-scenarios/pod_scenario.yaml.template index a2c373f..e4f7e3c 100644 --- a/pod-scenarios/pod_scenario.yaml.template +++ b/pod-scenarios/pod_scenario.yaml.template @@ -4,9 +4,4 @@ label_selector: $POD_LABEL kill: $DISRUPTION_COUNT timeout: $KILL_TIMEOUT -- id: wait-for-pods - config: - namespace_pattern: $NAMESPACE - label_selector: $POD_LABEL - count: $EXPECTED_POD_COUNT - timeout: $WAIT_TIMEOUT + krkn_pod_recovery_time: $EXPECTED_RECOVERY_TIME diff --git a/pod-scenarios/pod_scenario_namespace.yaml.template b/pod-scenarios/pod_scenario_namespace.yaml.template index b94be90..b76c048 100644 --- a/pod-scenarios/pod_scenario_namespace.yaml.template +++ b/pod-scenarios/pod_scenario_namespace.yaml.template @@ -4,3 +4,4 @@ name_pattern: $NAME_PATTERN kill: $DISRUPTION_COUNT timeout: $KILL_TIMEOUT + krkn_pod_recovery_time: $EXPECTED_RECOVERY_TIME