From ff7fa389cc402e6d2d9d9ea67fc9af80e0a1f21b Mon Sep 17 00:00:00 2001 From: namkyu1999 Date: Sat, 10 Feb 2024 13:58:26 +0900 Subject: [PATCH 01/10] feat: add load dir Signed-off-by: namkyu1999 --- .gitignore | 215 ++++++++++++++++++ faults/load/experiments.yaml | 104 +++++++++ faults/load/icons/k6-loadgen.png | Bin 0 -> 4555 bytes faults/load/k6-loadgen/engine.yaml | 26 +++ faults/load/k6-loadgen/fault.yaml | 84 +++++++ .../k6-loadgen.chartserviceversion.yaml | 29 +++ faults/load/load.chartserviceversion.yaml | 32 +++ faults/load/load.yaml | 6 + 8 files changed, 496 insertions(+) create mode 100644 .gitignore create mode 100644 faults/load/experiments.yaml create mode 100644 faults/load/icons/k6-loadgen.png create mode 100644 faults/load/k6-loadgen/engine.yaml create mode 100644 faults/load/k6-loadgen/fault.yaml create mode 100644 faults/load/k6-loadgen/k6-loadgen.chartserviceversion.yaml create mode 100644 faults/load/load.chartserviceversion.yaml create mode 100644 faults/load/load.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..b3c607500 --- /dev/null +++ b/.gitignore @@ -0,0 +1,215 @@ +# Created by https://www.toptal.com/developers/gitignore/api/git,visualstudiocode,goland+all,jetbrains+all,macos +# Edit at https://www.toptal.com/developers/gitignore?templates=git,visualstudiocode,goland+all,jetbrains+all,macos + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### GoLand+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### GoLand+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### JetBrains+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### JetBrains+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + + + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### VisualStudioCode ### +.vscode/ +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# End of https://www.toptal.com/developers/gitignore/api/git,visualstudiocode,goland+all,jetbrains+all,macos \ No newline at end of file diff --git a/faults/load/experiments.yaml b/faults/load/experiments.yaml new file mode 100644 index 000000000..c6d2607b6 --- /dev/null +++ b/faults/load/experiments.yaml @@ -0,0 +1,104 @@ +--- +apiVersion: litmuschaos.io/v1alpha1 +description: + message: | + Stops an Azure instance for a certain chaos duration +kind: ChaosExperiment +metadata: + name: azure-instance-stop + labels: + name: azure-instance-stop + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: chaosexperiment + app.kubernetes.io/version: ci +spec: + definition: + scope: Cluster + 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 azure-instance-stop + command: + - /bin/bash + env: + - name: TOTAL_CHAOS_DURATION + value: "30" + + - name: CHAOS_INTERVAL + value: "30" + + # Period to wait before and after injection of chaos in sec + - name: RAMP_TIME + value: "" + + # provide the target instance name(s) (comma separated if multiple) + - name: AZURE_INSTANCE_NAMES + value: "" + + # provide the resource group of the instance + - name: RESOURCE_GROUP + value: "" + + # accepts enable/disable, default is disable + - name: SCALE_SET + value: "" + + # Provide the path of aks credentials mounted from secret + - name: AZURE_AUTH_LOCATION + value: "/tmp/azure.auth" + + - name: SEQUENCE + value: "parallel" + + - name: DEFAULT_HEALTH_CHECK + value: "false" + + labels: + name: azure-instance-stop + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: experiment-job + app.kubernetes.io/version: ci + secrets: + - name: cloud-secret + mountPath: /tmp/ + +--- \ No newline at end of file diff --git a/faults/load/icons/k6-loadgen.png b/faults/load/icons/k6-loadgen.png new file mode 100644 index 0000000000000000000000000000000000000000..3e8f8459d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q4{;HjS^xk5 literal 0 HcmV?d00001 diff --git a/faults/load/k6-loadgen/engine.yaml b/faults/load/k6-loadgen/engine.yaml new file mode 100644 index 000000000..ccb237d7f --- /dev/null +++ b/faults/load/k6-loadgen/engine.yaml @@ -0,0 +1,26 @@ +--- +apiVersion: litmuschaos.io/v1alpha1 +kind: ChaosEngine +metadata: + name: nginx-chaos + namespace: default +spec: + engineState: 'active' + chaosServiceAccount: litmus-admin + experiments: + - name: k6-loadgen + spec: + components: + env: + # set chaos duration (in sec) as desired + - name: TOTAL_CHAOS_DURATION + value: '30' + + # set chaos intreval (in sec) as desired + - name: CHAOS_INTERVAL + value: '30' + + # set the path of the JS script + - name: SCRIPT_PATH + value: '/tmp/script.js' + diff --git a/faults/load/k6-loadgen/fault.yaml b/faults/load/k6-loadgen/fault.yaml new file mode 100644 index 000000000..0cb41954f --- /dev/null +++ b/faults/load/k6-loadgen/fault.yaml @@ -0,0 +1,84 @@ +--- +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: Cluster + 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: + - name: TOTAL_CHAOS_DURATION + value: "30" + + - name: CHAOS_INTERVAL + value: "30" + + # Period to wait before and after injection of chaos in sec + - name: RAMP_TIME + value: "" + + # Provide the path of the JS script + - name: SCRIPT_PATH + value: "/tmp/script.js" + + labels: + name: azure-instance-stop + app.kubernetes.io/part-of: litmus + app.kubernetes.io/component: experiment-job + app.kubernetes.io/version: ci + secrets: + - name: cloud-secret + mountPath: /tmp/ diff --git a/faults/load/k6-loadgen/k6-loadgen.chartserviceversion.yaml b/faults/load/k6-loadgen/k6-loadgen.chartserviceversion.yaml new file mode 100644 index 000000000..485aabbcd --- /dev/null +++ b/faults/load/k6-loadgen/k6-loadgen.chartserviceversion.yaml @@ -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: "" diff --git a/faults/load/load.chartserviceversion.yaml b/faults/load/load.chartserviceversion.yaml new file mode 100644 index 000000000..95465e231 --- /dev/null +++ b/faults/load/load.chartserviceversion.yaml @@ -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 diff --git a/faults/load/load.yaml b/faults/load/load.yaml new file mode 100644 index 000000000..9120118f9 --- /dev/null +++ b/faults/load/load.yaml @@ -0,0 +1,6 @@ +--- +packageName: load +faults: + - name: k6-loadgen + CSV: k6-loadgen.chartserviceversion.yaml + desc: "k6-loadgen" \ No newline at end of file From 7b57b918e340950d9cadb36ac57c1f80489f3c10 Mon Sep 17 00:00:00 2001 From: namkyu1999 Date: Thu, 15 Feb 2024 02:48:14 +0900 Subject: [PATCH 02/10] fix: chore Signed-off-by: namkyu1999 --- faults/load/experiments.yaml | 6 +----- faults/load/k6-loadgen/fault.yaml | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/faults/load/experiments.yaml b/faults/load/experiments.yaml index c6d2607b6..c95b2fb10 100644 --- a/faults/load/experiments.yaml +++ b/faults/load/experiments.yaml @@ -93,12 +93,8 @@ spec: value: "false" labels: - name: azure-instance-stop + name: k6-loadgen app.kubernetes.io/part-of: litmus app.kubernetes.io/component: experiment-job app.kubernetes.io/version: ci - secrets: - - name: cloud-secret - mountPath: /tmp/ - --- \ No newline at end of file diff --git a/faults/load/k6-loadgen/fault.yaml b/faults/load/k6-loadgen/fault.yaml index 0cb41954f..33fbd53c7 100644 --- a/faults/load/k6-loadgen/fault.yaml +++ b/faults/load/k6-loadgen/fault.yaml @@ -75,10 +75,7 @@ spec: value: "/tmp/script.js" labels: - name: azure-instance-stop + name: k6-loadgen app.kubernetes.io/part-of: litmus app.kubernetes.io/component: experiment-job app.kubernetes.io/version: ci - secrets: - - name: cloud-secret - mountPath: /tmp/ From 8f7b777dcc65d560c51a01bf12930f76e8ff17fe Mon Sep 17 00:00:00 2001 From: namkyu1999 Date: Thu, 15 Feb 2024 15:20:11 +0900 Subject: [PATCH 03/10] feat: add secret Signed-off-by: namkyu1999 --- faults/load/experiments.yaml | 35 +++++++++--------------------- faults/load/k6-loadgen/engine.yaml | 1 - faults/load/k6-loadgen/fault.yaml | 3 +++ 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/faults/load/experiments.yaml b/faults/load/experiments.yaml index c95b2fb10..65c8980d3 100644 --- a/faults/load/experiments.yaml +++ b/faults/load/experiments.yaml @@ -2,12 +2,12 @@ apiVersion: litmuschaos.io/v1alpha1 description: message: | - Stops an Azure instance for a certain chaos duration + Execute the k6 engine using the JS script kind: ChaosExperiment metadata: - name: azure-instance-stop + name: k6-loadgen labels: - name: azure-instance-stop + name: k6-loadgen app.kubernetes.io/part-of: litmus app.kubernetes.io/component: chaosexperiment app.kubernetes.io/version: ci @@ -56,7 +56,7 @@ spec: imagePullPolicy: Always args: - -c - - ./experiments -name azure-instance-stop + - ./experiments -name k6-loadgen command: - /bin/bash env: @@ -70,31 +70,16 @@ spec: - name: RAMP_TIME value: "" - # provide the target instance name(s) (comma separated if multiple) - - name: AZURE_INSTANCE_NAMES - value: "" - - # provide the resource group of the instance - - name: RESOURCE_GROUP - value: "" - - # accepts enable/disable, default is disable - - name: SCALE_SET - value: "" - - # Provide the path of aks credentials mounted from secret - - name: AZURE_AUTH_LOCATION - value: "/tmp/azure.auth" - - - name: SEQUENCE - value: "parallel" - - - name: DEFAULT_HEALTH_CHECK - value: "false" + # Provide the path of the JS script + - name: SCRIPT_PATH + value: "/tmp/script.js" labels: name: k6-loadgen app.kubernetes.io/part-of: litmus app.kubernetes.io/component: experiment-job app.kubernetes.io/version: ci + secrets: + - name: k6-script + mountPath: /tmp/ --- \ No newline at end of file diff --git a/faults/load/k6-loadgen/engine.yaml b/faults/load/k6-loadgen/engine.yaml index ccb237d7f..7db5f3657 100644 --- a/faults/load/k6-loadgen/engine.yaml +++ b/faults/load/k6-loadgen/engine.yaml @@ -23,4 +23,3 @@ spec: # set the path of the JS script - name: SCRIPT_PATH value: '/tmp/script.js' - diff --git a/faults/load/k6-loadgen/fault.yaml b/faults/load/k6-loadgen/fault.yaml index 33fbd53c7..a10ad0ac7 100644 --- a/faults/load/k6-loadgen/fault.yaml +++ b/faults/load/k6-loadgen/fault.yaml @@ -79,3 +79,6 @@ spec: app.kubernetes.io/part-of: litmus app.kubernetes.io/component: experiment-job app.kubernetes.io/version: ci + secrets: + - name: k6-script + mountPath: /tmp/ \ No newline at end of file From 90b7901ad8a21e9e77e952765fb34dd135d50933 Mon Sep 17 00:00:00 2001 From: namkyu1999 Date: Thu, 15 Feb 2024 17:17:42 +0900 Subject: [PATCH 04/10] fix: hostpath to secret Signed-off-by: namkyu1999 --- faults/load/experiments.yaml | 13 +++++++------ faults/load/k6-loadgen/engine.yaml | 10 +++++++--- faults/load/k6-loadgen/fault.yaml | 15 ++++++++------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/faults/load/experiments.yaml b/faults/load/experiments.yaml index 65c8980d3..124e49212 100644 --- a/faults/load/experiments.yaml +++ b/faults/load/experiments.yaml @@ -70,16 +70,17 @@ spec: - name: RAMP_TIME value: "" - # Provide the path of the JS script - - name: SCRIPT_PATH - value: "/tmp/script.js" + # 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" labels: name: k6-loadgen app.kubernetes.io/part-of: litmus app.kubernetes.io/component: experiment-job app.kubernetes.io/version: ci - secrets: - - name: k6-script - mountPath: /tmp/ --- \ No newline at end of file diff --git a/faults/load/k6-loadgen/engine.yaml b/faults/load/k6-loadgen/engine.yaml index 7db5f3657..43f83d6dd 100644 --- a/faults/load/k6-loadgen/engine.yaml +++ b/faults/load/k6-loadgen/engine.yaml @@ -20,6 +20,10 @@ spec: - name: CHAOS_INTERVAL value: '30' - # set the path of the JS script - - name: SCRIPT_PATH - value: '/tmp/script.js' + # 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" diff --git a/faults/load/k6-loadgen/fault.yaml b/faults/load/k6-loadgen/fault.yaml index a10ad0ac7..17d1688fb 100644 --- a/faults/load/k6-loadgen/fault.yaml +++ b/faults/load/k6-loadgen/fault.yaml @@ -70,15 +70,16 @@ spec: - name: RAMP_TIME value: "" - # Provide the path of the JS script - - name: SCRIPT_PATH - value: "/tmp/script.js" + # 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" labels: name: k6-loadgen app.kubernetes.io/part-of: litmus app.kubernetes.io/component: experiment-job - app.kubernetes.io/version: ci - secrets: - - name: k6-script - mountPath: /tmp/ \ No newline at end of file + app.kubernetes.io/version: ci \ No newline at end of file From c578df21c75a2be926226172f8cc61038872a3ed Mon Sep 17 00:00:00 2001 From: namkyu1999 Date: Fri, 16 Feb 2024 16:16:05 +0900 Subject: [PATCH 05/10] fix: fixed scope Signed-off-by: namkyu1999 --- faults/load/experiments.yaml | 14 ++++++++++++-- faults/load/k6-loadgen/engine.yaml | 18 +++++++++++++++--- faults/load/k6-loadgen/fault.yaml | 14 ++++++++++++-- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/faults/load/experiments.yaml b/faults/load/experiments.yaml index 124e49212..f19b6a9ba 100644 --- a/faults/load/experiments.yaml +++ b/faults/load/experiments.yaml @@ -13,7 +13,7 @@ metadata: app.kubernetes.io/version: ci spec: definition: - scope: Cluster + scope: Namespaced permissions: # Create and monitor the experiment & helper pods - apiGroups: [""] @@ -60,15 +60,17 @@ spec: 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: "" + value: "0" # Provide the secret name of the JS script - name: SCRIPT_SECRET_NAME @@ -78,6 +80,14 @@ spec: - 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 diff --git a/faults/load/k6-loadgen/engine.yaml b/faults/load/k6-loadgen/engine.yaml index 43f83d6dd..ff1e7ce35 100644 --- a/faults/load/k6-loadgen/engine.yaml +++ b/faults/load/k6-loadgen/engine.yaml @@ -14,11 +14,15 @@ spec: env: # set chaos duration (in sec) as desired - name: TOTAL_CHAOS_DURATION - value: '30' + value: "30" - # set chaos intreval (in sec) as desired + # Interval between chaos injection in sec - name: CHAOS_INTERVAL - value: '30' + 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 @@ -27,3 +31,11 @@ spec: # 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" diff --git a/faults/load/k6-loadgen/fault.yaml b/faults/load/k6-loadgen/fault.yaml index 17d1688fb..1867c8f21 100644 --- a/faults/load/k6-loadgen/fault.yaml +++ b/faults/load/k6-loadgen/fault.yaml @@ -13,7 +13,7 @@ metadata: app.kubernetes.io/version: ci spec: definition: - scope: Cluster + scope: Namespaced permissions: # Create and monitor the experiment & helper pods - apiGroups: [""] @@ -60,15 +60,17 @@ spec: 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: "" + value: "0" # Provide the secret name of the JS script - name: SCRIPT_SECRET_NAME @@ -78,6 +80,14 @@ spec: - 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 From d499c1a5efdc27571c94eb366feff235e939aad0 Mon Sep 17 00:00:00 2001 From: namkyu1999 Date: Fri, 15 Mar 2024 14:27:55 +0900 Subject: [PATCH 06/10] fix: implement feedbacks Signed-off-by: namkyu1999 --- faults/load/icons/load.png | Bin 0 -> 3148 bytes faults/load/{load.yaml => load.package.yaml} | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 faults/load/icons/load.png rename faults/load/{load.yaml => load.package.yaml} (89%) diff --git a/faults/load/icons/load.png b/faults/load/icons/load.png new file mode 100644 index 0000000000000000000000000000000000000000..e197a5d97a1fda0e15abd4e75f6df678c04dacf6 GIT binary patch literal 3148 zcmb7`dpr|<7srjlTvN#Nnxoj@OhCF_+=kMqFJ-yY;^E;DIfq0z z?)$!dYY^n$Kl6gSwf7w`80i+m!*fXDF9YyA&6C+r0zw?E&+t?Yf#>&w0~iZi3m%@@ z)I&So2lrLe=MWao;ee%|%&<|U)Ik<0Z?}EOOM{OhSPtXO>+*x*lb>512!}dI01n@K zD#$`SFA(&CdU1=Svg6mUIJUiLXl63=PJMLM`c&4;oqUC4;1uhUnE;m2r2QSxs6v&^fp!N;Cia_+Azjc75& zXj1j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ejk=kvIXP$nP6A^$*sEh@1_4bGhj9Vm<29%Et=;zZKPziQD7?x?kFEfYnd|Q zTL4`V$>fIKNJJw>=R{Cu4>e*^<9t316NQ0D^H&v9N*M|D=+S=cK2xR5X7e7bwmkv; z&U`H6-9s7%Q|VmehEa{OqG)0~-PS*hN|i-wWvG&S}RRuBfId2)nyJt5AvNU^@1lH5f)6p4^Vd0fgptV zv=X>Id63MZ+Z3w+M)*tBYZkXj z4J_Q)4N)cWU^nW`iC9hTVnsC-yRH2F@9**^W9S_Uo-KJ1yKa0l6=<~Q=j1{FxY^+c z1zVV1SfKU;fZGs1Ou>D_Ov<7}TqX^DfFhaRIu-3H(w%tC_o&w790*pp zPtSxG1Yedp90Q2v?UVdxT>lgLui`ELqZd9!2G&{PQn=TgS9cZJezr|7(^zSYXJ=mFU@`iUry zP~Vaqp37byk` zBja`h_ilD74_5Tb@y+PUBqu-^t|)k`X#8)HVo|dstAEnXzopi_9+f8D3rd+Jd7a#> z5GYY@_Ok?}W9>gJn0lhNOr1elVpCoxL%X=5wZ3pUS+73`zcU)HH|amgo(=kJ#o+f{ z#-B7^d~g&Jp*Idl5B`;_&1ZQ=x*Uka56Z~O8u>_EOZx+o?H-*%K}cKjg1omGd-PxV zery#;W6dTAAr0qU1#dvZbFKDoGX_2qd}m&(0ah4&0E9*_K{E0GeYJnf`JZ8EKHxcx z;C)L-joe}dJnEQ6iFKfib(o(q_imWY&!^SkpOkHw%87y7Fboy1^Eub;Ocpfe`)>K z=U>a@&iK~&CxA(54lej}^4e^A)N2vUgZxX$KyeBeLe9L)yLE@$jG*nfogKI_0G>!Yz` Date: Fri, 15 Mar 2024 14:29:22 +0900 Subject: [PATCH 07/10] fix: chore Signed-off-by: namkyu1999 --- faults/load/load.package.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faults/load/load.package.yaml b/faults/load/load.package.yaml index dc9477618..5a423e34b 100644 --- a/faults/load/load.package.yaml +++ b/faults/load/load.package.yaml @@ -3,4 +3,4 @@ packageName: load experiments: - name: k6-loadgen CSV: k6-loadgen.chartserviceversion.yaml - desc: "k6-loadgen" \ No newline at end of file + desc: "k6-loadgen" From 465575fe714dfa8b2fdfee4f59053dc2820f71bb Mon Sep 17 00:00:00 2001 From: Namkyu Park <53862866+namkyu1999@users.noreply.github.com> Date: Thu, 4 Apr 2024 23:10:04 +0900 Subject: [PATCH 08/10] Update faults/load/k6-loadgen/engine.yaml Co-authored-by: Neelanjan Manna Signed-off-by: namkyu1999 --- faults/load/k6-loadgen/engine.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faults/load/k6-loadgen/engine.yaml b/faults/load/k6-loadgen/engine.yaml index ff1e7ce35..72f710edc 100644 --- a/faults/load/k6-loadgen/engine.yaml +++ b/faults/load/k6-loadgen/engine.yaml @@ -37,5 +37,5 @@ spec: value: "ghcr.io/grafana/k6-operator:latest-runner" # Provide the image pull policy of the helper pod - - name: LIBImagePullPolicy + - name: LIB_IMAGE_PULL_POLICY value: "Always" From 84b6a2301e9ab3a1124802ac562dd4694c90826e Mon Sep 17 00:00:00 2001 From: Namkyu Park <53862866+namkyu1999@users.noreply.github.com> Date: Thu, 4 Apr 2024 23:10:13 +0900 Subject: [PATCH 09/10] Update faults/load/k6-loadgen/fault.yaml Co-authored-by: Neelanjan Manna Signed-off-by: namkyu1999 --- faults/load/k6-loadgen/fault.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/faults/load/k6-loadgen/fault.yaml b/faults/load/k6-loadgen/fault.yaml index 1867c8f21..ab572bd57 100644 --- a/faults/load/k6-loadgen/fault.yaml +++ b/faults/load/k6-loadgen/fault.yaml @@ -85,7 +85,7 @@ spec: value: "ghcr.io/grafana/k6-operator:latest-runner" # Provide the image pull policy of the helper pod - - name: LIBImagePullPolicy + - name: LIB_IMAGE_PULL_POLICY value: "Always" labels: From 2c748bfc1883966fa5feb5eab1bd5a9bc5696ef2 Mon Sep 17 00:00:00 2001 From: Namkyu Park <53862866+namkyu1999@users.noreply.github.com> Date: Thu, 4 Apr 2024 23:10:23 +0900 Subject: [PATCH 10/10] Update faults/load/k6-loadgen/engine.yaml Co-authored-by: Neelanjan Manna Signed-off-by: namkyu1999 --- faults/load/k6-loadgen/engine.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/faults/load/k6-loadgen/engine.yaml b/faults/load/k6-loadgen/engine.yaml index 72f710edc..b37f6f2fc 100644 --- a/faults/load/k6-loadgen/engine.yaml +++ b/faults/load/k6-loadgen/engine.yaml @@ -6,6 +6,10 @@ metadata: namespace: default spec: engineState: 'active' + appinfo: + appns: '' + applabel: '' + appkind: '' chaosServiceAccount: litmus-admin experiments: - name: k6-loadgen