Skip to content
Snippets Groups Projects
Commit 72edf7c9 authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

remove actions from examples and add them to the docs, small fixes

parent 40bc978d
No related branches found
No related tags found
1 merge request!201Introduce action commands
Pipeline #5824 passed
## Infrastructure
The necessary infrastructure for an execution can be defined in the benchmark manifests. The related resources are create *before* an execution is started, and removed *after* an execution is finished.
### Example
```yaml
infrastructure:
resources:
- configMap:
name: "example-configmap"
files:
- "uc1-kstreams-deployment.yaml"
```
## Action Commands
Theodolite allows to execute commands on running pods (similar to the `kubectl exec -it <pod-name> -- <command>` command). This commands can be run either before (via so called `beforeActions`) or after (via so called `afterActions`) an experiment is executed.
### Example
```yaml
# For the system under test
sut:
resources: ...
beforeActions:
- selector:
pod:
matchLabels:
app: busybox1
exec:
command: ["touch", "test-file-sut"]
timeoutSeconds: 90
afterActions:
- selector:
pod:
matchLabels:
app: busybox1
exec:
command: [ "touch", "test-file-sut-after" ]
timeoutSeconds: 90
# analog, for the load generator
loadGenerator:
resources: ...
beforeActions:
- selector:
pod:
matchLabels:
app: busybox1
exec:
command: ["touch", "test-file-loadGen"]
timeoutSeconds: 90
afterActions:
- selector:
pod:
matchLabels:
app: busybox1
exec:
command: [ "touch", "test-file-loadGen-after" ]
timeoutSeconds: 90
```
\ No newline at end of file
...@@ -3,26 +3,12 @@ kind: benchmark ...@@ -3,26 +3,12 @@ kind: benchmark
metadata: metadata:
name: uc1-kstreams name: uc1-kstreams
spec: spec:
infrastructure:
resources:
- configMap:
name: "example-configmap"
files:
- "uc1-kstreams-deployment.yaml"
sut: sut:
resources: resources:
- configMap: - configMap:
name: "example-configmap" name: "example-configmap"
files: files:
- "uc1-kstreams-deployment.yaml" - "uc1-kstreams-deployment.yaml"
beforeActions:
- selector:
pod:
matchLabels:
app: busybox1
exec:
command: ["touch", "test-folder"]
timeoutSeconds: 90
loadGenerator: loadGenerator:
resources: resources:
- configMap: - configMap:
...@@ -30,7 +16,6 @@ spec: ...@@ -30,7 +16,6 @@ spec:
files: files:
- uc1-load-generator-service.yaml - uc1-load-generator-service.yaml
- uc1-load-generator-deployment.yaml - uc1-load-generator-deployment.yaml
beforeActions: []
resourceTypes: resourceTypes:
- typeName: "Instances" - typeName: "Instances"
patchers: patchers:
......
...@@ -47,8 +47,6 @@ class KubernetesBenchmarkDeployment( ...@@ -47,8 +47,6 @@ class KubernetesBenchmarkDeployment(
*/ */
override fun setup() { override fun setup() {
sutBeforeActions.forEach { it.exec(client = client) } sutBeforeActions.forEach { it.exec(client = client) }
loadGenBeforeActions.forEach { it.exec(client = client) }
val kafkaTopics = this.topics.filter { !it.removeOnly } val kafkaTopics = this.topics.filter { !it.removeOnly }
.map { NewTopic(it.name, it.numPartitions, it.replicationFactor) } .map { NewTopic(it.name, it.numPartitions, it.replicationFactor) }
kafkaController.createTopics(kafkaTopics) kafkaController.createTopics(kafkaTopics)
...@@ -56,6 +54,8 @@ class KubernetesBenchmarkDeployment( ...@@ -56,6 +54,8 @@ class KubernetesBenchmarkDeployment(
logger.info { "Wait ${this.loadGenerationDelay} seconds before starting the load generator." } logger.info { "Wait ${this.loadGenerationDelay} seconds before starting the load generator." }
Thread.sleep(Duration.ofSeconds(this.loadGenerationDelay).toMillis()) Thread.sleep(Duration.ofSeconds(this.loadGenerationDelay).toMillis())
loadGenResources.forEach { kubernetesManager.deploy(it) } loadGenResources.forEach { kubernetesManager.deploy(it) }
loadGenBeforeActions.forEach { it.exec(client = client) }
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment