diff --git a/docker-compose.yaml b/docker-compose.yaml index dbdc906..a1a4e0a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -89,3 +89,8 @@ services: context: ./ dockerfile: ./service-hijacking/Dockerfile image: quay.io/krkn-chaos/krkn-hub:service-hijacking + syn-flood: + build: + context: ./ + dockerfile: ./syn-flood/Dockerfile + image: quay.io/krkn-chaos/krkn-hub:syn-flood \ No newline at end of file diff --git a/syn-flood/Dockerfile.template b/syn-flood/Dockerfile.template index afd0eb9..d8266a4 100644 --- a/syn-flood/Dockerfile.template +++ b/syn-flood/Dockerfile.template @@ -1,14 +1,15 @@ # Dockerfile for kraken -#FROM quay.io/krkn-chaos/krkn:latest -FROM quay.io/rh_ee_tsebasti/krkn:syn +FROM quay.io/krkn-chaos/krkn:latest + ENV KUBECONFIG /home/krkn/.kube/config # Copy configurations -COPY metrics_config.yaml.template /home/krkn/kraken/config/kube_burner.yaml.template + COPY config.yaml.template /home/krkn/kraken/config/config.yaml.template COPY syn-flood/env.sh /home/krkn/env.sh COPY syn-flood/build_config_file.py /home/krkn/build_config_file.py +COPY syn-flood/syn-flood.yaml.template /home/krkn/kraken/scenarios/syn-flood.yaml.template COPY env.sh /home/krkn/main_env.sh COPY syn-flood/run.sh /home/krkn/run.sh COPY common_run.sh /home/krkn/common_run.sh diff --git a/syn-flood/env.sh b/syn-flood/env.sh index 0b422ce..7572d72 100644 --- a/syn-flood/env.sh +++ b/syn-flood/env.sh @@ -1,15 +1,14 @@ #!/bin/bash -export SCENARIO_CONFIG_FILE="$KRAKEN_FOLDER/scenarios/kube/syn_flood_config.yaml" export PACKET_SIZE=${PACKET_SIZE:="120"} export WINDOW_SIZE=${WINDOW_SIZE:="64"} export TOTAL_CHAOS_DURATION=${TOTAL_CHAOS_DURATION:="120"} export NAMESPACE=${NAMESPACE:="default"} -export TARGET_SERVICE=${TARGET_SERVICE} -export TARGET_PORT=${TARGET_PORT} -export TARGET_SERVICE_LABEL=${TARGET_SERVICE_LABEL} +export TARGET_SERVICE=${TARGET_SERVICE:=""} +export TARGET_PORT=${TARGET_PORT:=443} +export TARGET_SERVICE_LABEL=${TARGET_SERVICE_LABEL:=""} export NUMBER_OF_PODS=${NUMBER_OF_PODS:="2"} export IMAGE=${IMAGE:="quay.io/krkn-chaos/krkn-syn-flood"} export NODE_SELECTORS=${NODE_SELECTORS:=""} export SCENARIO_TYPE=${SCENARIO_TYPE:=syn_flood_scenarios} -export SCENARIO_FILE=${SCENARIO_FILE:=$SCENARIO_CONFIG_FILE} \ No newline at end of file +export SCENARIO_FILE=${SCENARIO_FILE:="$KRAKEN_FOLDER/scenarios/syn-flood.yaml"} \ No newline at end of file diff --git a/syn-flood/run.sh b/syn-flood/run.sh index 0755b82..274f86f 100755 --- a/syn-flood/run.sh +++ b/syn-flood/run.sh @@ -13,10 +13,13 @@ source $ROOT_FOLDER/env.sh source $ROOT_FOLDER/common_run.sh # Substitute config with environment vars defined +envsubst < $KRAKEN_FOLDER/scenarios/syn-flood.yaml.template > $KRAKEN_FOLDER/scenarios/syn-flood.yaml envsubst < $KRAKEN_FOLDER/config/config.yaml.template > $KRAKEN_FOLDER/config/syn_flood_config.yaml +cat $KRAKEN_FOLDER/config/syn_flood_config.yaml +cat $KRAKEN_FOLDER/scenarios/syn-flood.yaml + checks -config_setup # Run Kraken cd $KRAKEN_FOLDER diff --git a/syn-flood/syn-flood.yaml.template b/syn-flood/syn-flood.yaml.template new file mode 100644 index 0000000..0834ef1 --- /dev/null +++ b/syn-flood/syn-flood.yaml.template @@ -0,0 +1,16 @@ +packet-size: ${PACKET_SIZE} +window-size: ${WINDOW_SIZE} # hping 3 TCP window size +duration: ${TOTAL_CHAOS_DURATION} # chaos scenario duration +namespace: ${NAMESPACE} # namespace where the target service(s) are deployed +target-service: ${TARGET_SERVICE} # target service name (if set target-service-label must be empty) +target-port: ${TARGET_PORT} # target service TCP port +target-service-label : ${TARGET_SERVICE_LABEL} # target service label, can be used to target multiple target at the same time + # if they have the same label set (if set target-service must be empty) +number-of-pods: ${NUMBER_OF_PODS} # number of attacker pod instantiated per each target +image: quay.io/krkn-chaos/krkn-syn-flood:v1.0.0 # syn flood attacker container image +attacker-nodes: # this will set the node affinity to schedule the attacker node. Per each node label selector + node-role.kubernetes.io/worker: # can be specified multiple values in this way the kube scheduler will schedule the attacker pods + - "" # in the best way possible based on the provided labels. Multiple labels can be specified + # set empty value `attacker-nodes: {}` to let kubernetes schedule the pods + +