feat: Add a k6-loadgen chaos fault (#622)
* feat: add load dir Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: chore Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * feat: add secret Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: hostpath to secret Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: fixed scope Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: implement feedbacks Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * fix: chore Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * Update faults/load/k6-loadgen/engine.yaml Co-authored-by: Neelanjan Manna <neelanjanmanna@gmail.com> Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * Update faults/load/k6-loadgen/fault.yaml Co-authored-by: Neelanjan Manna <neelanjanmanna@gmail.com> Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> * Update faults/load/k6-loadgen/engine.yaml Co-authored-by: Neelanjan Manna <neelanjanmanna@gmail.com> Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> --------- Signed-off-by: namkyu1999 <lak9348@konkuk.ac.kr> Co-authored-by: Neelanjan Manna <neelanjanmanna@gmail.com>
This commit is contained in:
96
faults/load/experiments.yaml
Normal file
96
faults/load/experiments.yaml
Normal file
@@ -0,0 +1,96 @@
|
||||
---
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
description:
|
||||
message: |
|
||||
Execute the k6 engine using the JS script
|
||||
kind: ChaosExperiment
|
||||
metadata:
|
||||
name: k6-loadgen
|
||||
labels:
|
||||
name: k6-loadgen
|
||||
app.kubernetes.io/part-of: litmus
|
||||
app.kubernetes.io/component: chaosexperiment
|
||||
app.kubernetes.io/version: ci
|
||||
spec:
|
||||
definition:
|
||||
scope: Namespaced
|
||||
permissions:
|
||||
# Create and monitor the experiment & helper pods
|
||||
- apiGroups: [""]
|
||||
resources: ["pods"]
|
||||
verbs:
|
||||
[
|
||||
"create",
|
||||
"delete",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"deletecollection",
|
||||
]
|
||||
# Performs CRUD operations on the events inside chaosengine and chaosresult
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["create", "get", "list", "patch", "update"]
|
||||
# Fetch configmaps & secrets details and mount it to the experiment pod (if specified)
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets", "configmaps"]
|
||||
verbs: ["get", "list"]
|
||||
# Track and get the runner, experiment, and helper pods log
|
||||
- apiGroups: [""]
|
||||
resources: ["pods/log"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# for creating and managing to execute commands inside target container
|
||||
- apiGroups: [""]
|
||||
resources: ["pods/exec"]
|
||||
verbs: ["get", "list", "create"]
|
||||
# for configuring and monitor the experiment job by the chaos-runner pod
|
||||
- apiGroups: ["batch"]
|
||||
resources: ["jobs"]
|
||||
verbs: ["create", "list", "get", "delete", "deletecollection"]
|
||||
# for creation, status polling and deletion of litmus chaos resources used within a chaos workflow
|
||||
- apiGroups: ["litmuschaos.io"]
|
||||
resources: ["chaosengines", "chaosexperiments", "chaosresults"]
|
||||
verbs: ["create", "list", "get", "patch", "update", "delete"]
|
||||
image: "litmuschaos.docker.scarf.sh/litmuschaos/go-runner:latest"
|
||||
imagePullPolicy: Always
|
||||
args:
|
||||
- -c
|
||||
- ./experiments -name k6-loadgen
|
||||
command:
|
||||
- /bin/bash
|
||||
env:
|
||||
# set chaos duration (in sec) as desired
|
||||
- name: TOTAL_CHAOS_DURATION
|
||||
value: "30"
|
||||
|
||||
# Interval between chaos injection in sec
|
||||
- name: CHAOS_INTERVAL
|
||||
value: "30"
|
||||
|
||||
# Period to wait before and after injection of chaos in sec
|
||||
- name: RAMP_TIME
|
||||
value: "0"
|
||||
|
||||
# Provide the secret name of the JS script
|
||||
- name: SCRIPT_SECRET_NAME
|
||||
value: "k6-script"
|
||||
|
||||
# Provide the secret key of the JS script
|
||||
- name: SCRIPT_SECRET_KEY
|
||||
value: "script.js"
|
||||
|
||||
# Provide the image name of the helper pod
|
||||
- name: LIB_IMAGE
|
||||
value: "ghcr.io/grafana/k6-operator:latest-runner"
|
||||
|
||||
# Provide the image pull policy of the helper pod
|
||||
- name: LIBImagePullPolicy
|
||||
value: "Always"
|
||||
|
||||
labels:
|
||||
name: k6-loadgen
|
||||
app.kubernetes.io/part-of: litmus
|
||||
app.kubernetes.io/component: experiment-job
|
||||
app.kubernetes.io/version: ci
|
||||
---
|
BIN
faults/load/icons/k6-loadgen.png
Normal file
BIN
faults/load/icons/k6-loadgen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
BIN
faults/load/icons/load.png
Normal file
BIN
faults/load/icons/load.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
45
faults/load/k6-loadgen/engine.yaml
Normal file
45
faults/load/k6-loadgen/engine.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
kind: ChaosEngine
|
||||
metadata:
|
||||
name: nginx-chaos
|
||||
namespace: default
|
||||
spec:
|
||||
engineState: 'active'
|
||||
appinfo:
|
||||
appns: ''
|
||||
applabel: ''
|
||||
appkind: ''
|
||||
chaosServiceAccount: litmus-admin
|
||||
experiments:
|
||||
- name: k6-loadgen
|
||||
spec:
|
||||
components:
|
||||
env:
|
||||
# set chaos duration (in sec) as desired
|
||||
- name: TOTAL_CHAOS_DURATION
|
||||
value: "30"
|
||||
|
||||
# Interval between chaos injection in sec
|
||||
- name: CHAOS_INTERVAL
|
||||
value: "30"
|
||||
|
||||
# Period to wait before and after injection of chaos in sec
|
||||
- name: RAMP_TIME
|
||||
value: "0"
|
||||
|
||||
# Provide the secret name of the JS script
|
||||
- name: SCRIPT_SECRET_NAME
|
||||
value: "k6-script"
|
||||
|
||||
# Provide the secret key of the JS script
|
||||
- name: SCRIPT_SECRET_KEY
|
||||
value: "script.js"
|
||||
|
||||
# Provide the image name of the helper pod
|
||||
- name: LIB_IMAGE
|
||||
value: "ghcr.io/grafana/k6-operator:latest-runner"
|
||||
|
||||
# Provide the image pull policy of the helper pod
|
||||
- name: LIB_IMAGE_PULL_POLICY
|
||||
value: "Always"
|
95
faults/load/k6-loadgen/fault.yaml
Normal file
95
faults/load/k6-loadgen/fault.yaml
Normal file
@@ -0,0 +1,95 @@
|
||||
---
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
description:
|
||||
message: |
|
||||
Execute the k6 engine using the JS script
|
||||
kind: ChaosExperiment
|
||||
metadata:
|
||||
name: k6-loadgen
|
||||
labels:
|
||||
name: k6-loadgen
|
||||
app.kubernetes.io/part-of: litmus
|
||||
app.kubernetes.io/component: chaosexperiment
|
||||
app.kubernetes.io/version: ci
|
||||
spec:
|
||||
definition:
|
||||
scope: Namespaced
|
||||
permissions:
|
||||
# Create and monitor the experiment & helper pods
|
||||
- apiGroups: [""]
|
||||
resources: ["pods"]
|
||||
verbs:
|
||||
[
|
||||
"create",
|
||||
"delete",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"deletecollection",
|
||||
]
|
||||
# Performs CRUD operations on the events inside chaosengine and chaosresult
|
||||
- apiGroups: [""]
|
||||
resources: ["events"]
|
||||
verbs: ["create", "get", "list", "patch", "update"]
|
||||
# Fetch configmaps & secrets details and mount it to the experiment pod (if specified)
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets", "configmaps"]
|
||||
verbs: ["get", "list"]
|
||||
# Track and get the runner, experiment, and helper pods log
|
||||
- apiGroups: [""]
|
||||
resources: ["pods/log"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# for creating and managing to execute commands inside target container
|
||||
- apiGroups: [""]
|
||||
resources: ["pods/exec"]
|
||||
verbs: ["get", "list", "create"]
|
||||
# for configuring and monitor the experiment job by the chaos-runner pod
|
||||
- apiGroups: ["batch"]
|
||||
resources: ["jobs"]
|
||||
verbs: ["create", "list", "get", "delete", "deletecollection"]
|
||||
# for creation, status polling and deletion of litmus chaos resources used within a chaos workflow
|
||||
- apiGroups: ["litmuschaos.io"]
|
||||
resources: ["chaosengines", "chaosexperiments", "chaosresults"]
|
||||
verbs: ["create", "list", "get", "patch", "update", "delete"]
|
||||
image: "litmuschaos.docker.scarf.sh/litmuschaos/go-runner:latest"
|
||||
imagePullPolicy: Always
|
||||
args:
|
||||
- -c
|
||||
- ./experiments -name k6-loadgen
|
||||
command:
|
||||
- /bin/bash
|
||||
env:
|
||||
# set chaos duration (in sec) as desired
|
||||
- name: TOTAL_CHAOS_DURATION
|
||||
value: "30"
|
||||
|
||||
# Interval between chaos injection in sec
|
||||
- name: CHAOS_INTERVAL
|
||||
value: "30"
|
||||
|
||||
# Period to wait before and after injection of chaos in sec
|
||||
- name: RAMP_TIME
|
||||
value: "0"
|
||||
|
||||
# Provide the secret name of the JS script
|
||||
- name: SCRIPT_SECRET_NAME
|
||||
value: "k6-script"
|
||||
|
||||
# Provide the secret key of the JS script
|
||||
- name: SCRIPT_SECRET_KEY
|
||||
value: "script.js"
|
||||
|
||||
# Provide the image name of the helper pod
|
||||
- name: LIB_IMAGE
|
||||
value: "ghcr.io/grafana/k6-operator:latest-runner"
|
||||
|
||||
# Provide the image pull policy of the helper pod
|
||||
- name: LIB_IMAGE_PULL_POLICY
|
||||
value: "Always"
|
||||
|
||||
labels:
|
||||
name: k6-loadgen
|
||||
app.kubernetes.io/part-of: litmus
|
||||
app.kubernetes.io/component: experiment-job
|
||||
app.kubernetes.io/version: ci
|
29
faults/load/k6-loadgen/k6-loadgen.chartserviceversion.yaml
Normal file
29
faults/load/k6-loadgen/k6-loadgen.chartserviceversion.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
kind: ChartServiceVersion
|
||||
metadata:
|
||||
createdAt: 2024-02-10T01:00:00Z
|
||||
name: k6-loadgen
|
||||
version: 0.1.0
|
||||
annotations:
|
||||
categories: Load
|
||||
vendor: LitmusChaos
|
||||
spec:
|
||||
displayName: k6 Load Generator
|
||||
categoryDescription: |
|
||||
k6 is an open-source load testing tool that makes performance testing easy and productive for engineering teams. You can easily run load testing through a single JS script. It's a modern alternative to LoadRunner, Grinder, and JMeter.
|
||||
keywords:
|
||||
- k6
|
||||
- Load
|
||||
platforms:
|
||||
- kubernetes
|
||||
maintainers:
|
||||
- name: Namkyu Park
|
||||
email: lak9348@gmail.com
|
||||
minKubeVersion: 1.32.0
|
||||
links:
|
||||
- name: Documentation
|
||||
url: https://litmuschaos.github.io/litmus/experiments/categories/contents
|
||||
icon:
|
||||
- url:
|
||||
mediatype: ""
|
32
faults/load/load.chartserviceversion.yaml
Normal file
32
faults/load/load.chartserviceversion.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
kind: ChartServiceVersion
|
||||
metadata:
|
||||
name: load
|
||||
version: 0.1.0
|
||||
annotations:
|
||||
categories: Load
|
||||
chartDescription: Injects load on the application
|
||||
executionPlane: "kubernetes"
|
||||
spec:
|
||||
displayName: Load
|
||||
categoryDescription: >
|
||||
Load chaos contains different chaos experiments to test the app/platform service availability. It will install all the experiments which can be used to inject load into the services like VMs, Pods and so on.
|
||||
faults:
|
||||
- name: k6-loadgen
|
||||
description: It injects the load on the application using k6 load generator
|
||||
displayName: "k6 Load Generator"
|
||||
keywords:
|
||||
- Load
|
||||
maintainers:
|
||||
- name: Namkyu Park
|
||||
email: lak9348@gmail.com
|
||||
minKubeVersion: 1.32.0
|
||||
links:
|
||||
- name: Kubernetes Website
|
||||
url: https://kubernetes.io
|
||||
- name: k6 Website
|
||||
url: https://k6.io/
|
||||
icon:
|
||||
- url: https://github.com/litmuschaos/chaos-charts/blob/master/faults/load/icons/k6-loadgen.png
|
||||
mediatype: image/png
|
6
faults/load/load.package.yaml
Normal file
6
faults/load/load.package.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
packageName: load
|
||||
experiments:
|
||||
- name: k6-loadgen
|
||||
CSV: k6-loadgen.chartserviceversion.yaml
|
||||
desc: "k6-loadgen"
|
Reference in New Issue
Block a user