97 lines
3.0 KiB
YAML
97 lines
3.0 KiB
YAML
---
|
|
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
|
|
---
|