diff --git a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml index cdc2122d9e6b568f1a75b0d55eff8a0af6450983..9c04a94c5084d5b3b0bfb030b204041ae5f957a6 100644 --- a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml +++ b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml @@ -17,12 +17,18 @@ loadTypes: patchers: - type: "EnvVarPatcher" resource: "uc1-load-generator-deployment.yaml" - container: "workload-generator" - variableName: "NUM_SENSORS" + config: + - key: "variableName" + value: "NUM_SENSORS" + - key: "container" + value: "workload-generator" - type: "NumSensorsLoadGeneratorReplicaPatcher" resource: "uc1-load-generator-deployment.yaml" + config: + - key: "loadGenMaxRecords" + value: "15000" kafkaConfig: - bootstrapServer: "localhost:31290" + bootstrapServer: "localhost:9092" topics: - name: "input" numPartitions: 40 diff --git a/theodolite-quarkus/config/example-execution-yaml-resource.yaml b/theodolite-quarkus/config/example-execution-yaml-resource.yaml index e0b327a022099410fea8028fb5d37fee5672a857..099347641f614113dbeba140d2d481562b692193 100644 --- a/theodolite-quarkus/config/example-execution-yaml-resource.yaml +++ b/theodolite-quarkus/config/example-execution-yaml-resource.yaml @@ -5,7 +5,7 @@ load: loadValues: [25000, 50000, 75000, 100000, 125000, 150000] resources: resourceType: "Instances" - resourceValues: [1, 2, 3, 4, 5] + resourceValues: [7, 1, 2, 3, 4, 5] slos: - sloType: "lag trend" threshold: 2000 @@ -20,29 +20,39 @@ execution: loadGenerationDelay: 30 # in seconds, optional field, default is 0 seconds restrictions: - "LowerBound" -configOverrides: [] -# - patcher: -# type: "NodeSelectorPatcher" -# resource: "uc1-load-generator-deployment.yaml" -# variableName: "env" -# value: "prod" -# - patcher: -# type: "NodeSelectorPatcher" -# resource: "uc1-kstreams-deployment.yaml" -# variableName: "env" -# value: "prod" -# - patcher: -# type: "ResourceLimitPatcher" -# resource: "uc1-kstreams-deployment.yaml" -# container: "uc-application" -# variableName: "cpu" -# value: "1000m" -# - patcher: -# type: "ResourceLimitPatcher" -# resource: "uc1-kstreams-deployment.yaml" -# container: "uc-application" -# variableName: "memory" -# value: "2Gi" +configOverrides: + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-load-generator-deployment.yaml" + config: + - key: "variableName" + value: "env" + value: "prod" + - patcher: + type: "NodeSelectorPatcher" + resource: "uc1-kstreams-deployment.yaml" + config: + - key: "variableName" + value: "env" + value: "prod" + - patcher: + type: "ResourceLimitPatcher" + resource: "uc1-kstreams-deployment.yaml" + config: + - key: "container" + value: "uc-application" + - key: "limitedResource" + 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: # type: "SchedulerNamePatcher" # resource: "uc1-kstreams-deployment.yaml" diff --git a/theodolite-quarkus/config/example-operator-benchmark.yaml b/theodolite-quarkus/config/example-operator-benchmark.yaml index 5cf39492a8d88dc0260db8bf98a966b4ce1bccb7..1e93972d2b7b091cc3fcad49eda8f6098b853e0b 100644 --- a/theodolite-quarkus/config/example-operator-benchmark.yaml +++ b/theodolite-quarkus/config/example-operator-benchmark.yaml @@ -9,7 +9,7 @@ spec: - "jmx-configmap.yaml" - "uc1-service-monitor.yaml" loadGenResource: - - "uc1-load-generator-deployment.yaml" + - "uc1-load-generator-deployment.yaml" - "uc1-load-generator-service.yaml" resourceTypes: - typeName: "Instances" @@ -17,14 +17,20 @@ spec: - type: "ReplicaPatcher" resource: "uc1-kstreams-deployment.yaml" loadTypes: - - typeName: "NumSensors" - patchers: - - type: "EnvVarPatcher" - resource: "uc1-load-generator-deployment.yaml" - container: "workload-generator" - variableName: "NUM_SENSORS" - - type: "NumSensorsLoadGeneratorReplicaPatcher" - resource: "uc1-load-generator-deployment.yaml" + - typeName: "NumSensors" + patchers: + - type: "EnvVarPatcher" + resource: "uc1-load-generator-deployment.yaml" + config: + - key: "variableName" + value: "NUM_SENSORS" + - key: "container" + value: "workload-generator" + - type: "NumSensorsLoadGeneratorReplicaPatcher" + resource: "uc1-load-generator-deployment.yaml" + config: + - key: "loadGenMaxRecords" + value: "15000" kafkaConfig: bootstrapServer: "theodolite-cp-kafka:9092" topics: diff --git a/theodolite-quarkus/config/example-operator-execution.yaml b/theodolite-quarkus/config/example-operator-execution.yaml index e01ea377e0762a56132a709a73fb418e4c914e26..10927fb830145554a6bc36e061347fc848e9e7c5 100644 --- a/theodolite-quarkus/config/example-operator-execution.yaml +++ b/theodolite-quarkus/config/example-operator-execution.yaml @@ -25,29 +25,37 @@ spec: restrictions: - "LowerBound" configOverrides: [] - # - patcher: - # type: "NodeSelectorPatcher" - # resource: "uc1-load-generator-deployment.yaml" - # variableName: "env" - # value: "prod" - # - patcher: - # type: "NodeSelectorPatcher" - # resource: "uc1-kstreams-deployment.yaml" - # variableName: "env" - # value: "prod" - # - patcher: - # type: "ResourceLimitPatcher" - # resource: "uc1-kstreams-deployment.yaml" - # container: "uc-application" - # variableName: "cpu" - # value: "1000m" - # - patcher: - # type: "ResourceLimitPatcher" - # resource: "uc1-kstreams-deployment.yaml" - # container: "uc-application" - # variableName: "memory" - # value: "2Gi" - # - patcher: - # type: "SchedulerNamePatcher" - # resource: "uc1-kstreams-deployment.yaml" - # value: "random-scheduler" +# - patcher: +# type: "NodeSelectorPatcher" +# resource: "uc1-load-generator-deployment123.yaml" +# variableName: "env" +# value: "prod" +# - patcher: +# type: "NodeSelectorPatcher" +# resource: "uc1-kstreams-deployment.yaml" +# config: +# - key: "variableName" +# value: "env" +# value: "prod" +# - patcher: +# type: "ResourceLimitPatcher" +# resource: "uc1-kstreams-deployment.yaml" +# config: +# - key: "container" +# value: "uc-application" +# - key: "variableName" +# value: "cpu" +# value: "1000m" +# - patcher: +# type: "ResourceLimitPatcher" +# resource: "uc1-kstreams-deployment.yaml" +# config: +# - key: "container" +# value: "uc-application" +# - key: "variableName" +# value: "memory" +# value: "2Gi" +# - patcher: +# type: "SchedulerNamePatcher" +# resource: "uc1-kstreams-deployment.yaml" +# value: "random-scheduler" diff --git a/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml b/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml index e0df9e462642f279a35e788e1649fcee03ff8fc4..f6a7dc3335018708492dd2777fe3fc8ac8a8f2e8 100644 --- a/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml +++ b/theodolite-quarkus/src/main/resources/operator/example-benchmark-k8s-resource.yaml @@ -23,9 +23,9 @@ spec: - type: "EnvVarPatcher" resource: "uc1-load-generator-deployment.yaml" config: - - key: container + - key: "container" value: "workload-generator" - - key: variableName + - key: "variableName" value: "NUM_SENSORS" kafkaConfig: bootstrapServer: "localhost:31290" diff --git a/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml b/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml index 5d759666323f350f62d561fa508f2a7efb6e25eb..b81bbcd442834136283dc080f5f6a79bbc1cd415 100644 --- a/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml +++ b/theodolite-quarkus/src/main/resources/operator/example-execution-k8s-resource.yaml @@ -26,11 +26,4 @@ spec: loadGenerationDelay: 30 # in seconds restrictions: - "LowerBound" - configOverrides: - - patcher: - type: "NodeSelectorPatcher" - resource: "uc1-kstreams-deployment.yaml" - config: - - key: variableName - value: env - value: "prod" + configOverrides: [] \ No newline at end of file diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt index 4f4308a35df598dc4932a8ac89a6c07fb967e416..12f7c68965ee3f10efcfe4a887db9344851996b6 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt @@ -31,27 +31,40 @@ 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.config =mutableListOf( + hashMapOf( + "key" to "limitedResource", + "value" to "cpu"), + hashMapOf( + "key" to "container", + "value" to "uc-application" + )) val defMEM = PatcherDefinition() - defMEM.variableName = "memory" defMEM.resource = "cpu-memory-deployment.yaml" - defMEM.container = "uc-application" defMEM.type = "ResourceLimitPatcher" + defMEM.config =mutableListOf( + hashMapOf( + "key" to "limitedResource", + "value" to "memory"), + hashMapOf( + "key" to "container", + "value" 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.getValueByKey("container") } .forEach { assertTrue(it.resources.limits["cpu"].toString() == cpuValue) assertTrue(it.resources.limits["memory"].toString() == memValue) diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt index 7214422705a64f507a196a4b5f9b334665407422..5dc2764d86d543a94eee7966b3870eeedff1f4b3 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt @@ -31,16 +31,32 @@ 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.config = mutableListOf( + hashMapOf( + "key" to "requestedResource", + "value" to "cpu" + ), + hashMapOf( + "key" to "container", + "value" to "uc-application" + ) + ) val defMEM = PatcherDefinition() - defMEM.variableName = "memory" defMEM.resource = "cpu-memory-deployment.yaml" - defMEM.container = "uc-application" defMEM.type = "ResourceRequestPatcher" + defMEM.config = mutableListOf( + hashMapOf( + "key" to "requestedResource", + "value" to "memory" + ), + hashMapOf( + "key" to "container", + "value" to "uc-application" + ) + ) patcherFactory.createPatcher( patcherDefinition = defCPU, @@ -51,7 +67,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.getValueByKey("container") } .forEach { assertTrue(it.resources.requests["cpu"].toString() == cpuValue) assertTrue(it.resources.requests["memory"].toString() == memValue)