From 8d1954db5a4159eefeb65ed87d72ee81d58348df Mon Sep 17 00:00:00 2001 From: "stu126940@mail.uni-kiel.de" <stu126940@mail.uni-kiel.de> Date: Thu, 17 Jun 2021 11:50:45 +0200 Subject: [PATCH] rename config to properties --- theodolite-quarkus/config/README.md | 20 ++++++++--------- .../example-benchmark-yaml-resource.yaml | 4 ++-- .../example-execution-yaml-resource.yaml | 8 +++---- .../config/example-operator-benchmark.yaml | 4 ++-- .../config/example-operator-execution.yaml | 8 +++---- .../operator/TheodoliteController.kt | 2 +- .../theodolite/patcher/PatcherFactory.kt | 22 +++++++++---------- .../theodolite/util/PatcherDefinition.kt | 2 +- .../main/resources/operator/benchmarkCRD.yaml | 10 ++++----- .../example-benchmark-k8s-resource.yaml | 4 ++-- .../main/resources/operator/executionCRD.yaml | 5 ++--- .../theodolite/ResourceLimitPatcherTest.kt | 6 ++--- .../theodolite/ResourceRequestPatcherTest.kt | 6 ++--- 13 files changed, 49 insertions(+), 52 deletions(-) diff --git a/theodolite-quarkus/config/README.md b/theodolite-quarkus/config/README.md index 024b6888d..23337d773 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 ec788031c..623df7112 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 0f1e0fc03..e46a6cf41 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 fcde4a510..8f9af3e95 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 168522430..9b2a1facb 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 90b136265..3053c364e 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 be9a04245..45e50113c 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 62625b6da..6ec0cce36 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 56dec9bb7..b76821f6e 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 0118fcd84..7a728d97c 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 bf2eb1279..b984f3ebe 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 1e947ed81..4ae9ce23b 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 1c3f37ac3..6f2329618 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) -- GitLab