diff --git a/theodolite-quarkus/config/README.md b/theodolite-quarkus/config/README.md index 024b6888deb56b1c9176ee40aa503f4b496616b7..23337d77375ebba8f624e7a11f714502fe3d5e67 100644 --- a/theodolite-quarkus/config/README.md +++ b/theodolite-quarkus/config/README.md @@ -19,7 +19,7 @@ resourceTypes: patchers: - type: String resources: String - config: + properties: <Patcher Arguments> ... ... loadTypes: @@ -27,7 +27,7 @@ loadTypes: patchers: - type: String resources: String - config: + properties: <Patcher Arguments> ... ... kafkaConfig: @@ -51,7 +51,7 @@ The properties have the following definitions: * **patchers**: List of [patchers](#Patchers) used to scale this resource type. Each patcher has the following structure: * **type**: Type of the [patcher](#Patchers). The concrete types can be looked up in the list of [patchers](#Patchers). * **resources**: Specifies the Kubernetes resource to be patched. - * **config**: *Patcher Arguments*: (Optional) Patcher specific additional arguments. + * **properties**: *Patcher Arguments*: (Optional) Patcher specific additional arguments. * **loadTypes**: A list of load types that can be scaled for this *benchmark*. For each load type the concrete values are defined in the *execution* object. Each load type has the following structure: * **typeName**: Name of the load type. * **patchers**: List of patchers used to scale * **resourceTypes**: A list of resource types that can be scaled for this *benchmark*. For each resource type the concrete values are defined in the *execution* resource object.Each resource type has the following structure: @@ -59,7 +59,7 @@ The properties have the following definitions: * **patchers**: List of patchers used to scale this resource type. Each patcher has the following structure: * **type**: Type of the Patcher. The concrete types can be looked up in the list of patchers. * **resources**: Specifies the Kubernetes resource to be patched. - * **config**: *Patcher Arguments*: (Optional) Patcher specific additional arguments as Map<String, String>. + * **properties**: *Patcher Arguments*: (Optional) Patcher specific additional arguments as Map<String, String>. * **kafkaConfig**: Contains the Kafka configuration. * **bootstrapServers**: The bootstrap servers connection string. * **topics**: List of topics to be created for each [experiment](#Experiment). Alternative theodolite offers the possibility to remove certain topics after each experiment. @@ -107,7 +107,7 @@ configurationOverrides: - patcher: type: String resource: String - config: + properties: <Patcher Arguments> ... ... ``` @@ -139,7 +139,7 @@ The properties have the following definitions: * **patcher**: Patcher used to patch a resource. Each patcher has the following structure: * **type**: Type of the Patcher. The concrete types can be looked up in the list of patchers. * **resources**: Specifies the Kubernetes resource to be patched. - * **config**: *Patcher Arguments*: (Optional) Patcher specific additional arguments. + * **properties**: *Patcher Arguments*: (Optional) Patcher specific additional arguments. ## Patchers @@ -162,20 +162,20 @@ The properties have the following definitions: * **EnvVarPatcher**: Allows to modify the value of an environment variable for a container in a kubernetes deployment. * **type**: "EnvVarPatcher" * **resource**: "uc1-load-generator-deployment.yaml" - * **config**: + * **properties**: * container: "workload-generator" * variableName: "NUM_SENSORS" * **NodeSelectorPatcher**: Changes the node selection field in kubernetes resources. * **type**: "NodeSelectorPatcher" * **resource**: "uc1-load-generator-deployment.yaml" - * **config**: + * **properties**: * variableName: "env" * **value**: "prod" * **ResourceLimitPatcher**: Changes the resource limit for a kubernetes resource. * **resource**: "uc1-kstreams-deployment.yaml" - * **config**: + * **properties**: * container: "uc-application" * variableName: "cpu" or "memory" * **value**:"1000m" or "2Gi" @@ -188,7 +188,7 @@ The properties have the following definitions: * **ImagePatcher**: Changes the image of a kubernetes resource. Currently not fully implemented. * **type**: "ImagePatcher" * **resource**: "uc1-kstreams-deployment.yaml" - * **config**: + * **properties**: * container: "uc-application" * **value**: "dockerhubrepo/imagename" diff --git a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml index ec788031cc0dc58cf8bc7f6d6373e5b4680756b1..623df71121b11b670584a83e153b4dd2962525e7 100644 --- a/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml +++ b/theodolite-quarkus/config/example-benchmark-yaml-resource.yaml @@ -17,12 +17,12 @@ loadTypes: patchers: - type: "EnvVarPatcher" resource: "uc1-load-generator-deployment.yaml" - config: + properties: variableName: "NUM_SENSORS" container: "workload-generator" - type: "NumSensorsLoadGeneratorReplicaPatcher" resource: "uc1-load-generator-deployment.yaml" - config: + properties: loadGenMaxRecords: "15000" kafkaConfig: bootstrapServer: "localhost:31290" diff --git a/theodolite-quarkus/config/example-execution-yaml-resource.yaml b/theodolite-quarkus/config/example-execution-yaml-resource.yaml index 0f1e0fc030e66aa05573a441d5c51406854eb3e4..e46a6cf417442b851650fe9699f73e1367dcc794 100644 --- a/theodolite-quarkus/config/example-execution-yaml-resource.yaml +++ b/theodolite-quarkus/config/example-execution-yaml-resource.yaml @@ -24,26 +24,26 @@ configOverrides: - patcher: type: "NodeSelectorPatcher" resource: "uc1-load-generator-deployment.yaml" - config: + properties: variableName: "env" value: "prod" - patcher: type: "NodeSelectorPatcher" resource: "uc1-kstreams-deployment.yaml" - config: + properties: variableName: "env" value: "prod" - patcher: type: "ResourceLimitPatcher" resource: "uc1-kstreams-deployment.yaml" - config: + properties: container: "uc-application" limitedResource: "cpu" value: "1000m" - patcher: type: "ResourceLimitPatcher" resource: "uc1-kstreams-deployment.yaml" - config: + properties: container: "uc-application" limitedResource: "memory" value: "2Gi" diff --git a/theodolite-quarkus/config/example-operator-benchmark.yaml b/theodolite-quarkus/config/example-operator-benchmark.yaml index fcde4a510a4c67a953844f266872071a7d79056a..8f9af3e955fe18de26326b0094578a71517a5aef 100644 --- a/theodolite-quarkus/config/example-operator-benchmark.yaml +++ b/theodolite-quarkus/config/example-operator-benchmark.yaml @@ -21,12 +21,12 @@ spec: patchers: - type: "EnvVarPatcher" resource: "uc1-load-generator-deployment.yaml" - config: + properties: variableName: "NUM_SENSORS" container: "workload-generator" - type: "NumSensorsLoadGeneratorReplicaPatcher" resource: "uc1-load-generator-deployment.yaml" - config: + properties: loadGenMaxRecords: "15000" kafkaConfig: bootstrapServer: "theodolite-cp-kafka:9092" diff --git a/theodolite-quarkus/config/example-operator-execution.yaml b/theodolite-quarkus/config/example-operator-execution.yaml index 168522430478e48bbf4855f186e9ccb80a22b80f..9b2a1facbd8be3411407dfcf3cad39fd9f3de6b6 100644 --- a/theodolite-quarkus/config/example-operator-execution.yaml +++ b/theodolite-quarkus/config/example-operator-execution.yaml @@ -28,26 +28,26 @@ spec: # - patcher: # type: "NodeSelectorPatcher" # resource: "uc1-load-generator-deployment.yaml" - # config: + # properties: # variableName: "env" # value: "prod" # - patcher: # type: "NodeSelectorPatcher" # resource: "uc1-kstreams-deployment.yaml" - # config: + # properties: # variableName: "env" # value: "prod" # - patcher: # type: "ResourceLimitPatcher" # resource: "uc1-kstreams-deployment.yaml" - # config: + # properties: # container: "uc-application" # limitedResource: "cpu" # value: "1000m" # - patcher: # type: "ResourceLimitPatcher" # resource: "uc1-kstreams-deployment.yaml" - # config: + # properties: # container: "uc-application" # limitedResource: "memory" # value: "2Gi" diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt index 90b1362659b54eaa0452fdc364e4fcb408a9151f..3053c364e2d6d9bc9797c190f0a87d861089b556 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/operator/TheodoliteController.kt @@ -183,7 +183,7 @@ class TheodoliteController( val configurationOverride = ConfigurationOverride() configurationOverride.patcher = PatcherDefinition() configurationOverride.patcher.type = "LabelPatcher" - configurationOverride.patcher.config = mutableMapOf("variableName" to labelName) + configurationOverride.patcher.properties = mutableMapOf("variableName" to labelName) configurationOverride.patcher.resource = it configurationOverride.value = labelValue additionalConfigOverrides.add(configurationOverride) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/PatcherFactory.kt b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/PatcherFactory.kt index be9a0424560daf5762d0f174a45b4f03c5f3f314..45e50113c964d671962fadc718994a29b2da81f4 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/patcher/PatcherFactory.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/patcher/PatcherFactory.kt @@ -41,38 +41,38 @@ class PatcherFactory { ) "NumNestedGroupsLoadGeneratorReplicaPatcher" -> NumNestedGroupsLoadGeneratorReplicaPatcher( k8sResource = resource, - loadGenMaxRecords = patcherDefinition.config["loadGenMaxRecords"] !!, - numSensors = patcherDefinition.config["numSensors"] !! + loadGenMaxRecords = patcherDefinition.properties["loadGenMaxRecords"] !!, + numSensors = patcherDefinition.properties["numSensors"] !! ) "NumSensorsLoadGeneratorReplicaPatcher" -> NumSensorsLoadGeneratorReplicaPatcher( k8sResource = resource, - loadGenMaxRecords = patcherDefinition.config["loadGenMaxRecords"] !! + loadGenMaxRecords = patcherDefinition.properties["loadGenMaxRecords"] !! ) "EnvVarPatcher" -> EnvVarPatcher( k8sResource = resource, - container = patcherDefinition.config["container"] !!, - variableName = patcherDefinition.config["variableName"] !! + container = patcherDefinition.properties["container"] !!, + variableName = patcherDefinition.properties["variableName"] !! ) "NodeSelectorPatcher" -> NodeSelectorPatcher( k8sResource = resource, - variableName = patcherDefinition.config["variableName"] !! + variableName = patcherDefinition.properties["variableName"] !! ) "ResourceLimitPatcher" -> ResourceLimitPatcher( k8sResource = resource, - container = patcherDefinition.config["container"] !!, - limitedResource = patcherDefinition.config["limitedResource"] !! + container = patcherDefinition.properties["container"] !!, + limitedResource = patcherDefinition.properties["limitedResource"] !! ) "ResourceRequestPatcher" -> ResourceRequestPatcher( k8sResource = resource, - container = patcherDefinition.config["container"] !!, - requestedResource = patcherDefinition.config["requestedResource"] !! + container = patcherDefinition.properties["container"] !!, + requestedResource = patcherDefinition.properties["requestedResource"] !! ) "SchedulerNamePatcher" -> SchedulerNamePatcher( k8sResource = resource ) "LabelPatcher" -> LabelPatcher( k8sResource = resource, - variableName = patcherDefinition.config["variableName"] !! + variableName = patcherDefinition.properties["variableName"] !! ) else -> throw InvalidPatcherConfigurationException("Patcher type ${patcherDefinition.type} not found.") } diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt index 62625b6dad5e09be216c6841100346eeb61371cd..6ec0cce36751ec0343d40aa49fefa44f4c7fc918 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt @@ -21,5 +21,5 @@ class PatcherDefinition { lateinit var resource: String @JsonSerialize - lateinit var config: MutableMap<String, String> + lateinit var properties: MutableMap<String, String> } diff --git a/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml b/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml index 56dec9bb76b0713bd5b0688014093ff54958abcb..b76821f6e7cca5408f604ba9bbf83cf1b43a37de 100644 --- a/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml +++ b/theodolite-quarkus/src/main/resources/operator/benchmarkCRD.yaml @@ -54,12 +54,11 @@ spec: resource: type: string default: "" - config: + properties: type: object additionalProperties: true x-kubernetes-map-type: "granular" - default: - "": "" + default: {} loadTypes: type: array minItems: 1 @@ -80,12 +79,11 @@ spec: resource: type: string default: "" - config: + properties: type: object additionalProperties: true x-kubernetes-map-type: "granular" - default: - "": "" + default: {} kafkaConfig: type: object properties: 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 0118fcd841bdc8f30e6de5a1b611094714bff54b..7a728d97c52a84d81bcc44fd9f20c56e6b574527 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 @@ -22,12 +22,12 @@ spec: patchers: - type: "EnvVarPatcher" resource: "uc1-load-generator-deployment.yaml" - config: + properties: container: "workload-generator" variableName: "NUM_SENSORS" - type: "NumSensorsLoadGeneratorReplicaPatcher" resource: "uc1-load-generator-deployment.yaml" - config: + properties: loadGenMaxRecords: "15000" kafkaConfig: bootstrapServer: "localhost:31290" diff --git a/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml b/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml index bf2eb127995758d4ac15c34a57c8d59c9a1abbe3..b984f3ebe5ca7c8868adb9d3593e5d87d73fc2bd 100644 --- a/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml +++ b/theodolite-quarkus/src/main/resources/operator/executionCRD.yaml @@ -95,12 +95,11 @@ spec: resource: type: string default: "" - config: + properties: type: object additionalProperties: true x-kubernetes-map-type: "granular" - default: - "": "" + default: {} value: type: string status: diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt index 1e947ed81c2356036d94902da4cd5b7c81154551..4ae9ce23b31204b366dce7bcf000e4114d7f3f8f 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceLimitPatcherTest.kt @@ -33,7 +33,7 @@ class ResourceLimitPatcherTest { val defCPU = PatcherDefinition() defCPU.resource = "cpu-memory-deployment.yaml" defCPU.type = "ResourceLimitPatcher" - defCPU.config = mutableMapOf( + defCPU.properties = mutableMapOf( "limitedResource" to "cpu", "container" to "application" ) @@ -41,7 +41,7 @@ class ResourceLimitPatcherTest { val defMEM = PatcherDefinition() defMEM.resource = "cpu-memory-deployment.yaml" defMEM.type = "ResourceLimitPatcher" - defMEM.config = mutableMapOf( + defMEM.properties = mutableMapOf( "limitedResource" to "memory", "container" to "uc-application" ) @@ -56,7 +56,7 @@ class ResourceLimitPatcherTest { k8sResources = listOf(Pair("cpu-memory-deployment.yaml", k8sResource)) ).patch(value = memValue) - k8sResource.spec.template.spec.containers.filter { it.name == defCPU.config["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) diff --git a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt index 1c3f37ac3f5e02e3f5f0b251c46ce17acb2fe5a7..6f232961871c9d11929fc912a483e6e805cc7daf 100644 --- a/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt +++ b/theodolite-quarkus/src/test/kotlin/theodolite/ResourceRequestPatcherTest.kt @@ -33,7 +33,7 @@ class ResourceRequestPatcherTest { val defCPU = PatcherDefinition() defCPU.resource = "cpu-memory-deployment.yaml" defCPU.type = "ResourceRequestPatcher" - defCPU.config = mutableMapOf( + defCPU.properties = mutableMapOf( "requestedResource" to "cpu", "container" to "application" ) @@ -41,7 +41,7 @@ class ResourceRequestPatcherTest { val defMEM = PatcherDefinition() defMEM.resource = "cpu-memory-deployment.yaml" defMEM.type = "ResourceRequestPatcher" - defMEM.config = mutableMapOf( + defMEM.properties = mutableMapOf( "requestedResource" to "memory", "container" to "application" ) @@ -55,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.config["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)