diff --git a/CITATION.cff b/CITATION.cff index 04640de442f4458b09e11ce3d2939c850f594556..b6ca4542010b83e12206fbc0d9841683b43e1d57 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ authors: given-names: Wilhelm orcid: "https://orcid.org/0000-0001-6625-4335" title: Theodolite -version: "0.6.3" +version: "0.6.4" repository-code: "https://github.com/cau-se/theodolite" license: "Apache-2.0" doi: "10.1016/j.bdr.2021.100209" diff --git a/codemeta.json b/codemeta.json index 832b570681afb143978698fd47dad5d2835c700b..948a34628ec919e2492b61e3ac9997392dc5e030 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "dateModified": "2022-01-24", "downloadUrl": "https://github.com/cau-se/theodolite/releases", "name": "Theodolite", - "version": "0.6.3", + "version": "0.6.4", "description": "Theodolite is a framework for benchmarking the horizontal and vertical scalability of cloud-native applications.", "developmentStatus": "active", "relatedLink": [ diff --git a/docs/api-reference/patchers.md b/docs/api-reference/patchers.md index 77f937e38f6a0ee4084cb0ad5b5838718eabff10..bea63ccd23decef5654f257221ce0358b4f68e45 100644 --- a/docs/api-reference/patchers.md +++ b/docs/api-reference/patchers.md @@ -53,6 +53,27 @@ Patchers can be seen as functions which take a value as input and modify a Kuber * **resource**: "uc1-kstreams-deployment.yaml" * **example value**: "random-scheduler" +* **LabelPatcher**: Changes the label of a Kubernetes Deployment or StatefulSet. The patched field is: `metadata.labels` + * **type**: "LabelPatcher" + * **resource**: "uc1-kstreams-deployment.yaml" + * **properties**: + * variableName: "app" + * **example value**: "theodolite-sut" + +* **MatchLabelPatcher**: Changes the match labels of a Kubernetes Deployment or StatefulSet. The patched field is: `spec.selector.matchLabels` + * **type**: "MatchLabelPatcher" + * **resource**: "uc1-kstreams-deployment.yaml" + * **properties**: + * variableName: "app" + * **example value**: "theodolite-sut" + +* **TemplateLabelPatcher**: Changes the template labels of a Kubernetes Deployment or StatefulSet. The patched field is: `spec.template.metadata.labels` + * **type**: "MatchLabelPatcher" + * **resource**: "uc1-kstreams-deployment.yaml" + * **properties**: + * variableName: "app" + * **example value**: "theodolite-sut" + * **ImagePatcher**: Changes the image of a Kubernetes resource. **Currently not fully implemented.** * **type**: "ImagePatcher" * **resource**: "uc1-kstreams-deployment.yaml" diff --git a/docs/index.yaml b/docs/index.yaml index 509844ab0bc371d29302f90f69e769cd52a8e11b..3e0de103a78f3529d314727ed59be3dcdc333fc9 100644 --- a/docs/index.yaml +++ b/docs/index.yaml @@ -1,6 +1,41 @@ apiVersion: v1 entries: theodolite: + - apiVersion: v2 + appVersion: 0.6.4 + created: "2022-02-16T16:09:11.967649304+01:00" + dependencies: + - condition: grafana.enabled + name: grafana + repository: https://grafana.github.io/helm-charts + version: 6.17.5 + - condition: kube-prometheus-stack.enabled + name: kube-prometheus-stack + repository: https://prometheus-community.github.io/helm-charts + version: 20.0.1 + - condition: cp-helm-charts.enabled + name: cp-helm-charts + repository: https://soerenhenning.github.io/cp-helm-charts + version: 0.6.0 + - condition: kafka-lag-exporter.enabled + name: kafka-lag-exporter + repository: https://seanglover.com/kafka-lag-exporter/repo + version: 0.6.7 + description: Theodolite is a framework for benchmarking the horizontal and vertical + scalability of cloud-native applications. + digest: 10156d9917233ffa297aab093532038667d25b2babb2b2058a0a32e1dccb0cca + home: https://www.theodolite.rocks + maintainers: + - email: soeren.henning@email.uni-kiel.de + name: Sören Henning + url: https://www.se.informatik.uni-kiel.de/en/team/soeren-henning-m-sc + name: theodolite + sources: + - https://github.com/cau-se/theodolite + type: application + urls: + - https://github.com/cau-se/theodolite/releases/download/v0.6.4/theodolite-0.6.4.tgz + version: 0.6.4 - apiVersion: v2 appVersion: 0.6.3 created: "2022-01-24T13:40:40.07330713+01:00" @@ -141,6 +176,41 @@ entries: urls: - https://github.com/cau-se/theodolite/releases/download/v0.6.0/theodolite-0.6.0.tgz version: 0.6.0 + - apiVersion: v2 + appVersion: 0.5.2 + created: "2022-02-16T15:43:43.534374597+01:00" + dependencies: + - condition: grafana.enabled + name: grafana + repository: https://grafana.github.io/helm-charts + version: 6.17.5 + - condition: kube-prometheus-stack.enabled + name: kube-prometheus-stack + repository: https://prometheus-community.github.io/helm-charts + version: 12.0.0 + - condition: cp-helm-charts.enabled + name: cp-helm-charts + repository: https://soerenhenning.github.io/cp-helm-charts + version: 0.6.0 + - condition: kafka-lag-exporter.enabled + name: kafka-lag-exporter + repository: https://seanglover.com/kafka-lag-exporter/repo + version: 0.6.6 + description: Theodolite is a framework for benchmarking the scalability stream + processing engines. + digest: 72df752883d2161fdfc0e96bb90fe11f9c0ed4f71013e588ec170f2cbb178e9c + home: https://cau-se.github.io/theodolite + maintainers: + - email: soeren.henning@email.uni-kiel.de + name: Sören Henning + url: https://www.se.informatik.uni-kiel.de/en/team/soeren-henning-m-sc + name: theodolite + sources: + - https://github.com/cau-se/theodolite + type: application + urls: + - https://github.com/cau-se/theodolite/releases/download/v0.5.2/theodolite-0.5.2.tgz + version: 0.5.2 - apiVersion: v2 appVersion: 0.5.1 created: "2021-11-12T16:15:01.629937292+01:00" @@ -246,4 +316,4 @@ entries: urls: - https://github.com/cau-se/theodolite/releases/download/v0.4.0/theodolite-0.4.0.tgz version: 0.4.0 -generated: "2022-01-24T13:40:40.036786105+01:00" +generated: "2022-02-16T16:09:11.93111234+01:00" diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 27451ad55ce75592db9dc7550b1f81dced3951bc..52fda2bbc83c722d70f6179c4ec53fb3775bd436 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -26,7 +26,7 @@ dependencies: condition: cp-helm-charts.enabled - name: kafka-lag-exporter version: 0.6.7 - repository: https://lightbend.github.io/kafka-lag-exporter/repo/ + repository: https://seanglover.com/kafka-lag-exporter/repo condition: kafka-lag-exporter.enabled version: 0.7.0-SNAPSHOT diff --git a/theodolite-benchmarks/docker-test/uc1-beam-flink/test.sh b/theodolite-benchmarks/docker-test/uc1-beam-flink/test.sh index ebbecd1c5336c5dd907db11b8c8c45924e5924a8..7c7f11a94f42d56d91d383f27d58ad9a09a918e5 100755 --- a/theodolite-benchmarks/docker-test/uc1-beam-flink/test.sh +++ b/theodolite-benchmarks/docker-test/uc1-beam-flink/test.sh @@ -2,7 +2,7 @@ sleep 55s # to let the benchmark and produce some output docker-compose logs --tail 100 benchmark-taskmanager | - sed -n "s/^.*Key:\s\(\S*\), Value:\s\(\S*\).*$/\2/p" | + sed -n "s/^.*Record:\s\(\S*\)$/\1/p" | tee /dev/stderr | jq .identifier | sort | diff --git a/theodolite-benchmarks/docker-test/uc1-beam-samza/test.sh b/theodolite-benchmarks/docker-test/uc1-beam-samza/test.sh index ed17db3a44d5c4a8dacfbc956c2f36dd47503508..62327e860cb658741d0892052f5202df3f5b431e 100755 --- a/theodolite-benchmarks/docker-test/uc1-beam-samza/test.sh +++ b/theodolite-benchmarks/docker-test/uc1-beam-samza/test.sh @@ -2,7 +2,7 @@ sleep 55s # to let the benchmark and produce some output docker-compose logs --tail 100 benchmark | - sed -n "s/^.*Key:\s\(\S*\), Value:\s\(\S*\).*$/\2/p" | + sed -n "s/^.*Record:\s\(\S*\)$/\1/p" | tee /dev/stderr | jq .identifier | sort | diff --git a/theodolite-benchmarks/uc1-commons/build.gradle b/theodolite-benchmarks/uc1-commons/build.gradle index cd95e28ed53cc8e33a416564e613574faf1fc6cb..0f7d31d1f557ecd214b3a57227851d0f70b61084 100644 --- a/theodolite-benchmarks/uc1-commons/build.gradle +++ b/theodolite-benchmarks/uc1-commons/build.gradle @@ -13,8 +13,10 @@ repositories { } dependencies { - implementation('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } - implementation('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } + // Make this implementation once this is a local subproject. + // Currently, Flink needs its own version of these dependencies. + compileOnly('org.industrial-devops:titan-ccp-common:0.1.0-SNAPSHOT') { changing = true } + compileOnly('org.industrial-devops:titan-ccp-common-kafka:0.1.0-SNAPSHOT') { changing = true } implementation 'com.google.code.gson:gson:2.8.9' diff --git a/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/AbstractK8sLoader.kt b/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/AbstractK8sLoader.kt index 871b8cf43907fcb8b0b5ea501c6b47f82e56ff69..36cfef9ce912886a638c200b502923dfe03ef5d0 100644 --- a/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/AbstractK8sLoader.kt +++ b/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/AbstractK8sLoader.kt @@ -13,6 +13,7 @@ abstract class AbstractK8sLoader: K8sResourceLoader { "Deployment" -> loadDeployment(resourceString) "Service" -> loadService(resourceString) "ServiceMonitor" -> loadServiceMonitor(resourceString) + "PodMonitor" -> loadPodMonitor(resourceString) "ConfigMap" -> loadConfigmap(resourceString) "StatefulSet" -> loadStatefulSet(resourceString) "Execution" -> loadExecution(resourceString) @@ -51,6 +52,16 @@ abstract class AbstractK8sLoader: K8sResourceLoader { return loadCustomResourceWrapper(resource, context) } + override fun loadPodMonitor(resource: String): KubernetesResource { + val context = K8sContextFactory().create( + api = "v1", + scope = "Namespaced", + group = "monitoring.coreos.com", + plural = "podmonitors" + ) + return loadCustomResourceWrapper(resource, context) + } + override fun loadExecution(resource: String): KubernetesResource { val context = K8sContextFactory().create( api = "v1", diff --git a/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/K8sResourceLoader.kt b/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/K8sResourceLoader.kt index c123ab2958132cb43ad188136f738b561e91310b..1487b64bf4f7fbcc735539a429be9237d41205bc 100644 --- a/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/K8sResourceLoader.kt +++ b/theodolite/src/main/kotlin/theodolite/k8s/resourceLoader/K8sResourceLoader.kt @@ -11,5 +11,6 @@ interface K8sResourceLoader { fun loadBenchmark(resource: String): KubernetesResource fun loadConfigmap(resource: String): KubernetesResource fun loadServiceMonitor(resource: String): KubernetesResource + fun loadPodMonitor(resource: String): KubernetesResource fun loadCustomResourceWrapper(resource: String, context: CustomResourceDefinitionContext): KubernetesResource } \ No newline at end of file diff --git a/theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt b/theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt new file mode 100644 index 0000000000000000000000000000000000000000..30ff73b5da3b551119ad085adbc982180e4fc066 --- /dev/null +++ b/theodolite/src/main/kotlin/theodolite/patcher/MatchLabelPatcher.kt @@ -0,0 +1,34 @@ +package theodolite.patcher + +import io.fabric8.kubernetes.api.model.KubernetesResource +import io.fabric8.kubernetes.api.model.apps.Deployment +import io.fabric8.kubernetes.api.model.apps.StatefulSet + +/** + * This patcher is able to set the `spec.selector.matchLabels` for a `Deployment` or `StatefulSet` Kubernetes resource. + * + * @property k8sResource The Kubernetes manifests to patch + * @property variableName The matchLabel which should be set + */ +class MatchLabelPatcher(private val k8sResource: KubernetesResource, val variableName: String) : + AbstractPatcher(k8sResource) { + + override fun <String> patch(labelValue: String) { + if (labelValue is kotlin.String) { + when (k8sResource) { + is Deployment -> { + if (k8sResource.spec.selector.matchLabels == null) { + k8sResource.spec.selector.matchLabels = mutableMapOf() + } + k8sResource.spec.selector.matchLabels[this.variableName] = labelValue + } + is StatefulSet -> { + if (k8sResource.spec.selector.matchLabels == null) { + k8sResource.spec.selector.matchLabels = mutableMapOf() + } + k8sResource.spec.selector.matchLabels[this.variableName] = labelValue + } + } + } + } +} \ No newline at end of file diff --git a/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt b/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt index 88b3e19e999a889cdcb8345ca7c90c37a6e6d275..e92de4dba7de298c9df76600f2c6785f5878103e 100644 --- a/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt +++ b/theodolite/src/main/kotlin/theodolite/patcher/PatcherFactory.kt @@ -79,6 +79,14 @@ class PatcherFactory { k8sResource = resource, variableName = patcherDefinition.properties["variableName"]!! ) + "MatchLabelPatcher" -> MatchLabelPatcher( + k8sResource = resource, + variableName = patcherDefinition.properties["variableName"]!! + ) + "TemplateLabelPatcher" -> TemplateLabelPatcher( + k8sResource = resource, + variableName = patcherDefinition.properties["variableName"]!! + ) "ImagePatcher" -> ImagePatcher( k8sResource = resource, container = patcherDefinition.properties["container"]!! diff --git a/theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt b/theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt new file mode 100644 index 0000000000000000000000000000000000000000..a524e5c40f90ccf98dc95003cc33dcfceb6f8598 --- /dev/null +++ b/theodolite/src/main/kotlin/theodolite/patcher/TemplateLabelPatcher.kt @@ -0,0 +1,34 @@ +package theodolite.patcher + +import io.fabric8.kubernetes.api.model.KubernetesResource +import io.fabric8.kubernetes.api.model.apps.Deployment +import io.fabric8.kubernetes.api.model.apps.StatefulSet + +/** + * This patcher is able to set the field `spec.template.metadata.labels` for a `Deployment` or `StatefulSet` Kubernetes resource. + * + * @property k8sResource The Kubernetes manifests to patch + * @property variableName The label which should be set + */ +class TemplateLabelPatcher(private val k8sResource: KubernetesResource, val variableName: String) : + AbstractPatcher(k8sResource) { + + override fun <String> patch(labelValue: String) { + if (labelValue is kotlin.String) { + when (k8sResource) { + is Deployment -> { + if (k8sResource.spec.template.metadata.labels == null) { + k8sResource.spec.template.metadata.labels = mutableMapOf() + } + k8sResource.spec.template.metadata.labels[this.variableName] = labelValue + } + is StatefulSet -> { + if (k8sResource.spec.template.metadata.labels == null) { + k8sResource.spec.template.metadata.labels = mutableMapOf() + } + k8sResource.spec.template.metadata.labels[this.variableName] = labelValue + } + } + } + } +} \ No newline at end of file