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

update test and configuration files in order to a config map to configure patchers

parent 0968e10b
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!148Make patcher parameters flexible,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
...@@ -17,12 +17,18 @@ loadTypes: ...@@ -17,12 +17,18 @@ loadTypes:
patchers: patchers:
- type: "EnvVarPatcher" - type: "EnvVarPatcher"
resource: "uc1-load-generator-deployment.yaml" resource: "uc1-load-generator-deployment.yaml"
container: "workload-generator" config:
variableName: "NUM_SENSORS" - key: "variableName"
value: "NUM_SENSORS"
- key: "container"
value: "workload-generator"
- type: "NumSensorsLoadGeneratorReplicaPatcher" - type: "NumSensorsLoadGeneratorReplicaPatcher"
resource: "uc1-load-generator-deployment.yaml" resource: "uc1-load-generator-deployment.yaml"
config:
- key: "loadGenMaxRecords"
value: "15000"
kafkaConfig: kafkaConfig:
bootstrapServer: "localhost:31290" bootstrapServer: "localhost:9092"
topics: topics:
- name: "input" - name: "input"
numPartitions: 40 numPartitions: 40
......
...@@ -5,7 +5,7 @@ load: ...@@ -5,7 +5,7 @@ load:
loadValues: [25000, 50000, 75000, 100000, 125000, 150000] loadValues: [25000, 50000, 75000, 100000, 125000, 150000]
resources: resources:
resourceType: "Instances" resourceType: "Instances"
resourceValues: [1, 2, 3, 4, 5] resourceValues: [7, 1, 2, 3, 4, 5]
slos: slos:
- sloType: "lag trend" - sloType: "lag trend"
threshold: 2000 threshold: 2000
...@@ -20,29 +20,39 @@ execution: ...@@ -20,29 +20,39 @@ execution:
loadGenerationDelay: 30 # in seconds, optional field, default is 0 seconds loadGenerationDelay: 30 # in seconds, optional field, default is 0 seconds
restrictions: restrictions:
- "LowerBound" - "LowerBound"
configOverrides: [] configOverrides:
# - patcher: - patcher:
# type: "NodeSelectorPatcher" type: "NodeSelectorPatcher"
# resource: "uc1-load-generator-deployment.yaml" resource: "uc1-load-generator-deployment.yaml"
# variableName: "env" config:
# value: "prod" - key: "variableName"
# - patcher: value: "env"
# type: "NodeSelectorPatcher" value: "prod"
# resource: "uc1-kstreams-deployment.yaml" - patcher:
# variableName: "env" type: "NodeSelectorPatcher"
# value: "prod" resource: "uc1-kstreams-deployment.yaml"
# - patcher: config:
# type: "ResourceLimitPatcher" - key: "variableName"
# resource: "uc1-kstreams-deployment.yaml" value: "env"
# container: "uc-application" value: "prod"
# variableName: "cpu" - patcher:
# value: "1000m" type: "ResourceLimitPatcher"
# - patcher: resource: "uc1-kstreams-deployment.yaml"
# type: "ResourceLimitPatcher" config:
# resource: "uc1-kstreams-deployment.yaml" - key: "container"
# container: "uc-application" value: "uc-application"
# variableName: "memory" - key: "limitedResource"
# value: "2Gi" value: "cpu"
value: "1000m"
- patcher:
type: "ResourceLimitPatcher"
resource: "uc1-kstreams-deployment.yaml"
config:
- key: "container"
value: "uc-application"
- key: "limitedResource"
value: "memory"
value: "2Gi"
# - patcher: # - patcher:
# type: "SchedulerNamePatcher" # type: "SchedulerNamePatcher"
# resource: "uc1-kstreams-deployment.yaml" # resource: "uc1-kstreams-deployment.yaml"
......
...@@ -21,10 +21,16 @@ spec: ...@@ -21,10 +21,16 @@ spec:
patchers: patchers:
- type: "EnvVarPatcher" - type: "EnvVarPatcher"
resource: "uc1-load-generator-deployment.yaml" resource: "uc1-load-generator-deployment.yaml"
container: "workload-generator" config:
variableName: "NUM_SENSORS" - key: "variableName"
value: "NUM_SENSORS"
- key: "container"
value: "workload-generator"
- type: "NumSensorsLoadGeneratorReplicaPatcher" - type: "NumSensorsLoadGeneratorReplicaPatcher"
resource: "uc1-load-generator-deployment.yaml" resource: "uc1-load-generator-deployment.yaml"
config:
- key: "loadGenMaxRecords"
value: "15000"
kafkaConfig: kafkaConfig:
bootstrapServer: "theodolite-cp-kafka:9092" bootstrapServer: "theodolite-cp-kafka:9092"
topics: topics:
......
...@@ -27,25 +27,33 @@ spec: ...@@ -27,25 +27,33 @@ spec:
configOverrides: [] configOverrides: []
# - patcher: # - patcher:
# type: "NodeSelectorPatcher" # type: "NodeSelectorPatcher"
# resource: "uc1-load-generator-deployment.yaml" # resource: "uc1-load-generator-deployment123.yaml"
# variableName: "env" # variableName: "env"
# value: "prod" # value: "prod"
# - patcher: # - patcher:
# type: "NodeSelectorPatcher" # type: "NodeSelectorPatcher"
# resource: "uc1-kstreams-deployment.yaml" # resource: "uc1-kstreams-deployment.yaml"
# variableName: "env" # config:
# - key: "variableName"
# value: "env"
# value: "prod" # value: "prod"
# - patcher: # - patcher:
# type: "ResourceLimitPatcher" # type: "ResourceLimitPatcher"
# resource: "uc1-kstreams-deployment.yaml" # resource: "uc1-kstreams-deployment.yaml"
# container: "uc-application" # config:
# variableName: "cpu" # - key: "container"
# value: "uc-application"
# - key: "variableName"
# value: "cpu"
# value: "1000m" # value: "1000m"
# - patcher: # - patcher:
# type: "ResourceLimitPatcher" # type: "ResourceLimitPatcher"
# resource: "uc1-kstreams-deployment.yaml" # resource: "uc1-kstreams-deployment.yaml"
# container: "uc-application" # config:
# variableName: "memory" # - key: "container"
# value: "uc-application"
# - key: "variableName"
# value: "memory"
# value: "2Gi" # value: "2Gi"
# - patcher: # - patcher:
# type: "SchedulerNamePatcher" # type: "SchedulerNamePatcher"
......
...@@ -23,9 +23,9 @@ spec: ...@@ -23,9 +23,9 @@ spec:
- type: "EnvVarPatcher" - type: "EnvVarPatcher"
resource: "uc1-load-generator-deployment.yaml" resource: "uc1-load-generator-deployment.yaml"
config: config:
- key: container - key: "container"
value: "workload-generator" value: "workload-generator"
- key: variableName - key: "variableName"
value: "NUM_SENSORS" value: "NUM_SENSORS"
kafkaConfig: kafkaConfig:
bootstrapServer: "localhost:31290" bootstrapServer: "localhost:31290"
......
...@@ -26,11 +26,4 @@ spec: ...@@ -26,11 +26,4 @@ spec:
loadGenerationDelay: 30 # in seconds loadGenerationDelay: 30 # in seconds
restrictions: restrictions:
- "LowerBound" - "LowerBound"
configOverrides: configOverrides: []
- patcher: \ No newline at end of file
type: "NodeSelectorPatcher"
resource: "uc1-kstreams-deployment.yaml"
config:
- key: variableName
value: env
value: "prod"
...@@ -31,27 +31,40 @@ class ResourceLimitPatcherTest { ...@@ -31,27 +31,40 @@ class ResourceLimitPatcherTest {
val k8sResource = loader.loadK8sResource("Deployment", testPath + fileName) as Deployment val k8sResource = loader.loadK8sResource("Deployment", testPath + fileName) as Deployment
val defCPU = PatcherDefinition() val defCPU = PatcherDefinition()
defCPU.variableName = "cpu"
defCPU.resource = "cpu-memory-deployment.yaml" defCPU.resource = "cpu-memory-deployment.yaml"
defCPU.container = "uc-application"
defCPU.type = "ResourceLimitPatcher" defCPU.type = "ResourceLimitPatcher"
defCPU.config =mutableListOf(
hashMapOf(
"key" to "limitedResource",
"value" to "cpu"),
hashMapOf(
"key" to "container",
"value" to "uc-application"
))
val defMEM = PatcherDefinition() val defMEM = PatcherDefinition()
defMEM.variableName = "memory"
defMEM.resource = "cpu-memory-deployment.yaml" defMEM.resource = "cpu-memory-deployment.yaml"
defMEM.container = "uc-application"
defMEM.type = "ResourceLimitPatcher" defMEM.type = "ResourceLimitPatcher"
defMEM.config =mutableListOf(
hashMapOf(
"key" to "limitedResource",
"value" to "memory"),
hashMapOf(
"key" to "container",
"value" to "uc-application"
))
patcherFactory.createPatcher( patcherFactory.createPatcher(
patcherDefinition = defCPU, patcherDefinition = defCPU,
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource)) k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = cpuValue) ).patch(value = cpuValue)
patcherFactory.createPatcher( patcherFactory.createPatcher(
patcherDefinition = defMEM, patcherDefinition = defMEM,
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource)) k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = memValue) ).patch(value = memValue)
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.container } k8sResource.spec.template.spec.containers.filter { it.name == defCPU.getValueByKey("container") }
.forEach { .forEach {
assertTrue(it.resources.limits["cpu"].toString() == cpuValue) assertTrue(it.resources.limits["cpu"].toString() == cpuValue)
assertTrue(it.resources.limits["memory"].toString() == memValue) assertTrue(it.resources.limits["memory"].toString() == memValue)
......
...@@ -31,16 +31,32 @@ class ResourceRequestPatcherTest { ...@@ -31,16 +31,32 @@ class ResourceRequestPatcherTest {
val k8sResource = loader.loadK8sResource("Deployment", testPath + fileName) as Deployment val k8sResource = loader.loadK8sResource("Deployment", testPath + fileName) as Deployment
val defCPU = PatcherDefinition() val defCPU = PatcherDefinition()
defCPU.variableName = "cpu"
defCPU.resource = "cpu-memory-deployment.yaml" defCPU.resource = "cpu-memory-deployment.yaml"
defCPU.container = "uc-application"
defCPU.type = "ResourceRequestPatcher" defCPU.type = "ResourceRequestPatcher"
defCPU.config = mutableListOf(
hashMapOf(
"key" to "requestedResource",
"value" to "cpu"
),
hashMapOf(
"key" to "container",
"value" to "uc-application"
)
)
val defMEM = PatcherDefinition() val defMEM = PatcherDefinition()
defMEM.variableName = "memory"
defMEM.resource = "cpu-memory-deployment.yaml" defMEM.resource = "cpu-memory-deployment.yaml"
defMEM.container = "uc-application"
defMEM.type = "ResourceRequestPatcher" defMEM.type = "ResourceRequestPatcher"
defMEM.config = mutableListOf(
hashMapOf(
"key" to "requestedResource",
"value" to "memory"
),
hashMapOf(
"key" to "container",
"value" to "uc-application"
)
)
patcherFactory.createPatcher( patcherFactory.createPatcher(
patcherDefinition = defCPU, patcherDefinition = defCPU,
...@@ -51,7 +67,7 @@ class ResourceRequestPatcherTest { ...@@ -51,7 +67,7 @@ class ResourceRequestPatcherTest {
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource)) k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = memValue) ).patch(value = memValue)
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.container } k8sResource.spec.template.spec.containers.filter { it.name == defCPU.getValueByKey("container") }
.forEach { .forEach {
assertTrue(it.resources.requests["cpu"].toString() == cpuValue) assertTrue(it.resources.requests["cpu"].toString() == cpuValue)
assertTrue(it.resources.requests["memory"].toString() == memValue) assertTrue(it.resources.requests["memory"].toString() == memValue)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment