Skip to content

Commit

Permalink
cpu-hog
Browse files Browse the repository at this point in the history
Signed-off-by: Tullio Sebastiani <[email protected]>
  • Loading branch information
tsebastiani committed Jan 17, 2024
1 parent ac47e21 commit 8d01f97
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 6 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ jobs:
yq -i '.kraken.port="8081"' CI/config/common_test_config.yaml
yq -i '.kraken.signal_address="0.0.0.0"' CI/config/common_test_config.yaml
yq -i '.kraken.performance_monitoring="localhost:9090"' CI/config/common_test_config.yaml
# echo "test_app_outages_gh" > ./CI/tests/my_tests
echo "test_container" >> ./CI/tests/my_tests
echo "test_namespace" >> ./CI/tests/my_tests
echo "test_net_chaos" >> ./CI/tests/my_tests
echo "test_time" >> ./CI/tests/my_tests
# echo "test_app_outages_gh" > ./CI/tests/my_tests
# echo "test_container" >> ./CI/tests/my_tests
# echo "test_namespace" >> ./CI/tests/my_tests
# echo "test_net_chaos" >> ./CI/tests/my_tests
# echo "test_time" >> ./CI/tests/my_tests
echo "test_arca_cpu_hog" >> ./CI/tests/my_tests
- name: Run Functional tests
run: |
./CI/run.sh
Expand Down
12 changes: 12 additions & 0 deletions CI/scenarios/arcaflow/cpu-hog/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
deployers:
image:
connection: {}
deployer_name: kubernetes
log:
level: debug
logged_outputs:
error:
level: error
success:
level: debug
9 changes: 9 additions & 0 deletions CI/scenarios/arcaflow/cpu-hog/input.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
input_list:
- cpu_count: 1
cpu_load_percentage: 80
cpu_method: all
duration: 1s
kubeconfig: ''
namespace: default
node_selector:
kubernetes.io/hostname: kind-worker2
98 changes: 98 additions & 0 deletions CI/scenarios/arcaflow/cpu-hog/sub-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
version: v0.2.0
input:
root: RootObject
objects:
RootObject:
id: input_item
properties:
kubeconfig:
display:
description: The complete kubeconfig file as a string
name: Kubeconfig file contents
type:
type_id: string
required: true
namespace:
display:
description: The namespace where the container will be deployed
name: Namespace
type:
type_id: string
required: true
node_selector:
display:
description: kubernetes node name where the plugin must be deployed
type:
type_id: map
values:
type_id: string
keys:
type_id: string
required: true
duration:
display:
name: duration the scenario expressed in seconds
description: stop stress test after T seconds. One can also specify the units of time in
seconds, minutes, hours, days or years with the suffix s, m, h, d or y
type:
type_id: string
required: true
cpu_count:
display:
description: Number of CPU cores to be used (0 means all)
name: number of CPUs
type:
type_id: integer
required: true
cpu_method:
display:
description: CPU stress method
name: fine grained control of which cpu stressors to use (ackermann, cfloat etc.)
type:
type_id: string
required: true
cpu_load_percentage:
display:
description: load CPU by percentage
name: CPU load
type:
type_id: integer
required: true

steps:
kubeconfig:
plugin:
src: quay.io/arcalot/arcaflow-plugin-kubeconfig:0.2.0
deployment_type: image
input:
kubeconfig: !expr $.input.kubeconfig
stressng:
plugin:
src: quay.io/arcalot/arcaflow-plugin-stressng:0.5.0
deployment_type: image
step: workload
input:
cleanup: "true"
StressNGParams:
timeout: !expr $.input.duration
stressors:
- stressor: cpu
cpu_count: !expr $.input.cpu_count
cpu_method: !expr $.input.cpu_method
cpu_load: !expr $.input.cpu_load_percentage
deploy:
deployer_name: kubernetes
connection: !expr $.steps.kubeconfig.outputs.success.connection
pod:
metadata:
namespace: !expr $.input.namespace
labels:
arcaflow: stressng
spec:
nodeSelector: !expr $.input.node_selector
pluginContainer:
imagePullPolicy: Always
outputs:
success:
stressng: !expr $.steps.stressng.outputs.success

77 changes: 77 additions & 0 deletions CI/scenarios/arcaflow/cpu-hog/workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: v0.2.0
input:
root: RootObject
objects:
RootObject:
id: RootObject
properties:
input_list:
type:
type_id: list
items:
id: input_item
type_id: object
properties:
kubeconfig:
display:
description: The complete kubeconfig file as a string
name: Kubeconfig file contents
type:
type_id: string
required: true
namespace:
display:
description: The namespace where the container will be deployed
name: Namespace
type:
type_id: string
required: true
node_selector:
display:
description: kubernetes node name where the plugin must be deployed
type:
type_id: map
values:
type_id: string
keys:
type_id: string
required: true
duration:
display:
name: duration the scenario expressed in seconds
description: stop stress test after T seconds. One can also specify the units of time in
seconds, minutes, hours, days or years with the suffix s, m, h, d or y
type:
type_id: string
required: true
cpu_count:
display:
description: Number of CPU cores to be used (0 means all)
name: number of CPUs
type:
type_id: integer
required: true
cpu_method:
display:
description: CPU stress method
name: fine grained control of which cpu stressors to use (ackermann, cfloat etc.)
type:
type_id: string
required: true
cpu_load_percentage:
display:
description: load CPU by percentage
name: CPU load
type:
type_id: integer
required: true
steps:
workload_loop:
kind: foreach
items: !expr $.input.input_list
workflow: sub-workflow.yaml
parallelism: 1000
outputs:
success:
workloads: !expr $.steps.workload_loop.outputs.success.data

2 changes: 1 addition & 1 deletion CI/tests/my_tests
Original file line number Diff line number Diff line change
@@ -1 +1 @@
test_net_chaos

18 changes: 18 additions & 0 deletions CI/tests/test_arca_cpu_hog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set -xeEo pipefail

source CI/tests/common.sh

trap error ERR
trap finish EXIT


function functional_test_arca_cpu_hog {
export scenario_type="arcaflow_scenarios"
export scenario_file="CI/scenarios/arcaflow/cpu-hog/input.yaml"
export post_config=""
envsubst < CI/config/common_test_config.yaml > CI/config/arca_cpu_hog.yaml
python3 -m coverage run -a run_kraken.py -c CI/config/arca_cpu_hog.yaml
echo "Arcaflow CPU Hog: Success"
}

functional_test_arca_cpu_hog

0 comments on commit 8d01f97

Please sign in to comment.