Skip to content

Commit

Permalink
Adding network-chaos to prow (#144)
Browse files Browse the repository at this point in the history
* Adding network-chaos to prow

* Minor changes in if loop
  • Loading branch information
shahsahil264 authored Oct 18, 2023
1 parent 6d4dac2 commit 88fca9d
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions prow/network-chaos/prow_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

set -ex

ls

# Source env.sh to read all the vars
source env.sh

export KUBECONFIG=$KRKN_KUBE_CONFIG


# Cluster details
echo "Printing cluster details"
oc version
cat $KRKN_KUBE_CONFIG
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 network-chaos/env.sh

krn_loc=/root/kraken

# Substitute config with environment vars defined
if [[ $TRAFFIC_TYPE == "egress" ]]; then
envsubst < /root/kraken/scenarios/network_chaos_egress.yaml.template > $krn_loc/scenarios/network_chaos.yaml
elif [[ $TRAFFIC_TYPE == "ingress" ]]; then
envsubst < /root/kraken/scenarios/network_chaos_ingress.yaml.template > $krn_loc/scenarios/network_chaos.yaml
export SCENARIO_TYPE="plugin_scenarios"
else
echo "Supported TRAFFIC_TYPE options are egress or ingress, please check"
exit 1
fi

export SCENARIO_FILE=network-chaos/network_chaos.yaml
envsubst < config.yaml.template > network_chaos_config.yaml

cat network_chaos_config.yaml
cat network-chaos/network_chaos.yaml

python3.9 $krn_loc/run_kraken.py --config=network_chaos_config.yaml

0 comments on commit 88fca9d

Please sign in to comment.