Skip to content
Snippets Groups Projects
Commit 55d76f79 authored by Lorenz Boguhn's avatar Lorenz Boguhn Committed by Sören Henning
Browse files

Fix the aggregation-deployment correct + ResourceLimitPatcher

parent 449cc5b5
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!85Introduce new Benchmark class and Patcher,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
This commit is part of merge request !85. Comments created here will be created in the context of that merge request.
...@@ -3,32 +3,36 @@ package theodolite.patcher ...@@ -3,32 +3,36 @@ package theodolite.patcher
import io.fabric8.kubernetes.api.model.KubernetesResource import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.api.model.Quantity import io.fabric8.kubernetes.api.model.Quantity
import io.fabric8.kubernetes.api.model.ResourceRequirements import io.fabric8.kubernetes.api.model.ResourceRequirements
import io.fabric8.kubernetes.api.model.ResourceRequirementsBuilder
import io.fabric8.kubernetes.api.model.apps.Deployment import io.fabric8.kubernetes.api.model.apps.Deployment
import io.fabric8.kubernetes.api.model.apps.StatefulSet
import java.lang.IllegalStateException
class ResourceLimitPatcher(private val k8sResource: KubernetesResource, private val container: String, private val variableName: String): AbstractPatcher(k8sResource, container, variableName) { class ResourceLimitPatcher(
private val k8sResource: KubernetesResource,
private val container: String,
private val variableName: String
) : AbstractPatcher(k8sResource, container, variableName) {
override fun <String> patch(value: String) { override fun <String> patch(value: String) {
if (k8sResource is Deployment) { if (k8sResource is Deployment) {
k8sResource.spec.template.spec.containers.filter { it.name == container }.forEach { k8sResource.spec.template.spec.containers.filter { it.name == container }.forEach {
try { try {
println("before: " + it.resources.limits.toString())
println("$variableName to : $value")
if (it.resources.limits.isNullOrEmpty()) { if (it.resources.limits.isNullOrEmpty()) {
it.resources.limits = mapOf(variableName to Quantity(value as kotlin.String)) it.resources.limits = mapOf(variableName to Quantity(value as kotlin.String))
} else { } else {
val values = it.resources.limits val values = Quantity(value as kotlin.String)
println(values) it.resources.limits[variableName] = values
values[variableName] = Quantity(value as kotlin.String)
it.resources.limits = values
} }
} catch (e: IllegalStateException) { } catch (e: IllegalStateException) {
val resource = ResourceRequirements() val resource = ResourceRequirements()
resource.limits = mapOf(variableName to Quantity(value as kotlin.String)) resource.limits = mapOf(variableName to Quantity(value as kotlin.String))
it.resources = resource it.resources = resource
} }
println("after " + it.resources.limits.toString())
} }
} }
} }
} }
\ No newline at end of file
...@@ -14,42 +14,42 @@ spec: ...@@ -14,42 +14,42 @@ spec:
spec: spec:
terminationGracePeriodSeconds: 0 terminationGracePeriodSeconds: 0
containers: containers:
- name: uc-application - name: uc-application
image: uc-app:latest image: ghcr.io/cau-se/theodolite-uc1-kstreams-app:latest
ports: ports:
- containerPort: 5555 - containerPort: 5555
name: jmx name: jmx
env: env:
- name: KAFKA_BOOTSTRAP_SERVERS - name: KAFKA_BOOTSTRAP_SERVERS
value: "my-confluent-cp-kafka:9092" value: "my-confluent-cp-kafka:9092"
- name: SCHEMA_REGISTRY_URL - name: SCHEMA_REGISTRY_URL
value: "http://my-confluent-cp-schema-registry:8081" value: "http://my-confluent-cp-schema-registry:8081"
- name: JAVA_OPTS - name: JAVA_OPTS
value: "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=5555" value: "-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=5555"
- name: COMMIT_INTERVAL_MS # Set as default for the applications - name: COMMIT_INTERVAL_MS # Set as default for the applications
value: "100" value: "100"
resources: resources:
limits: limits:
memory: 4Gi memory: 4Gi
cpu: 1000m cpu: 1000m
- name: prometheus-jmx-exporter - name: prometheus-jmx-exporter
image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143" image: "solsson/kafka-prometheus-jmx-exporter@sha256:6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143"
command: command:
- java - java
- -XX:+UnlockExperimentalVMOptions - -XX:+UnlockExperimentalVMOptions
- -XX:+UseCGroupMemoryLimitForHeap - -XX:+UseCGroupMemoryLimitForHeap
- -XX:MaxRAMFraction=1 - -XX:MaxRAMFraction=1
- -XshowSettings:vm - -XshowSettings:vm
- -jar - -jar
- jmx_prometheus_httpserver.jar - jmx_prometheus_httpserver.jar
- "5556" - "5556"
- /etc/jmx-aggregation/jmx-kafka-prometheus.yml - /etc/jmx-aggregation/jmx-kafka-prometheus.yml
ports: ports:
- containerPort: 5556 - containerPort: 5556
volumeMounts: volumeMounts:
- name: jmx-config - name: jmx-config
mountPath: /etc/jmx-aggregation mountPath: /etc/jmx-aggregation
volumes: volumes:
- name: jmx-config - name: jmx-config
configMap: configMap:
name: aggregation-jmx-configmap name: aggregation-jmx-configmap
\ No newline at end of file
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