Skip to content

Commit

Permalink
adding docker-compose
Browse files Browse the repository at this point in the history
Signed-off-by: Paige Patton <[email protected]>
  • Loading branch information
paigerube14 authored and chaitanyaenr committed Nov 20, 2024
1 parent 278f3ff commit 4568f2f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 9 deletions.
5 changes: 5 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions syn-flood/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions syn-flood/env.sh
Original file line number Diff line number Diff line change
@@ -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}
export SCENARIO_FILE=${SCENARIO_FILE:="$KRAKEN_FOLDER/scenarios/syn-flood.yaml"}
5 changes: 4 additions & 1 deletion syn-flood/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions syn-flood/syn-flood.yaml.template
Original file line number Diff line number Diff line change
@@ -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


0 comments on commit 4568f2f

Please sign in to comment.