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

update crd schemata, minor code changes

parent 1f7e2ccb
No related branches found
No related tags found
1 merge request!171Introduce ResourceSets to make loading of resource files more flexible
...@@ -129,16 +129,16 @@ spec: ...@@ -129,16 +129,16 @@ spec:
items: items:
type: object type: object
properties: properties:
ConfigMapResourceSet: configMap:
type: object type: object
properties: properties:
configmap: name:
type: string type: string
files: files:
type: array type: array
items: items:
type: string type: string
FileSystemResourceSet: fileSystem:
type: object type: object
properties: properties:
path: path:
...@@ -152,16 +152,16 @@ spec: ...@@ -152,16 +152,16 @@ spec:
items: items:
type: object type: object
properties: properties:
ConfigMapResourceSet: configMap:
type: object type: object
properties: properties:
configmap: name:
type: string type: string
files: files:
type: array type: array
items: items:
type: string type: string
FileSystemResourceSet: fileSystem:
type: object type: object
properties: properties:
path: path:
......
...@@ -29,14 +29,14 @@ spec: ...@@ -29,14 +29,14 @@ spec:
- name: "theodolite-.*" - name: "theodolite-.*"
removeOnly: True removeOnly: True
appResourceSets: appResourceSets:
- FileSystemResourceSet: - fileSystem:
path: ./../../../../config path: ./../../../../config
files: files:
- "uc1-kstreams-deployment.yaml" - "uc1-kstreams-deployment.yaml"
- "aggregation-service.yaml" - "aggregation-service.yaml"
- "jmx-configmap.yaml" - "jmx-configmap.yaml"
- "uc1-service-monitor.yaml" - "uc1-service-monitor.yaml"
# - ConfigMapResourceSet: # - configMap:
# configmap: "test-configmap" # configmap: "test-configmap"
# files: # files:
# - "uc1-kstreams-deployment.yaml" # - "uc1-kstreams-deployment.yaml"
...@@ -44,7 +44,7 @@ spec: ...@@ -44,7 +44,7 @@ spec:
# - "jmx-configmap.yaml" # - "jmx-configmap.yaml"
# - "uc1-service-monitor.yaml" # - "uc1-service-monitor.yaml"
loadGenResourceSets: loadGenResourceSets:
- FileSystemResourceSet: - fileSystem:
path: ./../../../../config path: ./../../../../config
files: files:
- uc1-load-generator-service.yaml - uc1-load-generator-service.yaml
......
...@@ -10,6 +10,7 @@ import theodolite.k8s.resourceLoader.K8sResourceLoaderFromFile ...@@ -10,6 +10,7 @@ import theodolite.k8s.resourceLoader.K8sResourceLoaderFromFile
import theodolite.util.DeploymentFailedException import theodolite.util.DeploymentFailedException
import theodolite.util.YamlParserFromFile import theodolite.util.YamlParserFromFile
import java.io.File import java.io.File
import java.io.FileNotFoundException
import java.lang.IllegalArgumentException import java.lang.IllegalArgumentException
private val logger = KotlinLogging.logger {} private val logger = KotlinLogging.logger {}
...@@ -50,6 +51,9 @@ class FileSystemResourceSet: ResourceSet, KubernetesResource { ...@@ -50,6 +51,9 @@ class FileSystemResourceSet: ResourceSet, KubernetesResource {
kind = parser.parse(resourcePath, HashMap<String, String>()::class.java)?.get("kind")!! kind = parser.parse(resourcePath, HashMap<String, String>()::class.java)?.get("kind")!!
} catch (e: NullPointerException) { } catch (e: NullPointerException) {
throw DeploymentFailedException("Can not get Kind from resource $resourcePath, error is ${e.message}") throw DeploymentFailedException("Can not get Kind from resource $resourcePath, error is ${e.message}")
} catch (e: FileNotFoundException){
throw DeploymentFailedException("File $resourcePath not found")
} }
return try { return try {
......
...@@ -13,10 +13,10 @@ import theodolite.util.DeploymentFailedException ...@@ -13,10 +13,10 @@ import theodolite.util.DeploymentFailedException
@RegisterForReflection @RegisterForReflection
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
class ResourceSets: KubernetesResource { class ResourceSets: KubernetesResource {
@JsonProperty("ConfigMapResourceSet") @JsonProperty("configMap")
lateinit var configMap: ConfigMapResourceSet lateinit var configMap: ConfigMapResourceSet
@JsonProperty("FileSystemResourceSet") @JsonProperty("fileSystem")
lateinit var fileSystem: FileSystemResourceSet lateinit var fileSystem: FileSystemResourceSet
fun loadResourceSet(client: NamespacedKubernetesClient): Collection<Pair<String, KubernetesResource>> { fun loadResourceSet(client: NamespacedKubernetesClient): Collection<Pair<String, KubernetesResource>> {
......
...@@ -65,7 +65,8 @@ class TheodoliteController( ...@@ -65,7 +65,8 @@ class TheodoliteController(
* @see BenchmarkExecution * @see BenchmarkExecution
*/ */
private fun runExecution(execution: BenchmarkExecution, benchmark: KubernetesBenchmark) { private fun runExecution(execution: BenchmarkExecution, benchmark: KubernetesBenchmark) {
val modifier = ConfigOverrideModifier( try {
val modifier = ConfigOverrideModifier(
execution = execution, execution = execution,
resources = benchmark.loadKubernetesResources(benchmark.appResourceSets).map { it.first } resources = benchmark.loadKubernetesResources(benchmark.appResourceSets).map { it.first }
+ benchmark.loadKubernetesResources(benchmark.loadGenResourceSets).map { it.first } + benchmark.loadKubernetesResources(benchmark.loadGenResourceSets).map { it.first }
...@@ -86,7 +87,6 @@ class TheodoliteController( ...@@ -86,7 +87,6 @@ class TheodoliteController(
executionStateHandler.setExecutionState(execution.name, States.RUNNING) executionStateHandler.setExecutionState(execution.name, States.RUNNING)
executionStateHandler.startDurationStateTimer(execution.name) executionStateHandler.startDurationStateTimer(execution.name)
try {
executor = TheodoliteExecutor(execution, benchmark) executor = TheodoliteExecutor(execution, benchmark)
executor.run() executor.run()
when (executionStateHandler.getExecutionState(execution.name)) { when (executionStateHandler.getExecutionState(execution.name)) {
......
...@@ -226,7 +226,6 @@ class ConfigMapResourceSetTest { ...@@ -226,7 +226,6 @@ class ConfigMapResourceSetTest {
try { try {
resourceSet.getResourceSet(server.client) resourceSet.getResourceSet(server.client)
} catch (e: Exception) { } catch (e: Exception) {
println( "haha " + e)
ex = e ex = e
} }
assertTrue(ex is DeploymentFailedException) assertTrue(ex is DeploymentFailedException)
......
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