Skip to content
Snippets Groups Projects
Commit 687b96d4 authored by Benedikt Wetzel's avatar Benedikt Wetzel
Browse files

Add a NodeSelectorPatcher

parent a8da7d41
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
package theodolite.patcher
import io.fabric8.kubernetes.api.model.KubernetesResource
import io.fabric8.kubernetes.api.model.Service
import io.fabric8.kubernetes.api.model.apps.Deployment
class NodeSelectorPatcher(private val k8sResource: KubernetesResource, private val variableName: String): AbstractPatcher(k8sResource, variableName){
override fun <String> patch(value: String) {
if (k8sResource is Deployment) {
k8sResource.spec.template.spec.nodeSelector = mapOf(variableName to value as kotlin.String)
}
}
}
\ No newline at end of file
...@@ -12,6 +12,8 @@ class PatcherManager { ...@@ -12,6 +12,8 @@ class PatcherManager {
"EnvVarPatcher" -> EnvVarPatcher(k8sResources.filter { it.first == patcherDefinition.resource}.map { resource -> resource.second }[0], "EnvVarPatcher" -> EnvVarPatcher(k8sResources.filter { it.first == patcherDefinition.resource}.map { resource -> resource.second }[0],
patcherDefinition.container, patcherDefinition.container,
patcherDefinition.variableName) patcherDefinition.variableName)
"NodeSelectorPatcher" -> NodeSelectorPatcher(k8sResources.filter { it.first == patcherDefinition.resource }.map { resource -> resource.second }[0],
patcherDefinition.variableName)
else -> throw IllegalArgumentException("Patcher type ${patcherDefinition.type} not found") else -> throw IllegalArgumentException("Patcher type ${patcherDefinition.type} not found")
} }
} }
......
...@@ -29,4 +29,16 @@ configOverrides: ...@@ -29,4 +29,16 @@ configOverrides:
container: "workload-generator" container: "workload-generator"
variableName: "KAFKA_SERVER" variableName: "KAFKA_SERVER"
value: "localhost:9192" value: "localhost:9192"
- patcher:
type: "NodeSelectorPatcher"
resource: "workloadGenerator.yaml"
variableName: "env"
value: "prod"
- patcher:
type: "NodeSelectorPatcher"
resource: "aggregation-deployment.yaml"
variableName: "env"
value: "prod"
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