Skip to content
Snippets Groups Projects
Commit e71cc3e5 authored by Sören Henning's avatar Sören Henning
Browse files

Merge branch 'make-patcher-params-flexibal' into 'theodolite-kotlin'

Make patcher parameters flexible

See merge request !148
parents 2cbbeea0 8d1954db
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
Pipeline #3657 passed
......@@ -54,12 +54,11 @@ spec:
resource:
type: string
default: ""
container:
type: string
default: ""
variableName:
type: string
default: ""
properties:
type: object
additionalProperties: true
x-kubernetes-map-type: "granular"
default: {}
loadTypes:
type: array
minItems: 1
......@@ -80,12 +79,11 @@ spec:
resource:
type: string
default: ""
container:
type: string
default: ""
variableName:
type: string
default: ""
properties:
type: object
additionalProperties: true
x-kubernetes-map-type: "granular"
default: {}
kafkaConfig:
type: object
properties:
......
......@@ -22,8 +22,13 @@ spec:
patchers:
- type: "EnvVarPatcher"
resource: "uc1-load-generator-deployment.yaml"
container: "workload-generator"
variableName: "NUM_SENSORS"
properties:
container: "workload-generator"
variableName: "NUM_SENSORS"
- type: "NumSensorsLoadGeneratorReplicaPatcher"
resource: "uc1-load-generator-deployment.yaml"
properties:
loadGenMaxRecords: "15000"
kafkaConfig:
bootstrapServer: "localhost:31290"
topics:
......
......@@ -26,16 +26,4 @@ spec:
loadGenerationDelay: 30 # in seconds
restrictions:
- "LowerBound"
configOverrides:
- patcher:
type: "NodeSelectorPatcher"
resource: "uc1-load-generator-deployment.yaml"
container: ""
variableName: "env"
value: "prod"
- patcher:
type: "NodeSelectorPatcher"
resource: "uc1-kstreams-deployment.yaml"
container: ""
variableName: "env"
value: "prod"
configOverrides: []
\ No newline at end of file
......@@ -95,12 +95,11 @@ spec:
resource:
type: string
default: ""
container:
type: string
default: ""
variableName:
type: string
default: ""
properties:
type: object
additionalProperties: true
x-kubernetes-map-type: "granular"
default: {}
value:
type: string
status:
......
......@@ -31,27 +31,32 @@ class ResourceLimitPatcherTest {
val k8sResource = loader.loadK8sResource("Deployment", testPath + fileName) as Deployment
val defCPU = PatcherDefinition()
defCPU.variableName = "cpu"
defCPU.resource = "cpu-memory-deployment.yaml"
defCPU.container = "uc-application"
defCPU.type = "ResourceLimitPatcher"
defCPU.properties = mutableMapOf(
"limitedResource" to "cpu",
"container" to "application"
)
val defMEM = PatcherDefinition()
defMEM.variableName = "memory"
defMEM.resource = "cpu-memory-deployment.yaml"
defMEM.container = "uc-application"
defMEM.type = "ResourceLimitPatcher"
defMEM.properties = mutableMapOf(
"limitedResource" to "memory",
"container" to "uc-application"
)
patcherFactory.createPatcher(
patcherDefinition = defCPU,
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = cpuValue)
patcherFactory.createPatcher(
patcherDefinition = defMEM,
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = memValue)
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.container }
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.properties["container"] !! }
.forEach {
assertTrue(it.resources.limits["cpu"].toString() == cpuValue)
assertTrue(it.resources.limits["memory"].toString() == memValue)
......
......@@ -31,16 +31,20 @@ class ResourceRequestPatcherTest {
val k8sResource = loader.loadK8sResource("Deployment", testPath + fileName) as Deployment
val defCPU = PatcherDefinition()
defCPU.variableName = "cpu"
defCPU.resource = "cpu-memory-deployment.yaml"
defCPU.container = "uc-application"
defCPU.type = "ResourceRequestPatcher"
defCPU.properties = mutableMapOf(
"requestedResource" to "cpu",
"container" to "application"
)
val defMEM = PatcherDefinition()
defMEM.variableName = "memory"
defMEM.resource = "cpu-memory-deployment.yaml"
defMEM.container = "uc-application"
defMEM.type = "ResourceRequestPatcher"
defMEM.properties = mutableMapOf(
"requestedResource" to "memory",
"container" to "application"
)
patcherFactory.createPatcher(
patcherDefinition = defCPU,
......@@ -51,7 +55,7 @@ class ResourceRequestPatcherTest {
k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource))
).patch(value = memValue)
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.container }
k8sResource.spec.template.spec.containers.filter { it.name == defCPU.properties["container"] !! }
.forEach {
assertTrue(it.resources.requests["cpu"].toString() == cpuValue)
assertTrue(it.resources.requests["memory"].toString() == memValue)
......
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